Skip to content

Ignore export const case#88

Merged
cowboyd merged 1 commit intothefrontside:v3from
ai:export-const
Mar 19, 2026
Merged

Ignore export const case#88
cowboyd merged 1 commit intothefrontside:v3from
ai:export-const

Conversation

@ai
Copy link
Contributor

@ai ai commented Mar 16, 2026

Motivation

@cowboyd sorry, I came with small fix for my recent PR.

In JS code let/const is almost identical.

In export statement let means that export value can be changed in runtime. It is a very different signal.

I suggest ignoring export case at all in the rule.

@github-actions
Copy link
Contributor

Package Changes Through fadad0b

There are 1 changes which include eslint-plugin-prefer-let with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
eslint-plugin-prefer-let 4.2.0 4.2.1

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@cowboyd
Copy link
Member

cowboyd commented Mar 16, 2026

What are the specific scenarios that you are wanting to fix?

@ai
Copy link
Contributor Author

ai commented Mar 16, 2026

export const settings = stateManager()

With forceUpperCaseConst we need to use let here (which mean very different export mechanism) or SETTINGS which is not really C++-style constant.

@cowboyd
Copy link
Member

cowboyd commented Mar 16, 2026

That makes sense. Before moving ahead, that case seems rare enough that maybe it makes sense to disable for that line?

I'll leave it up to you though.

@ai
Copy link
Contributor Author

ai commented Mar 16, 2026

That makes sense. Before moving ahead, that case seems rare enough that maybe it makes sense to disable for that line?

In my open source it is pretty popular pattern. Some projects have 10+ exports like this.

@ai
Copy link
Contributor Author

ai commented Mar 18, 2026

Here is an example of my code where I used export const https://github.com/logux/client/blob/main/badge/index.js#L114-L123

Also, export const is a popular construction in webapps when we are using state manager https://github.com/hplush/slowreader/blob/main/web/stores/url-router.ts#L19

GitHub
Logux base components to build web client. Contribute to logux/client development by creating an account on GitHub.
GitHub
Web app to combine feeds from social networks and RSS and to help read more meaningful and deep content - hplush/slowreader

@cowboyd cowboyd merged commit 2574138 into thefrontside:v3 Mar 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants