@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/disabledRules.ts","../src/globalIgnores.ts","../src/globals.ts","../src/shareableConfigs.ts","../src/utils.ts"],"mappings":";;;;;;;;;;;;;;cASa,aAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAb;cCEa,aAAA;EAAA,SAoBc,OAAA;EAAA,SAAA,IAAA;AAAA;;;;;;;;;;ADtB3B;cEEa,aAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;cA8BA,OAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AHzCb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACEA;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;AA8BA;;;;;;;;;;;;;;;;;;;cE+Ca,kBAAA,GACX,mBAAA,GAAqB,UAAA,QAAkB,YAAA,MACtC,MAAA,CAAO,MAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,297 +1,327 @@
|
|
|
1
|
-
// src/disabledRules.ts
|
|
2
|
-
var disabledRules = {
|
|
3
|
-
"no-undef": [0, { typeof: false }],
|
|
4
|
-
"@typescript-eslint/no-unused-vars": [
|
|
5
|
-
0,
|
|
6
|
-
{
|
|
7
|
-
args: "all",
|
|
8
|
-
argsIgnorePattern: "^_",
|
|
9
|
-
caughtErrors: "all",
|
|
10
|
-
caughtErrorsIgnorePattern: "^_",
|
|
11
|
-
destructuredArrayIgnorePattern: "^_",
|
|
12
|
-
varsIgnorePattern: "^_",
|
|
13
|
-
ignoreRestSiblings: true
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
"@typescript-eslint/ban-ts-comment": [
|
|
17
|
-
0,
|
|
18
|
-
{
|
|
19
|
-
"ts-expect-error": "allow-with-description",
|
|
20
|
-
"ts-ignore": true,
|
|
21
|
-
"ts-nocheck": true,
|
|
22
|
-
"ts-check": false,
|
|
23
|
-
minimumDescriptionLength: 3
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// src/external.ts
|
|
29
1
|
import js from "@eslint/js";
|
|
30
2
|
import prettierConfig from "eslint-config-prettier/flat";
|
|
3
|
+
import globalIdentifiers from "globals";
|
|
31
4
|
import { config, configs, parser, plugin } from "typescript-eslint";
|
|
5
|
+
import { defineConfig } from "eslint/config";
|
|
6
|
+
|
|
7
|
+
//#region src/disabledRules.ts
|
|
8
|
+
/**
|
|
9
|
+
* An object comprised of ESLint rules to disable.
|
|
10
|
+
* These rules are disabled in {@linkcode flatESLintConfig}.
|
|
11
|
+
*
|
|
12
|
+
* @since 0.0.3
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
const disabledRules = {
|
|
16
|
+
"@typescript-eslint/ban-ts-comment": [0, {
|
|
17
|
+
minimumDescriptionLength: 3,
|
|
18
|
+
"ts-check": false,
|
|
19
|
+
"ts-expect-error": "allow-with-description",
|
|
20
|
+
"ts-ignore": true,
|
|
21
|
+
"ts-nocheck": true
|
|
22
|
+
}],
|
|
23
|
+
"@typescript-eslint/consistent-generic-constructors": [0],
|
|
24
|
+
"@typescript-eslint/no-unused-vars": [0, {
|
|
25
|
+
args: "after-used",
|
|
26
|
+
argsIgnorePattern: "^_",
|
|
27
|
+
caughtErrors: "all",
|
|
28
|
+
caughtErrorsIgnorePattern: "^_",
|
|
29
|
+
destructuredArrayIgnorePattern: "^_",
|
|
30
|
+
ignoreClassWithStaticInitBlock: false,
|
|
31
|
+
ignoreRestSiblings: false,
|
|
32
|
+
reportUsedIgnorePattern: false,
|
|
33
|
+
vars: "all",
|
|
34
|
+
varsIgnorePattern: "^_"
|
|
35
|
+
}],
|
|
36
|
+
"no-undef": [0, { typeof: false }]
|
|
37
|
+
};
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/external.ts
|
|
41
|
+
const { browser, node, nodeBuiltin, vitest } = globalIdentifiers;
|
|
35
42
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region package.json
|
|
45
|
+
var name = "@aryaemami59/eslint-config";
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/packageJsonName.ts
|
|
49
|
+
/**
|
|
50
|
+
* This is used because if we import the package name from the
|
|
51
|
+
* `package.json` file, it will be bundled into the final output,
|
|
52
|
+
* which is not desired.
|
|
53
|
+
*
|
|
54
|
+
* @since 0.0.5
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
const packageJsonName = name;
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/globalIgnores.ts
|
|
61
|
+
/**
|
|
62
|
+
* An object representing
|
|
63
|
+
* {@link https://eslint.org/docs/latest/use/configure/ignore#ignoring-files | **global ignore patterns**}
|
|
64
|
+
* for ESLint configuration.
|
|
65
|
+
*
|
|
66
|
+
* @since 0.0.3
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
const globalIgnores = {
|
|
70
|
+
ignores: [
|
|
71
|
+
"**/__snapshots__/",
|
|
72
|
+
"**/.docusaurus/",
|
|
73
|
+
"**/.expo/",
|
|
74
|
+
"**/.next/",
|
|
75
|
+
"**/.playwright/",
|
|
76
|
+
"**/.temp/",
|
|
77
|
+
"**/.tmp/",
|
|
78
|
+
"**/.turbo/",
|
|
79
|
+
"**/.wrangler/",
|
|
80
|
+
"**/.yalc/",
|
|
81
|
+
"**/.yarn/",
|
|
82
|
+
"**/*.snap",
|
|
83
|
+
"**/build/",
|
|
84
|
+
"**/coverage/",
|
|
85
|
+
"**/dist/",
|
|
86
|
+
"**/temp/"
|
|
87
|
+
],
|
|
88
|
+
name: `${packageJsonName}/global-ignores`
|
|
55
89
|
};
|
|
56
90
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/globals.ts
|
|
93
|
+
/**
|
|
94
|
+
* An object representing the
|
|
95
|
+
* {@link https://vitest.dev/config/#globals | globals} provided by
|
|
96
|
+
* {@link https://vitest.dev | **Vitest**} for use in testing.
|
|
97
|
+
*
|
|
98
|
+
* @since 0.0.3
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
const vitestGlobals = {
|
|
102
|
+
afterAll: "writable",
|
|
103
|
+
afterEach: "writable",
|
|
104
|
+
assert: "writable",
|
|
105
|
+
assertType: "writable",
|
|
106
|
+
beforeAll: "writable",
|
|
107
|
+
beforeEach: "writable",
|
|
108
|
+
chai: "writable",
|
|
109
|
+
describe: "writable",
|
|
110
|
+
expect: "writable",
|
|
111
|
+
expectTypeOf: "writable",
|
|
112
|
+
it: "writable",
|
|
113
|
+
onTestFailed: "writable",
|
|
114
|
+
onTestFinished: "writable",
|
|
115
|
+
suite: "writable",
|
|
116
|
+
test: "writable",
|
|
117
|
+
vi: "writable",
|
|
118
|
+
vitest: "writable"
|
|
78
119
|
};
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
120
|
+
/**
|
|
121
|
+
* An object that specifies which global
|
|
122
|
+
* variables are available during linting.
|
|
123
|
+
*
|
|
124
|
+
* @since 0.0.3
|
|
125
|
+
* @public
|
|
126
|
+
*/
|
|
127
|
+
const globals = /* @__PURE__ */ Object.assign({
|
|
128
|
+
...browser,
|
|
129
|
+
...node,
|
|
130
|
+
...nodeBuiltin
|
|
131
|
+
}, {
|
|
132
|
+
...vitest,
|
|
133
|
+
...vitestGlobals
|
|
134
|
+
});
|
|
90
135
|
|
|
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
|
-
"@typescript-eslint/no-confusing-void-expression": [
|
|
194
|
-
2,
|
|
195
|
-
{
|
|
196
|
-
ignoreArrowShorthand: false,
|
|
197
|
-
ignoreVoidOperator: false,
|
|
198
|
-
ignoreVoidReturningFunctions: false
|
|
199
|
-
}
|
|
200
|
-
],
|
|
201
|
-
"@typescript-eslint/no-duplicate-type-constituents": [
|
|
202
|
-
2,
|
|
203
|
-
{
|
|
204
|
-
ignoreIntersections: false,
|
|
205
|
-
ignoreUnions: false
|
|
206
|
-
}
|
|
207
|
-
],
|
|
208
|
-
"@typescript-eslint/require-await": [2],
|
|
209
|
-
"@typescript-eslint/no-redundant-type-constituents": [2],
|
|
210
|
-
"@typescript-eslint/no-unnecessary-type-arguments": [2],
|
|
211
|
-
"@typescript-eslint/no-unnecessary-type-assertion": [
|
|
212
|
-
2,
|
|
213
|
-
{ typesToIgnore: [] }
|
|
214
|
-
],
|
|
215
|
-
"@typescript-eslint/prefer-nullish-coalescing": [
|
|
216
|
-
2,
|
|
217
|
-
{
|
|
218
|
-
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
|
|
219
|
-
ignoreBooleanCoercion: false,
|
|
220
|
-
ignoreConditionalTests: true,
|
|
221
|
-
ignoreIfStatements: false,
|
|
222
|
-
ignoreMixedLogicalExpressions: false,
|
|
223
|
-
ignorePrimitives: {
|
|
224
|
-
bigint: false,
|
|
225
|
-
boolean: false,
|
|
226
|
-
number: false,
|
|
227
|
-
string: false
|
|
228
|
-
},
|
|
229
|
-
ignoreTernaryTests: false
|
|
230
|
-
}
|
|
231
|
-
],
|
|
232
|
-
"@typescript-eslint/no-inferrable-types": [
|
|
233
|
-
2,
|
|
234
|
-
{
|
|
235
|
-
ignoreParameters: false,
|
|
236
|
-
ignoreProperties: false
|
|
237
|
-
}
|
|
238
|
-
],
|
|
239
|
-
"@typescript-eslint/no-require-imports": [
|
|
240
|
-
2,
|
|
241
|
-
{
|
|
242
|
-
allow: [],
|
|
243
|
-
allowAsImport: true
|
|
244
|
-
}
|
|
245
|
-
],
|
|
246
|
-
"object-shorthand": [
|
|
247
|
-
2,
|
|
248
|
-
"always",
|
|
249
|
-
{
|
|
250
|
-
avoidExplicitReturnArrows: true,
|
|
251
|
-
avoidQuotes: true,
|
|
252
|
-
ignoreConstructors: true,
|
|
253
|
-
methodsIgnorePattern: ""
|
|
254
|
-
}
|
|
255
|
-
],
|
|
256
|
-
...disabledRules
|
|
257
|
-
},
|
|
258
|
-
linterOptions: {
|
|
259
|
-
reportUnusedDisableDirectives: 2
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
name: `${packageName}/commonjs-files`,
|
|
264
|
-
files: ["**/*.cjs"],
|
|
265
|
-
languageOptions: {
|
|
266
|
-
sourceType: "commonjs"
|
|
267
|
-
},
|
|
268
|
-
rules: {
|
|
269
|
-
"@typescript-eslint/no-require-imports": [
|
|
270
|
-
0,
|
|
271
|
-
{
|
|
272
|
-
allow: [],
|
|
273
|
-
allowAsImport: false
|
|
274
|
-
}
|
|
275
|
-
]
|
|
276
|
-
}
|
|
277
|
-
},
|
|
278
|
-
prettierConfig
|
|
279
|
-
);
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/shareableConfigs.ts
|
|
138
|
+
/**
|
|
139
|
+
* Flat ESLint configuration tailored for projects using TypeScript.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* <caption>#### __ECMAScript Modules (ESM) usage inside a file like `eslint.config.mts` or `eslint.config.mjs`__</caption>
|
|
143
|
+
*
|
|
144
|
+
* ```ts
|
|
145
|
+
* import { flatESLintConfig } from '@aryaemami59/eslint-config'
|
|
146
|
+
*
|
|
147
|
+
* export default flatESLintConfig
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using `require`)__</caption>
|
|
152
|
+
*
|
|
153
|
+
* ```ts
|
|
154
|
+
* const { flatESLintConfig } = require('@aryaemami59/eslint-config')
|
|
155
|
+
*
|
|
156
|
+
* module.exports = flatESLintConfig
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cjs` or `eslint.config.cts` (using dynamic import)__</caption>
|
|
161
|
+
*
|
|
162
|
+
* ```ts
|
|
163
|
+
* module.exports = (async () =>
|
|
164
|
+
* (await import('@aryaemami59/eslint-config')).flatESLintConfig)()
|
|
165
|
+
* ```
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` (using import and export assignment)__</caption>
|
|
169
|
+
*
|
|
170
|
+
* ```ts
|
|
171
|
+
* import eslintConfigModule = require('@aryaemami59/eslint-config')
|
|
172
|
+
* import flatESLintConfig = eslintConfigModule.flatESLintConfig
|
|
173
|
+
*
|
|
174
|
+
* export = flatESLintConfig
|
|
175
|
+
* ```
|
|
176
|
+
*
|
|
177
|
+
* @since 0.0.3
|
|
178
|
+
* @public
|
|
179
|
+
*/
|
|
180
|
+
const flatESLintConfig = [
|
|
181
|
+
globalIgnores,
|
|
182
|
+
{
|
|
183
|
+
name: `${js.meta.name}/recommended`,
|
|
184
|
+
...js.configs.recommended
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
languageOptions: {
|
|
188
|
+
globals,
|
|
189
|
+
parserOptions: {
|
|
190
|
+
ecmaVersion: "latest",
|
|
191
|
+
projectService: true
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
linterOptions: {
|
|
195
|
+
reportUnusedDisableDirectives: 2,
|
|
196
|
+
reportUnusedInlineConfigs: 2
|
|
197
|
+
},
|
|
198
|
+
name: `${packageJsonName}/defaults/overrides`,
|
|
199
|
+
rules: {
|
|
200
|
+
"object-shorthand": [
|
|
201
|
+
2,
|
|
202
|
+
"always",
|
|
203
|
+
{
|
|
204
|
+
avoidExplicitReturnArrows: true,
|
|
205
|
+
avoidQuotes: true,
|
|
206
|
+
ignoreConstructors: true,
|
|
207
|
+
methodsIgnorePattern: ""
|
|
208
|
+
}
|
|
209
|
+
],
|
|
210
|
+
"sort-imports": [2, {
|
|
211
|
+
allowSeparatedGroups: true,
|
|
212
|
+
ignoreCase: false,
|
|
213
|
+
ignoreDeclarationSort: true,
|
|
214
|
+
ignoreMemberSort: false,
|
|
215
|
+
memberSyntaxSortOrder: [
|
|
216
|
+
"none",
|
|
217
|
+
"all",
|
|
218
|
+
"multiple",
|
|
219
|
+
"single"
|
|
220
|
+
]
|
|
221
|
+
}],
|
|
222
|
+
...disabledRules
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
files: ["**/*.cjs"],
|
|
227
|
+
languageOptions: { sourceType: "commonjs" },
|
|
228
|
+
name: `${packageJsonName}/commonjs-files`,
|
|
229
|
+
rules: { "@typescript-eslint/no-require-imports": [0, {
|
|
230
|
+
allow: [],
|
|
231
|
+
allowAsImport: false
|
|
232
|
+
}] }
|
|
233
|
+
},
|
|
234
|
+
prettierConfig
|
|
235
|
+
];
|
|
280
236
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region src/utils.ts
|
|
239
|
+
/**
|
|
240
|
+
* A function that returns {@linkcode flatESLintConfig}
|
|
241
|
+
* along with optional additional overrides.
|
|
242
|
+
* It's made mainly to provide intellisense and eliminate
|
|
243
|
+
* the need for manual type annotations using JSDoc comments.
|
|
244
|
+
*
|
|
245
|
+
* @param [additionalOverrides=[]] - **Optional** additional overrides to apply to the configuration.
|
|
246
|
+
* @returns An augmented version of the default {@linkcode flatESLintConfig}, incorporating any provided overrides.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* <caption>#### __ECMAScript Modules (ESM) usage inside a file like `eslint.config.mts` or `eslint.config.mjs`__</caption>
|
|
250
|
+
*
|
|
251
|
+
* ```ts
|
|
252
|
+
* import { createESLintConfig } from '@aryaemami59/eslint-config'
|
|
253
|
+
*
|
|
254
|
+
* export default createESLintConfig([
|
|
255
|
+
* {
|
|
256
|
+
* rules: {
|
|
257
|
+
* 'no-console': [0],
|
|
258
|
+
* },
|
|
259
|
+
* },
|
|
260
|
+
* {
|
|
261
|
+
* // ...Other additional overrides
|
|
262
|
+
* },
|
|
263
|
+
* ])
|
|
264
|
+
* ```
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using `require`)__</caption>
|
|
268
|
+
*
|
|
269
|
+
* ```ts
|
|
270
|
+
* const { createESLintConfig } = require('@aryaemami59/eslint-config')
|
|
271
|
+
*
|
|
272
|
+
* module.exports = createESLintConfig([
|
|
273
|
+
* {
|
|
274
|
+
* rules: {
|
|
275
|
+
* 'no-console': [0],
|
|
276
|
+
* },
|
|
277
|
+
* },
|
|
278
|
+
* {
|
|
279
|
+
* // ...Other additional overrides
|
|
280
|
+
* },
|
|
281
|
+
* ])
|
|
282
|
+
* ```
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using dynamic import)__</caption>
|
|
286
|
+
*
|
|
287
|
+
* ```ts
|
|
288
|
+
* module.exports = (async () =>
|
|
289
|
+
* (await import('@aryaemami59/eslint-config')).createESLintConfig([
|
|
290
|
+
* {
|
|
291
|
+
* rules: {
|
|
292
|
+
* 'no-console': [0],
|
|
293
|
+
* },
|
|
294
|
+
* },
|
|
295
|
+
* {
|
|
296
|
+
* // ...Other additional overrides
|
|
297
|
+
* },
|
|
298
|
+
* ]))()
|
|
299
|
+
* ```
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` (using import and export assignment)__</caption>
|
|
303
|
+
*
|
|
304
|
+
* ```ts
|
|
305
|
+
* import eslintConfigModule = require('@aryaemami59/eslint-config')
|
|
306
|
+
* import createESLintConfig = eslintConfigModule.createESLintConfig
|
|
307
|
+
*
|
|
308
|
+
* export = createESLintConfig([
|
|
309
|
+
* {
|
|
310
|
+
* rules: {
|
|
311
|
+
* 'no-console': [0],
|
|
312
|
+
* },
|
|
313
|
+
* },
|
|
314
|
+
* {
|
|
315
|
+
* // ...Other additional overrides
|
|
316
|
+
* },
|
|
317
|
+
* ])
|
|
318
|
+
* ```
|
|
319
|
+
*
|
|
320
|
+
* @since 0.0.3
|
|
321
|
+
* @public
|
|
322
|
+
*/
|
|
323
|
+
const createESLintConfig = (additionalOverrides = []) => /* @__PURE__ */ defineConfig(...flatESLintConfig, ...additionalOverrides);
|
|
324
|
+
|
|
325
|
+
//#endregion
|
|
326
|
+
export { config, configs, createESLintConfig, disabledRules, flatESLintConfig, globalIgnores, globals, js, parser, plugin, prettierConfig, vitestGlobals };
|
|
297
327
|
//# sourceMappingURL=index.js.map
|