@aryaemami59/eslint-config 0.0.6 → 0.0.8
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/dist/index.cjs +103 -205
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -9
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +100 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +97 -182
- package/dist/index.js.map +1 -1
- package/package.json +13 -16
- package/src/disabledRules.ts +2 -2
- package/src/external.ts +25 -8
- package/src/globalIgnores.ts +3 -3
- package/src/globals.ts +15 -8
- package/src/index.ts +13 -9
- package/src/packageJsonName.ts +1 -1
- package/src/shareableConfigs.ts +152 -141
- package/src/utils.ts +3 -3
package/src/index.ts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
export { disabledRules } from './disabledRules.js'
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
configs,
|
|
3
|
+
defineConfig,
|
|
5
4
|
js,
|
|
6
|
-
parser,
|
|
7
|
-
plugin,
|
|
8
5
|
prettierConfig,
|
|
6
|
+
tseslintConfig,
|
|
7
|
+
tseslintConfigs,
|
|
8
|
+
tseslintParser,
|
|
9
|
+
tseslintPlugin,
|
|
9
10
|
} from './external.js'
|
|
10
11
|
export type {
|
|
11
12
|
Config,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
ESLint,
|
|
14
|
+
Linter,
|
|
15
|
+
TSESLintConfig,
|
|
16
|
+
TSESLintConfigArray,
|
|
17
|
+
TSESLintConfigWithExtends,
|
|
18
|
+
TSESLintFlatConfig,
|
|
19
|
+
TSESLintInfiniteDepthConfigWithExtends,
|
|
16
20
|
} from './external.js'
|
|
17
21
|
export { globalIgnores } from './globalIgnores.js'
|
|
18
|
-
export {
|
|
22
|
+
export { sharedEnvironmentGlobals, vitestGlobals } from './globals.js'
|
|
19
23
|
export { flatESLintConfig } from './shareableConfigs.js'
|
|
20
24
|
export { createESLintConfig } from './utils.js'
|
package/src/packageJsonName.ts
CHANGED
package/src/shareableConfigs.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import packageJson from '@aryaemami59/eslint-config/package.json' with { type: 'json' }
|
|
2
2
|
import { disabledRules } from './disabledRules.js'
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
3
|
+
import type { Config, ESLint, Linter, TSESLintFlatConfig } from './external.js'
|
|
4
|
+
import {
|
|
5
|
+
js,
|
|
6
|
+
prettierConfig,
|
|
7
|
+
tseslintConfigs,
|
|
8
|
+
tseslintParser,
|
|
9
|
+
tseslintPlugin,
|
|
10
|
+
} from './external.js'
|
|
5
11
|
import { globalIgnores } from './globalIgnores.js'
|
|
6
|
-
import {
|
|
7
|
-
import { packageJsonName } from './packageJsonName.js'
|
|
12
|
+
import { sharedEnvironmentGlobals } from './globals.js'
|
|
8
13
|
|
|
9
14
|
/**
|
|
10
15
|
* Flat ESLint configuration tailored for projects using TypeScript.
|
|
@@ -56,155 +61,161 @@ export const flatESLintConfig = [
|
|
|
56
61
|
{
|
|
57
62
|
name: `${js.meta.name}/recommended`,
|
|
58
63
|
...js.configs.recommended,
|
|
59
|
-
} as const satisfies
|
|
64
|
+
} as const satisfies TSESLintFlatConfig.Config satisfies Config,
|
|
60
65
|
|
|
61
66
|
// TODO: You can remove the type assertion in the next major version of `typescript-eslint`.
|
|
62
67
|
// TODO: Uncomment this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.
|
|
63
|
-
|
|
68
|
+
...(tseslintConfigs.recommended satisfies TSESLintFlatConfig.Config[] satisfies Config[] as Config[]),
|
|
64
69
|
// TODO: You can remove the type assertion in the next major version of `typescript-eslint`.
|
|
65
70
|
// TODO: Uncomment this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.
|
|
66
|
-
|
|
71
|
+
...(tseslintConfigs.stylistic satisfies TSESLintFlatConfig.Config[] satisfies Config[] as Config[]),
|
|
67
72
|
|
|
68
73
|
{
|
|
69
74
|
languageOptions: {
|
|
70
|
-
globals,
|
|
75
|
+
globals: sharedEnvironmentGlobals,
|
|
76
|
+
parser:
|
|
77
|
+
tseslintParser satisfies TSESLintFlatConfig.Parser satisfies Linter.Parser as Linter.Parser,
|
|
71
78
|
parserOptions: {
|
|
72
79
|
ecmaVersion: 'latest',
|
|
73
80
|
projectService: true,
|
|
74
|
-
} as const satisfies
|
|
75
|
-
},
|
|
81
|
+
} as const satisfies TSESLintFlatConfig.ParserOptions satisfies Linter.ParserOptions,
|
|
82
|
+
} as const satisfies TSESLintFlatConfig.LanguageOptions satisfies Linter.LanguageOptions,
|
|
76
83
|
linterOptions: {
|
|
77
84
|
reportUnusedDisableDirectives: 2,
|
|
78
85
|
reportUnusedInlineConfigs: 2,
|
|
79
86
|
},
|
|
80
|
-
name: `${
|
|
87
|
+
name: `${packageJson.name}/defaults/overrides`,
|
|
88
|
+
plugins: {
|
|
89
|
+
'@typescript-eslint':
|
|
90
|
+
tseslintPlugin satisfies TSESLintFlatConfig.Plugin satisfies ESLint.Plugin as ESLint.Plugin,
|
|
91
|
+
},
|
|
81
92
|
|
|
82
93
|
rules: {
|
|
83
94
|
// TODO: Uncomment this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
95
|
+
'@typescript-eslint/consistent-type-definitions': [2, 'type'],
|
|
96
|
+
'@typescript-eslint/consistent-type-exports': [
|
|
97
|
+
2,
|
|
98
|
+
{ fixMixedExportsWithInlineTypeSpecifier: false },
|
|
99
|
+
],
|
|
100
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
101
|
+
2,
|
|
102
|
+
{
|
|
103
|
+
disallowTypeAnnotations: true,
|
|
104
|
+
fixStyle: 'separate-type-imports',
|
|
105
|
+
prefer: 'type-imports',
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
'@typescript-eslint/no-confusing-void-expression': [
|
|
109
|
+
2,
|
|
110
|
+
{
|
|
111
|
+
ignoreArrowShorthand: false,
|
|
112
|
+
ignoreVoidOperator: false,
|
|
113
|
+
ignoreVoidReturningFunctions: false,
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
'@typescript-eslint/no-duplicate-type-constituents': [
|
|
117
|
+
2,
|
|
118
|
+
{
|
|
119
|
+
ignoreIntersections: false,
|
|
120
|
+
ignoreUnions: false,
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
'@typescript-eslint/no-empty-object-type': [
|
|
124
|
+
2,
|
|
125
|
+
{
|
|
126
|
+
allowInterfaces: 'never',
|
|
127
|
+
allowObjectTypes: 'never',
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
'@typescript-eslint/no-explicit-any': [
|
|
131
|
+
2,
|
|
132
|
+
{
|
|
133
|
+
fixToUnknown: false,
|
|
134
|
+
ignoreRestArgs: false,
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
'@typescript-eslint/no-inferrable-types': [
|
|
138
|
+
2,
|
|
139
|
+
{
|
|
140
|
+
ignoreParameters: false,
|
|
141
|
+
ignoreProperties: false,
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
'@typescript-eslint/no-invalid-void-type': [
|
|
145
|
+
2,
|
|
146
|
+
{
|
|
147
|
+
allowAsThisParameter: false,
|
|
148
|
+
allowInGenericTypeArguments: true,
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
'@typescript-eslint/no-namespace': [
|
|
152
|
+
2,
|
|
153
|
+
{
|
|
154
|
+
allowDeclarations: false,
|
|
155
|
+
allowDefinitionFiles: true,
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
'@typescript-eslint/no-redundant-type-constituents': [2],
|
|
159
|
+
'@typescript-eslint/no-require-imports': [
|
|
160
|
+
2,
|
|
161
|
+
{
|
|
162
|
+
allow: [],
|
|
163
|
+
allowAsImport: true,
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
'@typescript-eslint/no-restricted-types': [
|
|
167
|
+
2,
|
|
168
|
+
{
|
|
169
|
+
types: {
|
|
170
|
+
'{}': {
|
|
171
|
+
message: `
|
|
172
|
+
- If you want to represent an empty object, use \`type EmptyObject = Record<string, never>\`.
|
|
173
|
+
- If you want to represent an object literal, use either \`type AnyObject = Record<string, any>\` or \`object\`.
|
|
174
|
+
- If you want to represent any non-nullish value, use \`type AnyNonNullishValue = NonNullable<unknown>\`.`,
|
|
175
|
+
suggest: [
|
|
176
|
+
'AnyNonNullishValue',
|
|
177
|
+
'EmptyObject',
|
|
178
|
+
'AnyObject',
|
|
179
|
+
'object',
|
|
180
|
+
'Record<string, never>',
|
|
181
|
+
'Record<string, any>',
|
|
182
|
+
'NonNullable<unknown>',
|
|
183
|
+
],
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
'@typescript-eslint/no-unnecessary-type-arguments': [2],
|
|
189
|
+
'@typescript-eslint/no-unnecessary-type-assertion': [
|
|
190
|
+
2,
|
|
191
|
+
{ typesToIgnore: [] },
|
|
192
|
+
],
|
|
193
|
+
'@typescript-eslint/no-unnecessary-type-parameters': [2],
|
|
194
|
+
'@typescript-eslint/prefer-nullish-coalescing': [
|
|
195
|
+
2,
|
|
196
|
+
{
|
|
197
|
+
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
|
|
198
|
+
ignoreBooleanCoercion: false,
|
|
199
|
+
ignoreConditionalTests: true,
|
|
200
|
+
ignoreIfStatements: false,
|
|
201
|
+
ignoreMixedLogicalExpressions: false,
|
|
202
|
+
ignorePrimitives: {
|
|
203
|
+
bigint: false,
|
|
204
|
+
boolean: false,
|
|
205
|
+
number: false,
|
|
206
|
+
string: false,
|
|
207
|
+
},
|
|
208
|
+
ignoreTernaryTests: false,
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
'@typescript-eslint/require-await': [2],
|
|
212
|
+
'@typescript-eslint/unified-signatures': [
|
|
213
|
+
2,
|
|
214
|
+
{
|
|
215
|
+
ignoreDifferentlyNamedParameters: false,
|
|
216
|
+
ignoreOverloadsWithDifferentJSDoc: false,
|
|
217
|
+
},
|
|
218
|
+
],
|
|
208
219
|
'object-shorthand': [
|
|
209
220
|
2,
|
|
210
221
|
'always',
|
|
@@ -228,14 +239,14 @@ export const flatESLintConfig = [
|
|
|
228
239
|
|
|
229
240
|
...disabledRules,
|
|
230
241
|
},
|
|
231
|
-
} as const satisfies
|
|
242
|
+
} as const satisfies Config,
|
|
232
243
|
|
|
233
244
|
{
|
|
234
245
|
files: ['**/*.cjs'],
|
|
235
246
|
languageOptions: {
|
|
236
247
|
sourceType: 'commonjs',
|
|
237
|
-
} as const satisfies
|
|
238
|
-
name: `${
|
|
248
|
+
} as const satisfies TSESLintFlatConfig.LanguageOptions satisfies Linter.LanguageOptions,
|
|
249
|
+
name: `${packageJson.name}/commonjs-files`,
|
|
239
250
|
rules: {
|
|
240
251
|
'@typescript-eslint/no-require-imports': [
|
|
241
252
|
0,
|
|
@@ -245,7 +256,7 @@ export const flatESLintConfig = [
|
|
|
245
256
|
},
|
|
246
257
|
],
|
|
247
258
|
},
|
|
248
|
-
} as const satisfies
|
|
259
|
+
} as const satisfies Config,
|
|
249
260
|
|
|
250
261
|
prettierConfig,
|
|
251
|
-
] as const satisfies
|
|
262
|
+
] as const satisfies Config[]
|
package/src/utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { defineConfig } from '
|
|
1
|
+
import type { Config } from './external.js'
|
|
2
|
+
import { defineConfig } from './external.js'
|
|
3
3
|
import { flatESLintConfig } from './shareableConfigs.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -88,5 +88,5 @@ import { flatESLintConfig } from './shareableConfigs.js'
|
|
|
88
88
|
*/
|
|
89
89
|
export const createESLintConfig = (
|
|
90
90
|
additionalOverrides: Parameters<typeof defineConfig> = [],
|
|
91
|
-
):
|
|
91
|
+
): Config[] =>
|
|
92
92
|
/* @__PURE__ */ defineConfig(...flatESLintConfig, ...additionalOverrides)
|