Skip to content

Commit 12dd5b5

Browse files
committed
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

.vscode/settings.json

Lines changed: 0 additions & 4 deletions
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

README.md

Lines changed: 5 additions & 1 deletion
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

src/configs/javascript.ts

Lines changed: 9 additions & 7 deletions
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 }],

src/factory.ts

Lines changed: 0 additions & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy