Skip to content

Commit 84221ae

Browse files
committed
feat: move disable rules to the end, remove deprecated rules
1 parent e865bf3 commit 84221ae

File tree

7 files changed

+58
-50
lines changed

7 files changed

+58
-50
lines changed

src/configs/disables.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { GLOB_DTS, GLOB_SRC, GLOB_SRC_EXT } from '../constants/glob'
2+
import type { TypedFlatConfigItem } from '../types'
3+
4+
export async function disables(): Promise<TypedFlatConfigItem[]> {
5+
return [
6+
{
7+
files: [`scripts/${GLOB_SRC}`],
8+
name: 'coderwyd/disables/scripts',
9+
rules: {
10+
'no-console': 'off',
11+
'ts/explicit-function-return-type': 'off',
12+
'unicorn/consistent-function-scoping': 'off',
13+
},
14+
},
15+
{
16+
files: [`cli/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
17+
name: 'coderwyd/disables/cli',
18+
rules: {
19+
'no-console': 'off',
20+
},
21+
},
22+
{
23+
files: ['**/bin/**/*', `**/bin.${GLOB_SRC_EXT}`],
24+
name: 'coderwyd/disables/bin',
25+
rules: {
26+
'antfu/no-import-dist': 'off',
27+
'antfu/no-import-node-modules-by-path': 'off',
28+
},
29+
},
30+
{
31+
files: [GLOB_DTS],
32+
name: 'coderwyd/disables/dts',
33+
rules: {
34+
'eslint-comments/no-unlimited-disable': 'off',
35+
'import/no-duplicates': 'off',
36+
'no-restricted-syntax': 'off',
37+
'unused-imports/no-unused-vars': 'off',
38+
},
39+
},
40+
{
41+
files: ['**/*.{test,spec}.([tj])s?(x)'],
42+
name: 'coderwyd/disables/test',
43+
rules: {
44+
'no-unused-expressions': 'off',
45+
},
46+
},
47+
{
48+
files: ['**/*.js', '**/*.cjs'],
49+
name: 'coderwyd/disables/cjs',
50+
rules: {
51+
'ts/no-require-imports': 'off',
52+
},
53+
},
54+
]
55+
}

src/configs/imports.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,5 @@ export function imports(
3232
: {}),
3333
},
3434
},
35-
{
36-
files: ['**/bin/**/*', `**/bin.${GLOB_SRC_EXT}`],
37-
name: 'coderwyd/imports/disables/bin',
38-
rules: {
39-
'antfu/no-import-dist': 'off',
40-
'antfu/no-import-node-modules-by-path': 'off',
41-
},
42-
},
4335
]
4436
}

src/configs/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ export * from './tailwindcss'
2020
export * from './command'
2121
export * from './regexp'
2222
export * from './jsx'
23+
export * from './disables'

src/configs/javascript.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -243,19 +243,5 @@ export function javascript(
243243
...overrides,
244244
},
245245
},
246-
{
247-
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
248-
name: 'coderwyd/javascript/disables/cli',
249-
rules: {
250-
'no-console': 'off',
251-
},
252-
},
253-
{
254-
files: ['**/*.{test,spec}.js?(x)'],
255-
name: 'coderwyd/javascript/disables/test',
256-
rules: {
257-
'no-unused-expressions': 'off',
258-
},
259-
},
260246
]
261247
}

src/configs/test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export async function test(
5454
'test/prefer-lowercase-title': 'error',
5555

5656
'ts/explicit-function-return-type': 'off',
57+
'unicorn/consistent-function-scoping': 'off',
5758

5859
...overrides,
5960
},

src/configs/typescript.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ export async function typescript(
121121
'@typescript-eslint': 'ts',
122122
}),
123123
'no-dupe-class-members': 'off',
124-
'no-loss-of-precision': 'off',
125124
'no-redeclare': 'off',
126125
'no-use-before-define': 'off',
127126
'no-useless-constructor': 'off',
@@ -146,8 +145,6 @@ export async function typescript(
146145
'ts/no-extraneous-class': 'off',
147146
'ts/no-import-type-side-effects': 'error',
148147
'ts/no-invalid-void-type': 'off',
149-
// this is deprecated
150-
'ts/no-loss-of-precision': 'off',
151148
'ts/no-non-null-assertion': 'off',
152149
'ts/no-redeclare': 'error',
153150
'ts/no-require-imports': 'error',
@@ -176,30 +173,5 @@ export async function typescript(
176173
},
177174
]
178175
: []),
179-
{
180-
files: [GLOB_DTS],
181-
name: 'coderwyd/typescript/disables/dts',
182-
rules: {
183-
'eslint-comments/no-unlimited-disable': 'off',
184-
'import/no-duplicates': 'off',
185-
'no-restricted-syntax': 'off',
186-
'unused-imports/no-unused-vars': 'off',
187-
},
188-
},
189-
{
190-
files: ['**/*.{test,spec}.ts?(x)'],
191-
name: 'coderwyd/typescript/disables/test',
192-
rules: {
193-
'no-unused-expressions': 'off',
194-
},
195-
},
196-
{
197-
files: ['**/*.js', '**/*.cjs'],
198-
name: 'coderwyd/typescript/disables/cjs',
199-
rules: {
200-
'ts/no-require-imports': 'off',
201-
'ts/no-var-requires': 'off',
202-
},
203-
},
204176
]
205177
}

src/configs/unicorn.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export function unicorn(): TypedFlatConfigItem[] {
1212
// 'unicorn/better-regex': 'error',
1313
'unicorn/catch-error-name': 'error',
1414
'unicorn/consistent-empty-array-spread': 'error',
15+
'unicorn/consistent-function-scoping': ['error', { checkArrowFunctions: false }],
1516
'unicorn/custom-error-definition': 'error',
1617
'unicorn/error-message': 'error',
1718
// 'unicorn/explicit-length-check': 'error',

0 commit comments

Comments
 (0)