Skip to content

Add forceUpperCaseConst option to prefer-let#84

Merged
cowboyd merged 2 commits intothefrontside:v3from
ai:capitalize
Mar 12, 2026
Merged

Add forceUpperCaseConst option to prefer-let#84
cowboyd merged 2 commits intothefrontside:v3from
ai:capitalize

Conversation

@ai
Copy link
Contributor

@ai ai commented Mar 12, 2026

Motivation

I am using let for all variables and const for real logical constant (like config):

const MS_IN_DAY = 24 * 60 * 60 * 1000

let foo = 1

Approach

I added forceUpperCaseConst option to prefer-let which will allow to use const only for top-level vars with specific name pattern.

Alternate Designs

We can enable this option by design if you are also using the same logic.

Possible Drawbacks or Risks

I don’t see any

TODOs and Open Questions

I avoid changing packages/eslint-plugin-prefer-let/docs/rules/prefer-let.md because it was already empty.

Learning

N/A

Screenshots

N/A

@ai
Copy link
Contributor Author

ai commented Mar 12, 2026

@cowboyd if you don’t need it, I can create a fork

@github-actions
Copy link
Contributor

github-actions bot commented Mar 12, 2026

Package Changes Through 7d03891

No changes.

Add a 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 12, 2026

This looks good to me. Can you add a something to the README to explain this option?

@ai
Copy link
Contributor Author

ai commented Mar 12, 2026

Docs were updated 7d03891

@cowboyd cowboyd merged commit 20b6ea4 into thefrontside:v3 Mar 12, 2026
1 check passed
@ai
Copy link
Contributor Author

ai commented Mar 12, 2026

Thanks for quick reaction!

@cowboyd
Copy link
Member

cowboyd commented Mar 13, 2026

No worries. Although totally forgot to add a changeset, so it did not generate a release PR. Any chance you could create one? Here is an example from the last PR https://github.com/thefrontside/javascript/pull/78/changes#diff-f99018ad680c1619bbdcf2df7d4ef0b3bf07a4407fa0127d6097c1918a637e31

GitHub
Summary

Replace deprecated context.getSourceCode() with context.sourceCode fallback for ESLint v10 compatibility
Remove type property from test error assertions (removed in ESLint v10 RuleTester)
...

@ai ai mentioned this pull request Mar 13, 2026
@ai
Copy link
Contributor Author

ai commented Mar 13, 2026

Done #85

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