@aryaemami59/eslint-config 0.0.5 → 0.0.7
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 +362 -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 +304 -286
- package/dist/index.js.map +1 -1
- package/package.json +30 -21
- package/src/disabledRules.ts +30 -11
- package/src/external.ts +7 -1
- package/src/globalIgnores.ts +14 -13
- package/src/globals.ts +14 -16
- package/src/index.ts +4 -0
- package/src/{packageName.ts → packageJsonName.ts} +3 -1
- package/src/shareableConfigs.ts +197 -193
- 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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AHxCb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACEA;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;AA8BA;;;;;;;;;;;;;;;;;;;cE+Ca,kBAAA,GACX,mBAAA,GAAqB,UAAA,QAAkB,YAAA,MACtC,MAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,297 +1,315 @@
|
|
|
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";
|
|
4
|
+
import { defineConfig } from "eslint/config";
|
|
31
5
|
import { config, configs, parser, plugin } from "typescript-eslint";
|
|
32
6
|
|
|
33
|
-
|
|
34
|
-
|
|
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
|
+
};
|
|
38
|
+
|
|
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/globalIgnores.ts
|
|
49
|
+
/**
|
|
50
|
+
* An object representing
|
|
51
|
+
* {@link https://eslint.org/docs/latest/use/configure/ignore#ignoring-files | **global ignore patterns**}
|
|
52
|
+
* for ESLint configuration.
|
|
53
|
+
*
|
|
54
|
+
* @since 0.0.3
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
const globalIgnores = {
|
|
58
|
+
ignores: [
|
|
59
|
+
"**/__snapshots__/",
|
|
60
|
+
"**/.docusaurus/",
|
|
61
|
+
"**/.expo/",
|
|
62
|
+
"**/.next/",
|
|
63
|
+
"**/.playwright/",
|
|
64
|
+
"**/.temp/",
|
|
65
|
+
"**/.tmp/",
|
|
66
|
+
"**/.turbo/",
|
|
67
|
+
"**/.wrangler/",
|
|
68
|
+
"**/.yalc/",
|
|
69
|
+
"**/.yarn/",
|
|
70
|
+
"**/*.snap",
|
|
71
|
+
"**/build/",
|
|
72
|
+
"**/coverage/",
|
|
73
|
+
"**/dist/",
|
|
74
|
+
"**/temp/"
|
|
75
|
+
],
|
|
76
|
+
name: `${name}/global-ignores`
|
|
55
77
|
};
|
|
56
78
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/globals.ts
|
|
81
|
+
/**
|
|
82
|
+
* An object representing the
|
|
83
|
+
* {@link https://vitest.dev/config/#globals | globals} provided by
|
|
84
|
+
* {@link https://vitest.dev | **Vitest**} for use in testing.
|
|
85
|
+
*
|
|
86
|
+
* @since 0.0.3
|
|
87
|
+
* @public
|
|
88
|
+
*/
|
|
89
|
+
const vitestGlobals = {
|
|
90
|
+
afterAll: "writable",
|
|
91
|
+
afterEach: "writable",
|
|
92
|
+
assert: "writable",
|
|
93
|
+
assertType: "writable",
|
|
94
|
+
beforeAll: "writable",
|
|
95
|
+
beforeEach: "writable",
|
|
96
|
+
chai: "writable",
|
|
97
|
+
describe: "writable",
|
|
98
|
+
expect: "writable",
|
|
99
|
+
expectTypeOf: "writable",
|
|
100
|
+
it: "writable",
|
|
101
|
+
onTestFailed: "writable",
|
|
102
|
+
onTestFinished: "writable",
|
|
103
|
+
suite: "writable",
|
|
104
|
+
test: "writable",
|
|
105
|
+
vi: "writable",
|
|
106
|
+
vitest: "writable"
|
|
78
107
|
};
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
108
|
+
/**
|
|
109
|
+
* An object that specifies which global
|
|
110
|
+
* variables are available during linting.
|
|
111
|
+
*
|
|
112
|
+
* @since 0.0.3
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
const globals = /* @__PURE__ */ Object.assign({
|
|
116
|
+
...browser,
|
|
117
|
+
...node,
|
|
118
|
+
...nodeBuiltin
|
|
119
|
+
}, {
|
|
120
|
+
...vitest,
|
|
121
|
+
...vitestGlobals
|
|
122
|
+
});
|
|
90
123
|
|
|
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
|
-
);
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/shareableConfigs.ts
|
|
126
|
+
/**
|
|
127
|
+
* Flat ESLint configuration tailored for projects using TypeScript.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* <caption>#### __ECMAScript Modules (ESM) usage inside a file like `eslint.config.mts` or `eslint.config.mjs`__</caption>
|
|
131
|
+
*
|
|
132
|
+
* ```ts
|
|
133
|
+
* import { flatESLintConfig } from '@aryaemami59/eslint-config'
|
|
134
|
+
*
|
|
135
|
+
* export default flatESLintConfig
|
|
136
|
+
* ```
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using `require`)__</caption>
|
|
140
|
+
*
|
|
141
|
+
* ```ts
|
|
142
|
+
* const { flatESLintConfig } = require('@aryaemami59/eslint-config')
|
|
143
|
+
*
|
|
144
|
+
* module.exports = flatESLintConfig
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cjs` or `eslint.config.cts` (using dynamic import)__</caption>
|
|
149
|
+
*
|
|
150
|
+
* ```ts
|
|
151
|
+
* module.exports = (async () =>
|
|
152
|
+
* (await import('@aryaemami59/eslint-config')).flatESLintConfig)()
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` (using import and export assignment)__</caption>
|
|
157
|
+
*
|
|
158
|
+
* ```ts
|
|
159
|
+
* import eslintConfigModule = require('@aryaemami59/eslint-config')
|
|
160
|
+
* import flatESLintConfig = eslintConfigModule.flatESLintConfig
|
|
161
|
+
*
|
|
162
|
+
* export = flatESLintConfig
|
|
163
|
+
* ```
|
|
164
|
+
*
|
|
165
|
+
* @since 0.0.3
|
|
166
|
+
* @public
|
|
167
|
+
*/
|
|
168
|
+
const flatESLintConfig = [
|
|
169
|
+
globalIgnores,
|
|
170
|
+
{
|
|
171
|
+
name: `${js.meta.name}/recommended`,
|
|
172
|
+
...js.configs.recommended
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
languageOptions: {
|
|
176
|
+
globals,
|
|
177
|
+
parserOptions: {
|
|
178
|
+
ecmaVersion: "latest",
|
|
179
|
+
projectService: true
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
linterOptions: {
|
|
183
|
+
reportUnusedDisableDirectives: 2,
|
|
184
|
+
reportUnusedInlineConfigs: 2
|
|
185
|
+
},
|
|
186
|
+
name: `${name}/defaults/overrides`,
|
|
187
|
+
rules: {
|
|
188
|
+
"object-shorthand": [
|
|
189
|
+
2,
|
|
190
|
+
"always",
|
|
191
|
+
{
|
|
192
|
+
avoidExplicitReturnArrows: true,
|
|
193
|
+
avoidQuotes: true,
|
|
194
|
+
ignoreConstructors: true,
|
|
195
|
+
methodsIgnorePattern: ""
|
|
196
|
+
}
|
|
197
|
+
],
|
|
198
|
+
"sort-imports": [2, {
|
|
199
|
+
allowSeparatedGroups: true,
|
|
200
|
+
ignoreCase: false,
|
|
201
|
+
ignoreDeclarationSort: true,
|
|
202
|
+
ignoreMemberSort: false,
|
|
203
|
+
memberSyntaxSortOrder: [
|
|
204
|
+
"none",
|
|
205
|
+
"all",
|
|
206
|
+
"multiple",
|
|
207
|
+
"single"
|
|
208
|
+
]
|
|
209
|
+
}],
|
|
210
|
+
...disabledRules
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
files: ["**/*.cjs"],
|
|
215
|
+
languageOptions: { sourceType: "commonjs" },
|
|
216
|
+
name: `${name}/commonjs-files`,
|
|
217
|
+
rules: { "@typescript-eslint/no-require-imports": [0, {
|
|
218
|
+
allow: [],
|
|
219
|
+
allowAsImport: false
|
|
220
|
+
}] }
|
|
221
|
+
},
|
|
222
|
+
prettierConfig
|
|
223
|
+
];
|
|
280
224
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/utils.ts
|
|
227
|
+
/**
|
|
228
|
+
* A function that returns {@linkcode flatESLintConfig}
|
|
229
|
+
* along with optional additional overrides.
|
|
230
|
+
* It's made mainly to provide intellisense and eliminate
|
|
231
|
+
* the need for manual type annotations using JSDoc comments.
|
|
232
|
+
*
|
|
233
|
+
* @param [additionalOverrides=[]] - **Optional** additional overrides to apply to the configuration.
|
|
234
|
+
* @returns An augmented version of the default {@linkcode flatESLintConfig}, incorporating any provided overrides.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* <caption>#### __ECMAScript Modules (ESM) usage inside a file like `eslint.config.mts` or `eslint.config.mjs`__</caption>
|
|
238
|
+
*
|
|
239
|
+
* ```ts
|
|
240
|
+
* import { createESLintConfig } from '@aryaemami59/eslint-config'
|
|
241
|
+
*
|
|
242
|
+
* export default createESLintConfig([
|
|
243
|
+
* {
|
|
244
|
+
* rules: {
|
|
245
|
+
* 'no-console': [0],
|
|
246
|
+
* },
|
|
247
|
+
* },
|
|
248
|
+
* {
|
|
249
|
+
* // ...Other additional overrides
|
|
250
|
+
* },
|
|
251
|
+
* ])
|
|
252
|
+
* ```
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using `require`)__</caption>
|
|
256
|
+
*
|
|
257
|
+
* ```ts
|
|
258
|
+
* const { createESLintConfig } = require('@aryaemami59/eslint-config')
|
|
259
|
+
*
|
|
260
|
+
* module.exports = createESLintConfig([
|
|
261
|
+
* {
|
|
262
|
+
* rules: {
|
|
263
|
+
* 'no-console': [0],
|
|
264
|
+
* },
|
|
265
|
+
* },
|
|
266
|
+
* {
|
|
267
|
+
* // ...Other additional overrides
|
|
268
|
+
* },
|
|
269
|
+
* ])
|
|
270
|
+
* ```
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using dynamic import)__</caption>
|
|
274
|
+
*
|
|
275
|
+
* ```ts
|
|
276
|
+
* module.exports = (async () =>
|
|
277
|
+
* (await import('@aryaemami59/eslint-config')).createESLintConfig([
|
|
278
|
+
* {
|
|
279
|
+
* rules: {
|
|
280
|
+
* 'no-console': [0],
|
|
281
|
+
* },
|
|
282
|
+
* },
|
|
283
|
+
* {
|
|
284
|
+
* // ...Other additional overrides
|
|
285
|
+
* },
|
|
286
|
+
* ]))()
|
|
287
|
+
* ```
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` (using import and export assignment)__</caption>
|
|
291
|
+
*
|
|
292
|
+
* ```ts
|
|
293
|
+
* import eslintConfigModule = require('@aryaemami59/eslint-config')
|
|
294
|
+
* import createESLintConfig = eslintConfigModule.createESLintConfig
|
|
295
|
+
*
|
|
296
|
+
* export = createESLintConfig([
|
|
297
|
+
* {
|
|
298
|
+
* rules: {
|
|
299
|
+
* 'no-console': [0],
|
|
300
|
+
* },
|
|
301
|
+
* },
|
|
302
|
+
* {
|
|
303
|
+
* // ...Other additional overrides
|
|
304
|
+
* },
|
|
305
|
+
* ])
|
|
306
|
+
* ```
|
|
307
|
+
*
|
|
308
|
+
* @since 0.0.3
|
|
309
|
+
* @public
|
|
310
|
+
*/
|
|
311
|
+
const createESLintConfig = (additionalOverrides = []) => /* @__PURE__ */ defineConfig(...flatESLintConfig, ...additionalOverrides);
|
|
312
|
+
|
|
313
|
+
//#endregion
|
|
314
|
+
export { config, configs, createESLintConfig, defineConfig, disabledRules, flatESLintConfig, globalIgnores, globals, js, parser, plugin, prettierConfig, vitestGlobals };
|
|
297
315
|
//# sourceMappingURL=index.js.map
|