@aryaemami59/eslint-config 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/index.cjs +368 -324
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2523 -1227
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +2523 -1227
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +316 -286
- package/dist/index.js.map +1 -1
- package/package.json +30 -21
- package/src/disabledRules.ts +29 -10
- package/src/external.ts +3 -0
- package/src/globalIgnores.ts +14 -13
- package/src/globals.ts +13 -15
- package/src/index.ts +1 -0
- package/src/{packageName.ts → packageJsonName.ts} +3 -1
- package/src/shareableConfigs.ts +197 -192
- package/src/utils.ts +6 -7
package/src/shareableConfigs.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { TSESLint } from '@typescript-eslint/utils'
|
|
2
1
|
import type { Linter } from 'eslint'
|
|
3
2
|
import { disabledRules } from './disabledRules.js'
|
|
4
|
-
import {
|
|
3
|
+
import type { FlatConfig } from './external.js'
|
|
4
|
+
import { js, prettierConfig } from './external.js'
|
|
5
5
|
import { globalIgnores } from './globalIgnores.js'
|
|
6
6
|
import { globals } from './globals.js'
|
|
7
|
-
import {
|
|
7
|
+
import { packageJsonName } from './packageJsonName.js'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Flat ESLint configuration tailored for projects using TypeScript.
|
|
@@ -48,199 +48,204 @@ import { packageName } from './packageName.js'
|
|
|
48
48
|
* @since 0.0.3
|
|
49
49
|
* @public
|
|
50
50
|
*/
|
|
51
|
-
export const flatESLintConfig
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
globalIgnores,
|
|
51
|
+
export const flatESLintConfig = [
|
|
52
|
+
// `ignores` must be first.
|
|
53
|
+
// config with just `ignores` is the replacement for `.eslintignore`
|
|
54
|
+
globalIgnores,
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
{
|
|
57
|
+
name: `${js.meta.name}/recommended`,
|
|
58
|
+
...js.configs.recommended,
|
|
59
|
+
} as const satisfies FlatConfig.Config satisfies Linter.Config,
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
// TODO: You can remove the type assertion in the next major version of `typescript-eslint`.
|
|
62
|
+
// TODO: Uncomment this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.
|
|
63
|
+
// ...(configs.recommended satisfies Linter.Config[] as Linter.Config<any>[]),
|
|
64
|
+
// TODO: You can remove the type assertion in the next major version of `typescript-eslint`.
|
|
65
|
+
// TODO: Uncomment this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.
|
|
66
|
+
// ...(configs.stylistic satisfies Linter.Config[] as Linter.Config<any>[]),
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
disallowTypeAnnotations: true,
|
|
79
|
-
fixStyle: 'separate-type-imports',
|
|
80
|
-
prefer: 'type-imports',
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
'@typescript-eslint/consistent-type-exports': [
|
|
84
|
-
2,
|
|
85
|
-
{ fixMixedExportsWithInlineTypeSpecifier: false },
|
|
86
|
-
],
|
|
87
|
-
'@typescript-eslint/no-explicit-any': [
|
|
88
|
-
2,
|
|
89
|
-
{
|
|
90
|
-
fixToUnknown: false,
|
|
91
|
-
ignoreRestArgs: false,
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
'@typescript-eslint/no-empty-object-type': [
|
|
95
|
-
2,
|
|
96
|
-
{
|
|
97
|
-
allowInterfaces: 'never',
|
|
98
|
-
allowObjectTypes: 'never',
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
'@typescript-eslint/no-restricted-types': [
|
|
102
|
-
2,
|
|
103
|
-
{
|
|
104
|
-
types: {
|
|
105
|
-
'{}': {
|
|
106
|
-
message: `
|
|
107
|
-
- If you want to represent an empty object, use \`type EmptyObject = Record<string, never>\`.
|
|
108
|
-
- If you want to represent an object literal, use either \`type AnyObject = Record<string, any>\` or \`object\`.
|
|
109
|
-
- If you want to represent any non-nullish value, use \`type AnyNonNullishValue = NonNullable<unknown>\`.`,
|
|
110
|
-
suggest: [
|
|
111
|
-
'AnyNonNullishValue',
|
|
112
|
-
'EmptyObject',
|
|
113
|
-
'AnyObject',
|
|
114
|
-
'object',
|
|
115
|
-
'Record<string, never>',
|
|
116
|
-
'Record<string, any>',
|
|
117
|
-
'NonNullable<unknown>',
|
|
118
|
-
],
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
],
|
|
123
|
-
'@typescript-eslint/no-namespace': [
|
|
124
|
-
2,
|
|
125
|
-
{
|
|
126
|
-
allowDeclarations: false,
|
|
127
|
-
allowDefinitionFiles: true,
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
'@typescript-eslint/consistent-type-definitions': [2, 'type'],
|
|
131
|
-
'sort-imports': [
|
|
132
|
-
2,
|
|
133
|
-
{
|
|
134
|
-
allowSeparatedGroups: true,
|
|
135
|
-
ignoreCase: false,
|
|
136
|
-
ignoreDeclarationSort: true,
|
|
137
|
-
ignoreMemberSort: false,
|
|
138
|
-
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
'@typescript-eslint/unified-signatures': [
|
|
142
|
-
2,
|
|
143
|
-
{
|
|
144
|
-
ignoreDifferentlyNamedParameters: false,
|
|
145
|
-
ignoreOverloadsWithDifferentJSDoc: false,
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
'@typescript-eslint/no-unnecessary-type-parameters': [2],
|
|
149
|
-
'@typescript-eslint/no-invalid-void-type': [
|
|
150
|
-
2,
|
|
151
|
-
{
|
|
152
|
-
allowAsThisParameter: false,
|
|
153
|
-
allowInGenericTypeArguments: true,
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
'@typescript-eslint/no-confusing-void-expression': [
|
|
157
|
-
2,
|
|
158
|
-
{
|
|
159
|
-
ignoreArrowShorthand: false,
|
|
160
|
-
ignoreVoidOperator: false,
|
|
161
|
-
ignoreVoidReturningFunctions: false,
|
|
162
|
-
},
|
|
163
|
-
],
|
|
164
|
-
'@typescript-eslint/no-duplicate-type-constituents': [
|
|
165
|
-
2,
|
|
166
|
-
{
|
|
167
|
-
ignoreIntersections: false,
|
|
168
|
-
ignoreUnions: false,
|
|
169
|
-
},
|
|
170
|
-
],
|
|
171
|
-
'@typescript-eslint/require-await': [2],
|
|
172
|
-
'@typescript-eslint/no-redundant-type-constituents': [2],
|
|
173
|
-
'@typescript-eslint/no-unnecessary-type-arguments': [2],
|
|
174
|
-
'@typescript-eslint/no-unnecessary-type-assertion': [
|
|
175
|
-
2,
|
|
176
|
-
{ typesToIgnore: [] },
|
|
177
|
-
],
|
|
178
|
-
'@typescript-eslint/prefer-nullish-coalescing': [
|
|
179
|
-
2,
|
|
180
|
-
{
|
|
181
|
-
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
|
|
182
|
-
ignoreBooleanCoercion: false,
|
|
183
|
-
ignoreConditionalTests: true,
|
|
184
|
-
ignoreIfStatements: false,
|
|
185
|
-
ignoreMixedLogicalExpressions: false,
|
|
186
|
-
ignorePrimitives: {
|
|
187
|
-
bigint: false,
|
|
188
|
-
boolean: false,
|
|
189
|
-
number: false,
|
|
190
|
-
string: false,
|
|
191
|
-
},
|
|
192
|
-
ignoreTernaryTests: false,
|
|
193
|
-
},
|
|
194
|
-
],
|
|
195
|
-
'@typescript-eslint/no-inferrable-types': [
|
|
196
|
-
2,
|
|
197
|
-
{
|
|
198
|
-
ignoreParameters: false,
|
|
199
|
-
ignoreProperties: false,
|
|
200
|
-
},
|
|
201
|
-
],
|
|
202
|
-
'@typescript-eslint/no-require-imports': [
|
|
203
|
-
2,
|
|
204
|
-
{
|
|
205
|
-
allow: [],
|
|
206
|
-
allowAsImport: true,
|
|
207
|
-
},
|
|
208
|
-
],
|
|
209
|
-
'object-shorthand': [
|
|
210
|
-
2,
|
|
211
|
-
'always',
|
|
212
|
-
{
|
|
213
|
-
avoidExplicitReturnArrows: true,
|
|
214
|
-
avoidQuotes: true,
|
|
215
|
-
ignoreConstructors: true,
|
|
216
|
-
methodsIgnorePattern: '',
|
|
217
|
-
},
|
|
218
|
-
],
|
|
68
|
+
{
|
|
69
|
+
languageOptions: {
|
|
70
|
+
globals,
|
|
71
|
+
parserOptions: {
|
|
72
|
+
ecmaVersion: 'latest',
|
|
73
|
+
projectService: true,
|
|
74
|
+
} as const satisfies FlatConfig.ParserOptions satisfies Linter.ParserOptions,
|
|
75
|
+
},
|
|
76
|
+
linterOptions: {
|
|
77
|
+
reportUnusedDisableDirectives: 2,
|
|
78
|
+
reportUnusedInlineConfigs: 2,
|
|
79
|
+
},
|
|
80
|
+
name: `${packageJsonName}/defaults/overrides`,
|
|
219
81
|
|
|
220
|
-
|
|
221
|
-
|
|
82
|
+
rules: {
|
|
83
|
+
// TODO: Uncomment this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.
|
|
84
|
+
// '@typescript-eslint/consistent-type-definitions': [2, 'type'],
|
|
85
|
+
// '@typescript-eslint/consistent-type-exports': [
|
|
86
|
+
// 2,
|
|
87
|
+
// { fixMixedExportsWithInlineTypeSpecifier: false },
|
|
88
|
+
// ],
|
|
89
|
+
// '@typescript-eslint/consistent-type-imports': [
|
|
90
|
+
// 2,
|
|
91
|
+
// {
|
|
92
|
+
// disallowTypeAnnotations: true,
|
|
93
|
+
// fixStyle: 'separate-type-imports',
|
|
94
|
+
// prefer: 'type-imports',
|
|
95
|
+
// },
|
|
96
|
+
// ],
|
|
97
|
+
// '@typescript-eslint/no-confusing-void-expression': [
|
|
98
|
+
// 2,
|
|
99
|
+
// {
|
|
100
|
+
// ignoreArrowShorthand: false,
|
|
101
|
+
// ignoreVoidOperator: false,
|
|
102
|
+
// ignoreVoidReturningFunctions: false,
|
|
103
|
+
// },
|
|
104
|
+
// ],
|
|
105
|
+
// '@typescript-eslint/no-duplicate-type-constituents': [
|
|
106
|
+
// 2,
|
|
107
|
+
// {
|
|
108
|
+
// ignoreIntersections: false,
|
|
109
|
+
// ignoreUnions: false,
|
|
110
|
+
// },
|
|
111
|
+
// ],
|
|
112
|
+
// '@typescript-eslint/no-empty-object-type': [
|
|
113
|
+
// 2,
|
|
114
|
+
// {
|
|
115
|
+
// allowInterfaces: 'never',
|
|
116
|
+
// allowObjectTypes: 'never',
|
|
117
|
+
// },
|
|
118
|
+
// ],
|
|
119
|
+
// '@typescript-eslint/no-explicit-any': [
|
|
120
|
+
// 2,
|
|
121
|
+
// {
|
|
122
|
+
// fixToUnknown: false,
|
|
123
|
+
// ignoreRestArgs: false,
|
|
124
|
+
// },
|
|
125
|
+
// ],
|
|
126
|
+
// '@typescript-eslint/no-inferrable-types': [
|
|
127
|
+
// 2,
|
|
128
|
+
// {
|
|
129
|
+
// ignoreParameters: false,
|
|
130
|
+
// ignoreProperties: false,
|
|
131
|
+
// },
|
|
132
|
+
// ],
|
|
133
|
+
// '@typescript-eslint/no-invalid-void-type': [
|
|
134
|
+
// 2,
|
|
135
|
+
// {
|
|
136
|
+
// allowAsThisParameter: false,
|
|
137
|
+
// allowInGenericTypeArguments: true,
|
|
138
|
+
// },
|
|
139
|
+
// ],
|
|
140
|
+
// '@typescript-eslint/no-namespace': [
|
|
141
|
+
// 2,
|
|
142
|
+
// {
|
|
143
|
+
// allowDeclarations: false,
|
|
144
|
+
// allowDefinitionFiles: true,
|
|
145
|
+
// },
|
|
146
|
+
// ],
|
|
147
|
+
// '@typescript-eslint/no-redundant-type-constituents': [2],
|
|
148
|
+
// '@typescript-eslint/no-require-imports': [
|
|
149
|
+
// 2,
|
|
150
|
+
// {
|
|
151
|
+
// allow: [],
|
|
152
|
+
// allowAsImport: true,
|
|
153
|
+
// },
|
|
154
|
+
// ],
|
|
155
|
+
// '@typescript-eslint/no-restricted-types': [
|
|
156
|
+
// 2,
|
|
157
|
+
// {
|
|
158
|
+
// types: {
|
|
159
|
+
// '{}': {
|
|
160
|
+
// message: `
|
|
161
|
+
// - If you want to represent an empty object, use \`type EmptyObject = Record<string, never>\`.
|
|
162
|
+
// - If you want to represent an object literal, use either \`type AnyObject = Record<string, any>\` or \`object\`.
|
|
163
|
+
// - If you want to represent any non-nullish value, use \`type AnyNonNullishValue = NonNullable<unknown>\`.`,
|
|
164
|
+
// suggest: [
|
|
165
|
+
// 'AnyNonNullishValue',
|
|
166
|
+
// 'EmptyObject',
|
|
167
|
+
// 'AnyObject',
|
|
168
|
+
// 'object',
|
|
169
|
+
// 'Record<string, never>',
|
|
170
|
+
// 'Record<string, any>',
|
|
171
|
+
// 'NonNullable<unknown>',
|
|
172
|
+
// ],
|
|
173
|
+
// },
|
|
174
|
+
// },
|
|
175
|
+
// },
|
|
176
|
+
// ],
|
|
177
|
+
// '@typescript-eslint/no-unnecessary-type-arguments': [2],
|
|
178
|
+
// '@typescript-eslint/no-unnecessary-type-assertion': [
|
|
179
|
+
// 2,
|
|
180
|
+
// { typesToIgnore: [] },
|
|
181
|
+
// ],
|
|
182
|
+
// '@typescript-eslint/no-unnecessary-type-parameters': [2],
|
|
183
|
+
// '@typescript-eslint/prefer-nullish-coalescing': [
|
|
184
|
+
// 2,
|
|
185
|
+
// {
|
|
186
|
+
// allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
|
|
187
|
+
// ignoreBooleanCoercion: false,
|
|
188
|
+
// ignoreConditionalTests: true,
|
|
189
|
+
// ignoreIfStatements: false,
|
|
190
|
+
// ignoreMixedLogicalExpressions: false,
|
|
191
|
+
// ignorePrimitives: {
|
|
192
|
+
// bigint: false,
|
|
193
|
+
// boolean: false,
|
|
194
|
+
// number: false,
|
|
195
|
+
// string: false,
|
|
196
|
+
// },
|
|
197
|
+
// ignoreTernaryTests: false,
|
|
198
|
+
// },
|
|
199
|
+
// ],
|
|
200
|
+
// '@typescript-eslint/require-await': [2],
|
|
201
|
+
// '@typescript-eslint/unified-signatures': [
|
|
202
|
+
// 2,
|
|
203
|
+
// {
|
|
204
|
+
// ignoreDifferentlyNamedParameters: false,
|
|
205
|
+
// ignoreOverloadsWithDifferentJSDoc: false,
|
|
206
|
+
// },
|
|
207
|
+
// ],
|
|
208
|
+
'object-shorthand': [
|
|
209
|
+
2,
|
|
210
|
+
'always',
|
|
211
|
+
{
|
|
212
|
+
avoidExplicitReturnArrows: true,
|
|
213
|
+
avoidQuotes: true,
|
|
214
|
+
ignoreConstructors: true,
|
|
215
|
+
methodsIgnorePattern: '',
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
'sort-imports': [
|
|
219
|
+
2,
|
|
220
|
+
{
|
|
221
|
+
allowSeparatedGroups: true,
|
|
222
|
+
ignoreCase: false,
|
|
223
|
+
ignoreDeclarationSort: true,
|
|
224
|
+
ignoreMemberSort: false,
|
|
225
|
+
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
|
|
226
|
+
},
|
|
227
|
+
],
|
|
222
228
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
} as const satisfies TSESLint.FlatConfig.Config satisfies Linter.Config,
|
|
229
|
+
...disabledRules,
|
|
230
|
+
},
|
|
231
|
+
} as const satisfies Linter.Config,
|
|
227
232
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
233
|
+
{
|
|
234
|
+
files: ['**/*.cjs'],
|
|
235
|
+
languageOptions: {
|
|
236
|
+
sourceType: 'commonjs',
|
|
237
|
+
} as const satisfies FlatConfig.LanguageOptions satisfies Linter.LanguageOptions,
|
|
238
|
+
name: `${packageJsonName}/commonjs-files`,
|
|
239
|
+
rules: {
|
|
240
|
+
'@typescript-eslint/no-require-imports': [
|
|
241
|
+
0,
|
|
242
|
+
{
|
|
243
|
+
allow: [],
|
|
244
|
+
allowAsImport: false,
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
},
|
|
248
|
+
} as const satisfies Linter.Config,
|
|
244
249
|
|
|
245
|
-
|
|
246
|
-
|
|
250
|
+
prettierConfig,
|
|
251
|
+
] as const satisfies Linter.Config[]
|
package/src/utils.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
import { config } from './external.js'
|
|
1
|
+
import type { Linter } from 'eslint'
|
|
2
|
+
import { defineConfig } from 'eslint/config'
|
|
4
3
|
import { flatESLintConfig } from './shareableConfigs.js'
|
|
5
4
|
|
|
6
5
|
/**
|
|
@@ -9,7 +8,7 @@ import { flatESLintConfig } from './shareableConfigs.js'
|
|
|
9
8
|
* It's made mainly to provide intellisense and eliminate
|
|
10
9
|
* the need for manual type annotations using JSDoc comments.
|
|
11
10
|
*
|
|
12
|
-
* @param [additionalOverrides] - **Optional** additional overrides to apply to the configuration.
|
|
11
|
+
* @param [additionalOverrides=[]] - **Optional** additional overrides to apply to the configuration.
|
|
13
12
|
* @returns An augmented version of the default {@linkcode flatESLintConfig}, incorporating any provided overrides.
|
|
14
13
|
*
|
|
15
14
|
* @example
|
|
@@ -88,6 +87,6 @@ import { flatESLintConfig } from './shareableConfigs.js'
|
|
|
88
87
|
* @public
|
|
89
88
|
*/
|
|
90
89
|
export const createESLintConfig = (
|
|
91
|
-
additionalOverrides:
|
|
92
|
-
):
|
|
93
|
-
/* @__PURE__ */
|
|
90
|
+
additionalOverrides: Parameters<typeof defineConfig> = [],
|
|
91
|
+
): Linter.Config[] =>
|
|
92
|
+
/* @__PURE__ */ defineConfig(...flatESLintConfig, ...additionalOverrides)
|