Skip to content

Commit 12dd5b5

Browse files
committedJan 21, 2025
feat: turn off prefer-const in editor
1 parent 4c2867b commit 12dd5b5

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed
 

Diff for: ‎.vscode/settings.json

-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
"source.organizeImports": "never"
1010
},
1111

12-
"eslint.options": {
13-
"flags": ["unstable_ts_config"]
14-
},
15-
1612
"eslint.runtime": "node",
1713

1814
// Silent the stylistic rules in you IDE, but still auto fix them

Diff for: ‎README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,11 @@ export default antfu({
730730

731731
### Editor Specific Disables
732732

733-
Some rules are disabled when inside ESLint IDE integrations, namely [`unused-imports/no-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports) [`test/no-only-tests`](https://github.com/levibuzolic/eslint-plugin-no-only-tests)
733+
Some rules are disabled when inside ESLint IDE integrations, namely:
734+
735+
- [`prefer-const`](https://eslint.org/docs/rules/prefer-const)
736+
- [`unused-imports/no-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports)
737+
- [`test/no-only-tests`](https://github.com/levibuzolic/eslint-plugin-no-only-tests)
734738

735739
This is to prevent unused imports from getting removed by the IDE during refactoring to get a better developer experience. Those rules will be applied when you run ESLint in the terminal or [Lint Staged](#lint-staged). If you don't want this behavior, you can disable them:
736740

Diff for: ‎src/configs/javascript.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,15 @@ export async function javascript(
177177
allowUnboundThis: true,
178178
},
179179
],
180-
'prefer-const': [
181-
'error',
182-
{
183-
destructuring: 'all',
184-
ignoreReadBeforeAssign: true,
185-
},
186-
],
180+
'prefer-const': isInEditor
181+
? 'off'
182+
: [
183+
'error',
184+
{
185+
destructuring: 'all',
186+
ignoreReadBeforeAssign: true,
187+
},
188+
],
187189
'prefer-exponentiation-operator': 'error',
188190
'prefer-promise-reject-errors': 'error',
189191
'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],

Diff for: ‎src/factory.ts

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import {
3333
yaml,
3434
} from './configs'
3535
import { formatters } from './configs/formatters'
36-
3736
import { regexp } from './configs/regexp'
3837
import { interopDefault, isInEditorEnv } from './utils'
3938

0 commit comments

Comments
 (0)
Please sign in to comment.