@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/dist/index.js
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import js from "@eslint/js";
|
|
2
2
|
import prettierConfig from "eslint-config-prettier/flat";
|
|
3
|
-
import
|
|
4
|
-
import { config, configs, parser, plugin } from "typescript-eslint";
|
|
3
|
+
import globals from "globals";
|
|
5
4
|
import { defineConfig } from "eslint/config";
|
|
5
|
+
import { config as tseslintConfig, configs as tseslintConfigs, parser as tseslintParser, plugin as tseslintPlugin } from "typescript-eslint";
|
|
6
6
|
|
|
7
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
8
|
const disabledRules = {
|
|
16
9
|
"@typescript-eslint/ban-ts-comment": [0, {
|
|
17
10
|
minimumDescriptionLength: 3,
|
|
@@ -20,7 +13,6 @@ const disabledRules = {
|
|
|
20
13
|
"ts-ignore": true,
|
|
21
14
|
"ts-nocheck": true
|
|
22
15
|
}],
|
|
23
|
-
"@typescript-eslint/consistent-generic-constructors": [0],
|
|
24
16
|
"@typescript-eslint/no-unused-vars": [0, {
|
|
25
17
|
args: "after-used",
|
|
26
18
|
argsIgnorePattern: "^_",
|
|
@@ -38,34 +30,14 @@ const disabledRules = {
|
|
|
38
30
|
|
|
39
31
|
//#endregion
|
|
40
32
|
//#region src/external.ts
|
|
41
|
-
const { browser, node, nodeBuiltin, vitest } =
|
|
33
|
+
const { browser: browserGlobals, node: nodeGlobals, nodeBuiltin: nodeBuiltinGlobals, vitest: vitestTestGlobals } = globals;
|
|
42
34
|
|
|
43
35
|
//#endregion
|
|
44
36
|
//#region package.json
|
|
45
37
|
var name = "@aryaemami59/eslint-config";
|
|
46
38
|
|
|
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
39
|
//#endregion
|
|
60
40
|
//#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
41
|
const globalIgnores = {
|
|
70
42
|
ignores: [
|
|
71
43
|
"**/__snapshots__/",
|
|
@@ -85,22 +57,16 @@ const globalIgnores = {
|
|
|
85
57
|
"**/dist/",
|
|
86
58
|
"**/temp/"
|
|
87
59
|
],
|
|
88
|
-
name: `${
|
|
60
|
+
name: `${name}/global-ignores`
|
|
89
61
|
};
|
|
90
62
|
|
|
91
63
|
//#endregion
|
|
92
64
|
//#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
65
|
const vitestGlobals = {
|
|
102
66
|
afterAll: "writable",
|
|
103
67
|
afterEach: "writable",
|
|
68
|
+
aroundAll: "writable",
|
|
69
|
+
aroundEach: "writable",
|
|
104
70
|
assert: "writable",
|
|
105
71
|
assertType: "writable",
|
|
106
72
|
beforeAll: "writable",
|
|
@@ -117,75 +83,29 @@ const vitestGlobals = {
|
|
|
117
83
|
vi: "writable",
|
|
118
84
|
vitest: "writable"
|
|
119
85
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
* @since 0.0.3
|
|
125
|
-
* @public
|
|
126
|
-
*/
|
|
127
|
-
const globals = /* @__PURE__ */ Object.assign({
|
|
128
|
-
...browser,
|
|
129
|
-
...node,
|
|
130
|
-
...nodeBuiltin
|
|
86
|
+
const sharedEnvironmentGlobals = /* @__PURE__ */ Object.assign({
|
|
87
|
+
...browserGlobals,
|
|
88
|
+
...nodeGlobals,
|
|
89
|
+
...nodeBuiltinGlobals
|
|
131
90
|
}, {
|
|
132
|
-
...
|
|
91
|
+
...vitestTestGlobals,
|
|
133
92
|
...vitestGlobals
|
|
134
93
|
});
|
|
135
94
|
|
|
136
95
|
//#endregion
|
|
137
96
|
//#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
97
|
const flatESLintConfig = [
|
|
181
98
|
globalIgnores,
|
|
182
99
|
{
|
|
183
100
|
name: `${js.meta.name}/recommended`,
|
|
184
101
|
...js.configs.recommended
|
|
185
102
|
},
|
|
103
|
+
...tseslintConfigs.recommended,
|
|
104
|
+
...tseslintConfigs.stylistic,
|
|
186
105
|
{
|
|
187
106
|
languageOptions: {
|
|
188
|
-
globals,
|
|
107
|
+
globals: sharedEnvironmentGlobals,
|
|
108
|
+
parser: tseslintParser,
|
|
189
109
|
parserOptions: {
|
|
190
110
|
ecmaVersion: "latest",
|
|
191
111
|
projectService: true
|
|
@@ -195,8 +115,87 @@ const flatESLintConfig = [
|
|
|
195
115
|
reportUnusedDisableDirectives: 2,
|
|
196
116
|
reportUnusedInlineConfigs: 2
|
|
197
117
|
},
|
|
198
|
-
name: `${
|
|
118
|
+
name: `${name}/defaults/overrides`,
|
|
119
|
+
plugins: { "@typescript-eslint": tseslintPlugin },
|
|
199
120
|
rules: {
|
|
121
|
+
"@typescript-eslint/consistent-type-definitions": [2, "type"],
|
|
122
|
+
"@typescript-eslint/consistent-type-exports": [2, { fixMixedExportsWithInlineTypeSpecifier: false }],
|
|
123
|
+
"@typescript-eslint/consistent-type-imports": [2, {
|
|
124
|
+
disallowTypeAnnotations: true,
|
|
125
|
+
fixStyle: "separate-type-imports",
|
|
126
|
+
prefer: "type-imports"
|
|
127
|
+
}],
|
|
128
|
+
"@typescript-eslint/no-confusing-void-expression": [2, {
|
|
129
|
+
ignoreArrowShorthand: false,
|
|
130
|
+
ignoreVoidOperator: false,
|
|
131
|
+
ignoreVoidReturningFunctions: false
|
|
132
|
+
}],
|
|
133
|
+
"@typescript-eslint/no-duplicate-type-constituents": [2, {
|
|
134
|
+
ignoreIntersections: false,
|
|
135
|
+
ignoreUnions: false
|
|
136
|
+
}],
|
|
137
|
+
"@typescript-eslint/no-empty-object-type": [2, {
|
|
138
|
+
allowInterfaces: "never",
|
|
139
|
+
allowObjectTypes: "never"
|
|
140
|
+
}],
|
|
141
|
+
"@typescript-eslint/no-explicit-any": [2, {
|
|
142
|
+
fixToUnknown: false,
|
|
143
|
+
ignoreRestArgs: false
|
|
144
|
+
}],
|
|
145
|
+
"@typescript-eslint/no-inferrable-types": [2, {
|
|
146
|
+
ignoreParameters: false,
|
|
147
|
+
ignoreProperties: false
|
|
148
|
+
}],
|
|
149
|
+
"@typescript-eslint/no-invalid-void-type": [2, {
|
|
150
|
+
allowAsThisParameter: false,
|
|
151
|
+
allowInGenericTypeArguments: true
|
|
152
|
+
}],
|
|
153
|
+
"@typescript-eslint/no-namespace": [2, {
|
|
154
|
+
allowDeclarations: false,
|
|
155
|
+
allowDefinitionFiles: true
|
|
156
|
+
}],
|
|
157
|
+
"@typescript-eslint/no-redundant-type-constituents": [2],
|
|
158
|
+
"@typescript-eslint/no-require-imports": [2, {
|
|
159
|
+
allow: [],
|
|
160
|
+
allowAsImport: true
|
|
161
|
+
}],
|
|
162
|
+
"@typescript-eslint/no-restricted-types": [2, { types: { "{}": {
|
|
163
|
+
message: `
|
|
164
|
+
- If you want to represent an empty object, use \`type EmptyObject = Record<string, never>\`.
|
|
165
|
+
- If you want to represent an object literal, use either \`type AnyObject = Record<string, any>\` or \`object\`.
|
|
166
|
+
- If you want to represent any non-nullish value, use \`type AnyNonNullishValue = NonNullable<unknown>\`.`,
|
|
167
|
+
suggest: [
|
|
168
|
+
"AnyNonNullishValue",
|
|
169
|
+
"EmptyObject",
|
|
170
|
+
"AnyObject",
|
|
171
|
+
"object",
|
|
172
|
+
"Record<string, never>",
|
|
173
|
+
"Record<string, any>",
|
|
174
|
+
"NonNullable<unknown>"
|
|
175
|
+
]
|
|
176
|
+
} } }],
|
|
177
|
+
"@typescript-eslint/no-unnecessary-type-arguments": [2],
|
|
178
|
+
"@typescript-eslint/no-unnecessary-type-assertion": [2, { typesToIgnore: [] }],
|
|
179
|
+
"@typescript-eslint/no-unnecessary-type-parameters": [2],
|
|
180
|
+
"@typescript-eslint/prefer-nullish-coalescing": [2, {
|
|
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
|
+
"@typescript-eslint/require-await": [2],
|
|
195
|
+
"@typescript-eslint/unified-signatures": [2, {
|
|
196
|
+
ignoreDifferentlyNamedParameters: false,
|
|
197
|
+
ignoreOverloadsWithDifferentJSDoc: false
|
|
198
|
+
}],
|
|
200
199
|
"object-shorthand": [
|
|
201
200
|
2,
|
|
202
201
|
"always",
|
|
@@ -225,7 +224,7 @@ const flatESLintConfig = [
|
|
|
225
224
|
{
|
|
226
225
|
files: ["**/*.cjs"],
|
|
227
226
|
languageOptions: { sourceType: "commonjs" },
|
|
228
|
-
name: `${
|
|
227
|
+
name: `${name}/commonjs-files`,
|
|
229
228
|
rules: { "@typescript-eslint/no-require-imports": [0, {
|
|
230
229
|
allow: [],
|
|
231
230
|
allowAsImport: false
|
|
@@ -236,92 +235,8 @@ const flatESLintConfig = [
|
|
|
236
235
|
|
|
237
236
|
//#endregion
|
|
238
237
|
//#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
238
|
const createESLintConfig = (additionalOverrides = []) => /* @__PURE__ */ defineConfig(...flatESLintConfig, ...additionalOverrides);
|
|
324
239
|
|
|
325
240
|
//#endregion
|
|
326
|
-
export {
|
|
241
|
+
export { createESLintConfig, defineConfig, disabledRules, flatESLintConfig, globalIgnores, js, prettierConfig, sharedEnvironmentGlobals, tseslintConfig, tseslintConfigs, tseslintParser, tseslintPlugin, vitestGlobals };
|
|
327
242
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["packageJson.name"],"sources":["../src/disabledRules.ts","../src/external.ts","../package.json","../src/packageJsonName.ts","../src/globalIgnores.ts","../src/globals.ts","../src/shareableConfigs.ts","../src/utils.ts"],"sourcesContent":["import type { Linter } from 'eslint'\n\n/**\n * An object comprised of ESLint rules to disable.\n * These rules are disabled in {@linkcode flatESLintConfig}.\n *\n * @since 0.0.3\n * @public\n */\nexport const disabledRules = {\n '@typescript-eslint/ban-ts-comment': [\n 0,\n {\n minimumDescriptionLength: 3,\n 'ts-check': false,\n 'ts-expect-error': 'allow-with-description',\n 'ts-ignore': true,\n 'ts-nocheck': true,\n },\n ],\n\n // TODO: Remove this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.\n '@typescript-eslint/consistent-generic-constructors': [0],\n\n '@typescript-eslint/no-unused-vars': [\n 0,\n {\n args: 'after-used',\n // Not included in default options\n argsIgnorePattern: '^_',\n caughtErrors: 'all',\n // Not included in default options\n caughtErrorsIgnorePattern: '^_',\n // Not included in default options\n destructuredArrayIgnorePattern: '^_',\n ignoreClassWithStaticInitBlock: false,\n ignoreRestSiblings: false,\n reportUsedIgnorePattern: false,\n vars: 'all',\n // Not included in default options\n varsIgnorePattern: '^_',\n },\n ],\n 'no-undef': [\n 0,\n {\n typeof: false,\n },\n ],\n} as const satisfies Linter.RulesRecord satisfies Record<\n keyof Linter.RulesRecord,\n [\n ruleSeverity: Extract<Linter.Severity, 0>,\n ...ruleOptions: readonly unknown[],\n ]\n>\n","import js from '@eslint/js'\nimport prettierConfig from 'eslint-config-prettier/flat'\nimport globalIdentifiers from 'globals'\nexport { config, configs, parser, plugin } from 'typescript-eslint'\nexport type {\n Config,\n ConfigArray,\n ConfigWithExtends,\n FlatConfig,\n InfiniteDepthConfigWithExtends,\n} from 'typescript-eslint'\nexport { js, prettierConfig }\nexport const { browser, node, nodeBuiltin, vitest } = globalIdentifiers\n","","import packageJson from '../package.json' with { type: 'json' }\n\n/**\n * This is used because if we import the package name from the\n * `package.json` file, it will be bundled into the final output,\n * which is not desired.\n *\n * @since 0.0.5\n * @internal\n */\nexport const packageJsonName = packageJson.name\n","import type { Config } from 'eslint/config'\nimport { packageJsonName } from './packageJsonName.js'\n\n/**\n * An object representing\n * {@link https://eslint.org/docs/latest/use/configure/ignore#ignoring-files | **global ignore patterns**}\n * for ESLint configuration.\n *\n * @since 0.0.3\n * @public\n */\nexport const globalIgnores = {\n ignores: [\n '**/__snapshots__/',\n '**/.docusaurus/',\n '**/.expo/',\n '**/.next/',\n '**/.playwright/',\n '**/.temp/',\n '**/.tmp/',\n '**/.turbo/',\n '**/.wrangler/',\n '**/.yalc/',\n '**/.yarn/',\n '**/*.snap',\n '**/build/',\n '**/coverage/',\n '**/dist/',\n '**/temp/',\n ],\n name: `${packageJsonName}/global-ignores`,\n} as const satisfies Config\n","import type { Linter } from 'eslint'\nimport { browser, node, nodeBuiltin, vitest } from './external.js'\n\n/**\n * An object representing the\n * {@link https://vitest.dev/config/#globals | globals} provided by\n * {@link https://vitest.dev | **Vitest**} for use in testing.\n *\n * @since 0.0.3\n * @public\n */\nexport const vitestGlobals = {\n afterAll: 'writable',\n afterEach: 'writable',\n assert: 'writable',\n assertType: 'writable',\n beforeAll: 'writable',\n beforeEach: 'writable',\n chai: 'writable',\n describe: 'writable',\n expect: 'writable',\n expectTypeOf: 'writable',\n it: 'writable',\n onTestFailed: 'writable',\n onTestFinished: 'writable',\n suite: 'writable',\n test: 'writable',\n vi: 'writable',\n vitest: 'writable',\n} as const satisfies Linter.Globals satisfies Record<\n keyof typeof vitest,\n Extract<Linter.GlobalConf, 'writable'>\n>\n\n/**\n * An object that specifies which global\n * variables are available during linting.\n *\n * @since 0.0.3\n * @public\n */\nexport const globals =\n /* @__PURE__ */\n Object.assign(\n {\n ...browser,\n ...node,\n ...nodeBuiltin,\n } as const satisfies Linter.Globals,\n\n {\n ...vitest,\n ...vitestGlobals,\n } as const satisfies Linter.Globals,\n ) satisfies Linter.Globals\n","import type { Linter } from 'eslint'\nimport { disabledRules } from './disabledRules.js'\nimport type { FlatConfig } from './external.js'\nimport { js, prettierConfig } from './external.js'\nimport { globalIgnores } from './globalIgnores.js'\nimport { globals } from './globals.js'\nimport { packageJsonName } from './packageJsonName.js'\n\n/**\n * Flat ESLint configuration tailored for projects using TypeScript.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `eslint.config.mts` or `eslint.config.mjs`__</caption>\n *\n * ```ts\n * import { flatESLintConfig } from '@aryaemami59/eslint-config'\n *\n * export default flatESLintConfig\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { flatESLintConfig } = require('@aryaemami59/eslint-config')\n *\n * module.exports = flatESLintConfig\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cjs` or `eslint.config.cts` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/eslint-config')).flatESLintConfig)()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import eslintConfigModule = require('@aryaemami59/eslint-config')\n * import flatESLintConfig = eslintConfigModule.flatESLintConfig\n *\n * export = flatESLintConfig\n * ```\n *\n * @since 0.0.3\n * @public\n */\nexport const flatESLintConfig = [\n // `ignores` must be first.\n // config with just `ignores` is the replacement for `.eslintignore`\n globalIgnores,\n\n {\n name: `${js.meta.name}/recommended`,\n ...js.configs.recommended,\n } as const satisfies FlatConfig.Config satisfies Linter.Config,\n\n // TODO: You can remove the type assertion in the next major version of `typescript-eslint`.\n // TODO: Uncomment this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.\n // ...(configs.recommended satisfies Linter.Config[] as Linter.Config<any>[]),\n // TODO: You can remove the type assertion in the next major version of `typescript-eslint`.\n // TODO: Uncomment this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.\n // ...(configs.stylistic satisfies Linter.Config[] as Linter.Config<any>[]),\n\n {\n languageOptions: {\n globals,\n parserOptions: {\n ecmaVersion: 'latest',\n projectService: true,\n } as const satisfies FlatConfig.ParserOptions satisfies Linter.ParserOptions,\n },\n linterOptions: {\n reportUnusedDisableDirectives: 2,\n reportUnusedInlineConfigs: 2,\n },\n name: `${packageJsonName}/defaults/overrides`,\n\n rules: {\n // TODO: Uncomment this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.\n // '@typescript-eslint/consistent-type-definitions': [2, 'type'],\n // '@typescript-eslint/consistent-type-exports': [\n // 2,\n // { fixMixedExportsWithInlineTypeSpecifier: false },\n // ],\n // '@typescript-eslint/consistent-type-imports': [\n // 2,\n // {\n // disallowTypeAnnotations: true,\n // fixStyle: 'separate-type-imports',\n // prefer: 'type-imports',\n // },\n // ],\n // '@typescript-eslint/no-confusing-void-expression': [\n // 2,\n // {\n // ignoreArrowShorthand: false,\n // ignoreVoidOperator: false,\n // ignoreVoidReturningFunctions: false,\n // },\n // ],\n // '@typescript-eslint/no-duplicate-type-constituents': [\n // 2,\n // {\n // ignoreIntersections: false,\n // ignoreUnions: false,\n // },\n // ],\n // '@typescript-eslint/no-empty-object-type': [\n // 2,\n // {\n // allowInterfaces: 'never',\n // allowObjectTypes: 'never',\n // },\n // ],\n // '@typescript-eslint/no-explicit-any': [\n // 2,\n // {\n // fixToUnknown: false,\n // ignoreRestArgs: false,\n // },\n // ],\n // '@typescript-eslint/no-inferrable-types': [\n // 2,\n // {\n // ignoreParameters: false,\n // ignoreProperties: false,\n // },\n // ],\n // '@typescript-eslint/no-invalid-void-type': [\n // 2,\n // {\n // allowAsThisParameter: false,\n // allowInGenericTypeArguments: true,\n // },\n // ],\n // '@typescript-eslint/no-namespace': [\n // 2,\n // {\n // allowDeclarations: false,\n // allowDefinitionFiles: true,\n // },\n // ],\n // '@typescript-eslint/no-redundant-type-constituents': [2],\n // '@typescript-eslint/no-require-imports': [\n // 2,\n // {\n // allow: [],\n // allowAsImport: true,\n // },\n // ],\n // '@typescript-eslint/no-restricted-types': [\n // 2,\n // {\n // types: {\n // '{}': {\n // message: `\n // - If you want to represent an empty object, use \\`type EmptyObject = Record<string, never>\\`.\n // - If you want to represent an object literal, use either \\`type AnyObject = Record<string, any>\\` or \\`object\\`.\n // - If you want to represent any non-nullish value, use \\`type AnyNonNullishValue = NonNullable<unknown>\\`.`,\n // suggest: [\n // 'AnyNonNullishValue',\n // 'EmptyObject',\n // 'AnyObject',\n // 'object',\n // 'Record<string, never>',\n // 'Record<string, any>',\n // 'NonNullable<unknown>',\n // ],\n // },\n // },\n // },\n // ],\n // '@typescript-eslint/no-unnecessary-type-arguments': [2],\n // '@typescript-eslint/no-unnecessary-type-assertion': [\n // 2,\n // { typesToIgnore: [] },\n // ],\n // '@typescript-eslint/no-unnecessary-type-parameters': [2],\n // '@typescript-eslint/prefer-nullish-coalescing': [\n // 2,\n // {\n // allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,\n // ignoreBooleanCoercion: false,\n // ignoreConditionalTests: true,\n // ignoreIfStatements: false,\n // ignoreMixedLogicalExpressions: false,\n // ignorePrimitives: {\n // bigint: false,\n // boolean: false,\n // number: false,\n // string: false,\n // },\n // ignoreTernaryTests: false,\n // },\n // ],\n // '@typescript-eslint/require-await': [2],\n // '@typescript-eslint/unified-signatures': [\n // 2,\n // {\n // ignoreDifferentlyNamedParameters: false,\n // ignoreOverloadsWithDifferentJSDoc: false,\n // },\n // ],\n 'object-shorthand': [\n 2,\n 'always',\n {\n avoidExplicitReturnArrows: true,\n avoidQuotes: true,\n ignoreConstructors: true,\n methodsIgnorePattern: '',\n },\n ],\n 'sort-imports': [\n 2,\n {\n allowSeparatedGroups: true,\n ignoreCase: false,\n ignoreDeclarationSort: true,\n ignoreMemberSort: false,\n memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],\n },\n ],\n\n ...disabledRules,\n },\n } as const satisfies Linter.Config,\n\n {\n files: ['**/*.cjs'],\n languageOptions: {\n sourceType: 'commonjs',\n } as const satisfies FlatConfig.LanguageOptions satisfies Linter.LanguageOptions,\n name: `${packageJsonName}/commonjs-files`,\n rules: {\n '@typescript-eslint/no-require-imports': [\n 0,\n {\n allow: [],\n allowAsImport: false,\n },\n ],\n },\n } as const satisfies Linter.Config,\n\n prettierConfig,\n] as const satisfies Linter.Config[]\n","import type { Linter } from 'eslint'\nimport { defineConfig } from 'eslint/config'\nimport { flatESLintConfig } from './shareableConfigs.js'\n\n/**\n * A function that returns {@linkcode flatESLintConfig}\n * along with optional additional overrides.\n * It's made mainly to provide intellisense and eliminate\n * the need for manual type annotations using JSDoc comments.\n *\n * @param [additionalOverrides=[]] - **Optional** additional overrides to apply to the configuration.\n * @returns An augmented version of the default {@linkcode flatESLintConfig}, incorporating any provided overrides.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `eslint.config.mts` or `eslint.config.mjs`__</caption>\n *\n * ```ts\n * import { createESLintConfig } from '@aryaemami59/eslint-config'\n *\n * export default createESLintConfig([\n * {\n * rules: {\n * 'no-console': [0],\n * },\n * },\n * {\n * // ...Other additional overrides\n * },\n * ])\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { createESLintConfig } = require('@aryaemami59/eslint-config')\n *\n * module.exports = createESLintConfig([\n * {\n * rules: {\n * 'no-console': [0],\n * },\n * },\n * {\n * // ...Other additional overrides\n * },\n * ])\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/eslint-config')).createESLintConfig([\n * {\n * rules: {\n * 'no-console': [0],\n * },\n * },\n * {\n * // ...Other additional overrides\n * },\n * ]))()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import eslintConfigModule = require('@aryaemami59/eslint-config')\n * import createESLintConfig = eslintConfigModule.createESLintConfig\n *\n * export = createESLintConfig([\n * {\n * rules: {\n * 'no-console': [0],\n * },\n * },\n * {\n * // ...Other additional overrides\n * },\n * ])\n * ```\n *\n * @since 0.0.3\n * @public\n */\nexport const createESLintConfig = (\n additionalOverrides: Parameters<typeof defineConfig> = [],\n): Linter.Config[] =>\n /* @__PURE__ */ defineConfig(...flatESLintConfig, ...additionalOverrides)\n"],"mappings":";;;;;;;;;;;;;;AASA,MAAa,gBAAgB;CAC3B,qCAAqC,CACnC,GACA;EACE,0BAA0B;EAC1B,YAAY;EACZ,mBAAmB;EACnB,aAAa;EACb,cAAc;EACf,CACF;CAGD,sDAAsD,CAAC,EAAE;CAEzD,qCAAqC,CACnC,GACA;EACE,MAAM;EAEN,mBAAmB;EACnB,cAAc;EAEd,2BAA2B;EAE3B,gCAAgC;EAChC,gCAAgC;EAChC,oBAAoB;EACpB,yBAAyB;EACzB,MAAM;EAEN,mBAAmB;EACpB,CACF;CACD,YAAY,CACV,GACA,EACE,QAAQ,OACT,CACF;CACF;;;;ACrCD,MAAa,EAAE,SAAS,MAAM,aAAa,WAAW;;;;;;;;;;;;;;;;AEFtD,MAAa,kBAAkBA;;;;;;;;;;;;ACC/B,MAAa,gBAAgB;CAC3B,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;CACD,MAAM,GAAG,gBAAgB;CAC1B;;;;;;;;;;;;ACpBD,MAAa,gBAAgB;CAC3B,UAAU;CACV,WAAW;CACX,QAAQ;CACR,YAAY;CACZ,WAAW;CACX,YAAY;CACZ,MAAM;CACN,UAAU;CACV,QAAQ;CACR,cAAc;CACd,IAAI;CACJ,cAAc;CACd,gBAAgB;CAChB,OAAO;CACP,MAAM;CACN,IAAI;CACJ,QAAQ;CACT;;;;;;;;AAYD,MAAa,UAEX,uBAAO,OACL;CACE,GAAG;CACH,GAAG;CACH,GAAG;CACJ,EAED;CACE,GAAG;CACH,GAAG;CACJ,CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACJH,MAAa,mBAAmB;CAG9B;CAEA;EACE,MAAM,GAAG,GAAG,KAAK,KAAK;EACtB,GAAG,GAAG,QAAQ;EACf;CASD;EACE,iBAAiB;GACf;GACA,eAAe;IACb,aAAa;IACb,gBAAgB;IACjB;GACF;EACD,eAAe;GACb,+BAA+B;GAC/B,2BAA2B;GAC5B;EACD,MAAM,GAAG,gBAAgB;EAEzB,OAAO;GA8HL,oBAAoB;IAClB;IACA;IACA;KACE,2BAA2B;KAC3B,aAAa;KACb,oBAAoB;KACpB,sBAAsB;KACvB;IACF;GACD,gBAAgB,CACd,GACA;IACE,sBAAsB;IACtB,YAAY;IACZ,uBAAuB;IACvB,kBAAkB;IAClB,uBAAuB;KAAC;KAAQ;KAAO;KAAY;KAAS;IAC7D,CACF;GAED,GAAG;GACJ;EACF;CAED;EACE,OAAO,CAAC,WAAW;EACnB,iBAAiB,EACf,YAAY,YACb;EACD,MAAM,GAAG,gBAAgB;EACzB,OAAO,EACL,yCAAyC,CACvC,GACA;GACE,OAAO,EAAE;GACT,eAAe;GAChB,CACF,EACF;EACF;CAED;CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AClKD,MAAa,sBACX,sBAAuD,EAAE,KAEzC,6BAAa,GAAG,kBAAkB,GAAG,oBAAoB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["packageJson.name","packageJson.name"],"sources":["../src/disabledRules.ts","../src/external.ts","../package.json","../src/globalIgnores.ts","../src/globals.ts","../src/shareableConfigs.ts","../src/utils.ts"],"sourcesContent":["import type { Linter } from './external.js'\n\n/**\n * An object comprised of ESLint rules to disable.\n * These rules are disabled in {@linkcode flatESLintConfig}.\n *\n * @since 0.0.3\n * @public\n */\nexport const disabledRules = {\n '@typescript-eslint/ban-ts-comment': [\n 0,\n {\n minimumDescriptionLength: 3,\n 'ts-check': false,\n 'ts-expect-error': 'allow-with-description',\n 'ts-ignore': true,\n 'ts-nocheck': true,\n },\n ],\n\n // TODO: Remove this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.\n // '@typescript-eslint/consistent-generic-constructors': [0],\n\n '@typescript-eslint/no-unused-vars': [\n 0,\n {\n args: 'after-used',\n // Not included in default options\n argsIgnorePattern: '^_',\n caughtErrors: 'all',\n // Not included in default options\n caughtErrorsIgnorePattern: '^_',\n // Not included in default options\n destructuredArrayIgnorePattern: '^_',\n ignoreClassWithStaticInitBlock: false,\n ignoreRestSiblings: false,\n reportUsedIgnorePattern: false,\n vars: 'all',\n // Not included in default options\n varsIgnorePattern: '^_',\n },\n ],\n 'no-undef': [\n 0,\n {\n typeof: false,\n },\n ],\n} as const satisfies Linter.RulesRecord satisfies Record<\n keyof Linter.RulesRecord,\n [\n ruleSeverity: Extract<Linter.Severity, 0>,\n ...ruleOptions: readonly unknown[],\n ]\n>\n","import js from '@eslint/js'\nimport prettierConfig from 'eslint-config-prettier/flat'\nimport globals from 'globals'\nexport type { ESLint, Linter } from 'eslint'\nexport { defineConfig } from 'eslint/config'\nexport type { Config } from 'eslint/config'\nexport {\n config as tseslintConfig,\n configs as tseslintConfigs,\n parser as tseslintParser,\n plugin as tseslintPlugin,\n} from 'typescript-eslint'\nexport type {\n Config as TSESLintConfig,\n ConfigArray as TSESLintConfigArray,\n ConfigWithExtends as TSESLintConfigWithExtends,\n FlatConfig as TSESLintFlatConfig,\n InfiniteDepthConfigWithExtends as TSESLintInfiniteDepthConfigWithExtends,\n} from 'typescript-eslint'\nexport { js, prettierConfig }\nexport const {\n browser: browserGlobals,\n node: nodeGlobals,\n nodeBuiltin: nodeBuiltinGlobals,\n vitest: vitestTestGlobals,\n} = globals\nexport type GlobalsBrowser = typeof browserGlobals\nexport type GlobalsNode = typeof nodeGlobals\nexport type GlobalsNodeBuiltin = typeof nodeBuiltinGlobals\nexport type GlobalsVitest = typeof vitestTestGlobals\n","","import packageJson from '@aryaemami59/eslint-config/package.json' with { type: 'json' }\nimport type { Config } from './external.js'\n\n/**\n * An object representing\n * {@link https://eslint.org/docs/latest/use/configure/ignore#ignoring-files | **global ignore patterns**}\n * for ESLint configuration.\n *\n * @since 0.0.3\n * @public\n */\nexport const globalIgnores = {\n ignores: [\n '**/__snapshots__/',\n '**/.docusaurus/',\n '**/.expo/',\n '**/.next/',\n '**/.playwright/',\n '**/.temp/',\n '**/.tmp/',\n '**/.turbo/',\n '**/.wrangler/',\n '**/.yalc/',\n '**/.yarn/',\n '**/*.snap',\n '**/build/',\n '**/coverage/',\n '**/dist/',\n '**/temp/',\n ],\n name: `${packageJson.name}/global-ignores`,\n} as const satisfies Config\n","import type { GlobalsVitest, Linter } from './external.js'\nimport {\n browserGlobals,\n nodeBuiltinGlobals,\n nodeGlobals,\n vitestTestGlobals,\n} from './external.js'\n\n/**\n * An object representing the\n * {@link https://vitest.dev/config/#globals | globals} provided by\n * {@link https://vitest.dev | **Vitest**} for use in testing.\n *\n * @since 0.0.3\n * @public\n */\nexport const vitestGlobals = {\n afterAll: 'writable',\n afterEach: 'writable',\n aroundAll: 'writable',\n aroundEach: 'writable',\n assert: 'writable',\n assertType: 'writable',\n beforeAll: 'writable',\n beforeEach: 'writable',\n chai: 'writable',\n describe: 'writable',\n expect: 'writable',\n expectTypeOf: 'writable',\n it: 'writable',\n onTestFailed: 'writable',\n onTestFinished: 'writable',\n suite: 'writable',\n test: 'writable',\n vi: 'writable',\n vitest: 'writable',\n} as const satisfies Linter.Globals satisfies Record<\n 'aroundAll' | 'aroundEach' | keyof GlobalsVitest,\n Extract<Linter.GlobalConf, 'writable'>\n>\n\n/**\n * An object that specifies which global\n * variables are available during linting.\n *\n * @since 0.0.3\n * @public\n */\nexport const sharedEnvironmentGlobals =\n /* @__PURE__ */\n Object.assign(\n {\n ...browserGlobals,\n ...nodeGlobals,\n ...nodeBuiltinGlobals,\n } as const satisfies Linter.Globals,\n\n {\n ...vitestTestGlobals,\n ...vitestGlobals,\n } as const satisfies Linter.Globals,\n ) satisfies Linter.Globals\n","import packageJson from '@aryaemami59/eslint-config/package.json' with { type: 'json' }\nimport { disabledRules } from './disabledRules.js'\nimport type { Config, ESLint, Linter, TSESLintFlatConfig } from './external.js'\nimport {\n js,\n prettierConfig,\n tseslintConfigs,\n tseslintParser,\n tseslintPlugin,\n} from './external.js'\nimport { globalIgnores } from './globalIgnores.js'\nimport { sharedEnvironmentGlobals } from './globals.js'\n\n/**\n * Flat ESLint configuration tailored for projects using TypeScript.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `eslint.config.mts` or `eslint.config.mjs`__</caption>\n *\n * ```ts\n * import { flatESLintConfig } from '@aryaemami59/eslint-config'\n *\n * export default flatESLintConfig\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { flatESLintConfig } = require('@aryaemami59/eslint-config')\n *\n * module.exports = flatESLintConfig\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cjs` or `eslint.config.cts` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/eslint-config')).flatESLintConfig)()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import eslintConfigModule = require('@aryaemami59/eslint-config')\n * import flatESLintConfig = eslintConfigModule.flatESLintConfig\n *\n * export = flatESLintConfig\n * ```\n *\n * @since 0.0.3\n * @public\n */\nexport const flatESLintConfig = [\n // `ignores` must be first.\n // config with just `ignores` is the replacement for `.eslintignore`\n globalIgnores,\n\n {\n name: `${js.meta.name}/recommended`,\n ...js.configs.recommended,\n } as const satisfies TSESLintFlatConfig.Config satisfies Config,\n\n // TODO: You can remove the type assertion in the next major version of `typescript-eslint`.\n // TODO: Uncomment this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.\n ...(tseslintConfigs.recommended satisfies TSESLintFlatConfig.Config[] satisfies Config[] as Config[]),\n // TODO: You can remove the type assertion in the next major version of `typescript-eslint`.\n // TODO: Uncomment this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.\n ...(tseslintConfigs.stylistic satisfies TSESLintFlatConfig.Config[] satisfies Config[] as Config[]),\n\n {\n languageOptions: {\n globals: sharedEnvironmentGlobals,\n parser:\n tseslintParser satisfies TSESLintFlatConfig.Parser satisfies Linter.Parser as Linter.Parser,\n parserOptions: {\n ecmaVersion: 'latest',\n projectService: true,\n } as const satisfies TSESLintFlatConfig.ParserOptions satisfies Linter.ParserOptions,\n } as const satisfies TSESLintFlatConfig.LanguageOptions satisfies Linter.LanguageOptions,\n linterOptions: {\n reportUnusedDisableDirectives: 2,\n reportUnusedInlineConfigs: 2,\n },\n name: `${packageJson.name}/defaults/overrides`,\n plugins: {\n '@typescript-eslint':\n tseslintPlugin satisfies TSESLintFlatConfig.Plugin satisfies ESLint.Plugin as ESLint.Plugin,\n },\n\n rules: {\n // TODO: Uncomment this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.\n '@typescript-eslint/consistent-type-definitions': [2, 'type'],\n '@typescript-eslint/consistent-type-exports': [\n 2,\n { fixMixedExportsWithInlineTypeSpecifier: false },\n ],\n '@typescript-eslint/consistent-type-imports': [\n 2,\n {\n disallowTypeAnnotations: true,\n fixStyle: 'separate-type-imports',\n prefer: 'type-imports',\n },\n ],\n '@typescript-eslint/no-confusing-void-expression': [\n 2,\n {\n ignoreArrowShorthand: false,\n ignoreVoidOperator: false,\n ignoreVoidReturningFunctions: false,\n },\n ],\n '@typescript-eslint/no-duplicate-type-constituents': [\n 2,\n {\n ignoreIntersections: false,\n ignoreUnions: false,\n },\n ],\n '@typescript-eslint/no-empty-object-type': [\n 2,\n {\n allowInterfaces: 'never',\n allowObjectTypes: 'never',\n },\n ],\n '@typescript-eslint/no-explicit-any': [\n 2,\n {\n fixToUnknown: false,\n ignoreRestArgs: false,\n },\n ],\n '@typescript-eslint/no-inferrable-types': [\n 2,\n {\n ignoreParameters: false,\n ignoreProperties: false,\n },\n ],\n '@typescript-eslint/no-invalid-void-type': [\n 2,\n {\n allowAsThisParameter: false,\n allowInGenericTypeArguments: true,\n },\n ],\n '@typescript-eslint/no-namespace': [\n 2,\n {\n allowDeclarations: false,\n allowDefinitionFiles: true,\n },\n ],\n '@typescript-eslint/no-redundant-type-constituents': [2],\n '@typescript-eslint/no-require-imports': [\n 2,\n {\n allow: [],\n allowAsImport: true,\n },\n ],\n '@typescript-eslint/no-restricted-types': [\n 2,\n {\n types: {\n '{}': {\n message: `\n - If you want to represent an empty object, use \\`type EmptyObject = Record<string, never>\\`.\n - If you want to represent an object literal, use either \\`type AnyObject = Record<string, any>\\` or \\`object\\`.\n - If you want to represent any non-nullish value, use \\`type AnyNonNullishValue = NonNullable<unknown>\\`.`,\n suggest: [\n 'AnyNonNullishValue',\n 'EmptyObject',\n 'AnyObject',\n 'object',\n 'Record<string, never>',\n 'Record<string, any>',\n 'NonNullable<unknown>',\n ],\n },\n },\n },\n ],\n '@typescript-eslint/no-unnecessary-type-arguments': [2],\n '@typescript-eslint/no-unnecessary-type-assertion': [\n 2,\n { typesToIgnore: [] },\n ],\n '@typescript-eslint/no-unnecessary-type-parameters': [2],\n '@typescript-eslint/prefer-nullish-coalescing': [\n 2,\n {\n allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,\n ignoreBooleanCoercion: false,\n ignoreConditionalTests: true,\n ignoreIfStatements: false,\n ignoreMixedLogicalExpressions: false,\n ignorePrimitives: {\n bigint: false,\n boolean: false,\n number: false,\n string: false,\n },\n ignoreTernaryTests: false,\n },\n ],\n '@typescript-eslint/require-await': [2],\n '@typescript-eslint/unified-signatures': [\n 2,\n {\n ignoreDifferentlyNamedParameters: false,\n ignoreOverloadsWithDifferentJSDoc: false,\n },\n ],\n 'object-shorthand': [\n 2,\n 'always',\n {\n avoidExplicitReturnArrows: true,\n avoidQuotes: true,\n ignoreConstructors: true,\n methodsIgnorePattern: '',\n },\n ],\n 'sort-imports': [\n 2,\n {\n allowSeparatedGroups: true,\n ignoreCase: false,\n ignoreDeclarationSort: true,\n ignoreMemberSort: false,\n memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],\n },\n ],\n\n ...disabledRules,\n },\n } as const satisfies Config,\n\n {\n files: ['**/*.cjs'],\n languageOptions: {\n sourceType: 'commonjs',\n } as const satisfies TSESLintFlatConfig.LanguageOptions satisfies Linter.LanguageOptions,\n name: `${packageJson.name}/commonjs-files`,\n rules: {\n '@typescript-eslint/no-require-imports': [\n 0,\n {\n allow: [],\n allowAsImport: false,\n },\n ],\n },\n } as const satisfies Config,\n\n prettierConfig,\n] as const satisfies Config[]\n","import type { Config } from './external.js'\nimport { defineConfig } from './external.js'\nimport { flatESLintConfig } from './shareableConfigs.js'\n\n/**\n * A function that returns {@linkcode flatESLintConfig}\n * along with optional additional overrides.\n * It's made mainly to provide intellisense and eliminate\n * the need for manual type annotations using JSDoc comments.\n *\n * @param [additionalOverrides=[]] - **Optional** additional overrides to apply to the configuration.\n * @returns An augmented version of the default {@linkcode flatESLintConfig}, incorporating any provided overrides.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `eslint.config.mts` or `eslint.config.mjs`__</caption>\n *\n * ```ts\n * import { createESLintConfig } from '@aryaemami59/eslint-config'\n *\n * export default createESLintConfig([\n * {\n * rules: {\n * 'no-console': [0],\n * },\n * },\n * {\n * // ...Other additional overrides\n * },\n * ])\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { createESLintConfig } = require('@aryaemami59/eslint-config')\n *\n * module.exports = createESLintConfig([\n * {\n * rules: {\n * 'no-console': [0],\n * },\n * },\n * {\n * // ...Other additional overrides\n * },\n * ])\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/eslint-config')).createESLintConfig([\n * {\n * rules: {\n * 'no-console': [0],\n * },\n * },\n * {\n * // ...Other additional overrides\n * },\n * ]))()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import eslintConfigModule = require('@aryaemami59/eslint-config')\n * import createESLintConfig = eslintConfigModule.createESLintConfig\n *\n * export = createESLintConfig([\n * {\n * rules: {\n * 'no-console': [0],\n * },\n * },\n * {\n * // ...Other additional overrides\n * },\n * ])\n * ```\n *\n * @since 0.0.3\n * @public\n */\nexport const createESLintConfig = (\n additionalOverrides: Parameters<typeof defineConfig> = [],\n): Config[] =>\n /* @__PURE__ */ defineConfig(...flatESLintConfig, ...additionalOverrides)\n"],"mappings":";;;;;;;AASA,MAAa,gBAAgB;CAC3B,qCAAqC,CACnC,GACA;EACE,0BAA0B;EAC1B,YAAY;EACZ,mBAAmB;EACnB,aAAa;EACb,cAAc;EACf,CACF;CAKD,qCAAqC,CACnC,GACA;EACE,MAAM;EAEN,mBAAmB;EACnB,cAAc;EAEd,2BAA2B;EAE3B,gCAAgC;EAChC,gCAAgC;EAChC,oBAAoB;EACpB,yBAAyB;EACzB,MAAM;EAEN,mBAAmB;EACpB,CACF;CACD,YAAY,CACV,GACA,EACE,QAAQ,OACT,CACF;CACF;;;;AC7BD,MAAa,EACX,SAAS,gBACT,MAAM,aACN,aAAa,oBACb,QAAQ,sBACN;;;;;;;;AEdJ,MAAa,gBAAgB;CAC3B,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;CACD,MAAM,GAAGA,KAAiB;CAC3B;;;;ACfD,MAAa,gBAAgB;CAC3B,UAAU;CACV,WAAW;CACX,WAAW;CACX,YAAY;CACZ,QAAQ;CACR,YAAY;CACZ,WAAW;CACX,YAAY;CACZ,MAAM;CACN,UAAU;CACV,QAAQ;CACR,cAAc;CACd,IAAI;CACJ,cAAc;CACd,gBAAgB;CAChB,OAAO;CACP,MAAM;CACN,IAAI;CACJ,QAAQ;CACT;AAYD,MAAa,2BAEX,uBAAO,OACL;CACE,GAAG;CACH,GAAG;CACH,GAAG;CACJ,EAED;CACE,GAAG;CACH,GAAG;CACJ,CACF;;;;ACNH,MAAa,mBAAmB;CAG9B;CAEA;EACE,MAAM,GAAG,GAAG,KAAK,KAAK;EACtB,GAAG,GAAG,QAAQ;EACf;CAID,GAAI,gBAAgB;CAGpB,GAAI,gBAAgB;CAEpB;EACE,iBAAiB;GACf,SAAS;GACT,QACE;GACF,eAAe;IACb,aAAa;IACb,gBAAgB;IACjB;GACF;EACD,eAAe;GACb,+BAA+B;GAC/B,2BAA2B;GAC5B;EACD,MAAM,GAAGC,KAAiB;EAC1B,SAAS,EACP,sBACE,gBACH;EAED,OAAO;GAEL,kDAAkD,CAAC,GAAG,OAAO;GAC7D,8CAA8C,CAC5C,GACA,EAAE,wCAAwC,OAAO,CAClD;GACD,8CAA8C,CAC5C,GACA;IACE,yBAAyB;IACzB,UAAU;IACV,QAAQ;IACT,CACF;GACD,mDAAmD,CACjD,GACA;IACE,sBAAsB;IACtB,oBAAoB;IACpB,8BAA8B;IAC/B,CACF;GACD,qDAAqD,CACnD,GACA;IACE,qBAAqB;IACrB,cAAc;IACf,CACF;GACD,2CAA2C,CACzC,GACA;IACE,iBAAiB;IACjB,kBAAkB;IACnB,CACF;GACD,sCAAsC,CACpC,GACA;IACE,cAAc;IACd,gBAAgB;IACjB,CACF;GACD,0CAA0C,CACxC,GACA;IACE,kBAAkB;IAClB,kBAAkB;IACnB,CACF;GACD,2CAA2C,CACzC,GACA;IACE,sBAAsB;IACtB,6BAA6B;IAC9B,CACF;GACD,mCAAmC,CACjC,GACA;IACE,mBAAmB;IACnB,sBAAsB;IACvB,CACF;GACD,qDAAqD,CAAC,EAAE;GACxD,yCAAyC,CACvC,GACA;IACE,OAAO,EAAE;IACT,eAAe;IAChB,CACF;GACD,0CAA0C,CACxC,GACA,EACE,OAAO,EACL,MAAM;IACJ,SAAS;;;;IAIT,SAAS;KACP;KACA;KACA;KACA;KACA;KACA;KACA;KACD;IACF,EACF,EACF,CACF;GACD,oDAAoD,CAAC,EAAE;GACvD,oDAAoD,CAClD,GACA,EAAE,eAAe,EAAE,EAAE,CACtB;GACD,qDAAqD,CAAC,EAAE;GACxD,gDAAgD,CAC9C,GACA;IACE,wDAAwD;IACxD,uBAAuB;IACvB,wBAAwB;IACxB,oBAAoB;IACpB,+BAA+B;IAC/B,kBAAkB;KAChB,QAAQ;KACR,SAAS;KACT,QAAQ;KACR,QAAQ;KACT;IACD,oBAAoB;IACrB,CACF;GACD,oCAAoC,CAAC,EAAE;GACvC,yCAAyC,CACvC,GACA;IACE,kCAAkC;IAClC,mCAAmC;IACpC,CACF;GACD,oBAAoB;IAClB;IACA;IACA;KACE,2BAA2B;KAC3B,aAAa;KACb,oBAAoB;KACpB,sBAAsB;KACvB;IACF;GACD,gBAAgB,CACd,GACA;IACE,sBAAsB;IACtB,YAAY;IACZ,uBAAuB;IACvB,kBAAkB;IAClB,uBAAuB;KAAC;KAAQ;KAAO;KAAY;KAAS;IAC7D,CACF;GAED,GAAG;GACJ;EACF;CAED;EACE,OAAO,CAAC,WAAW;EACnB,iBAAiB,EACf,YAAY,YACb;EACD,MAAM,GAAGA,KAAiB;EAC1B,OAAO,EACL,yCAAyC,CACvC,GACA;GACE,OAAO,EAAE;GACT,eAAe;GAChB,CACF,EACF;EACF;CAED;CACD;;;;AC7KD,MAAa,sBACX,sBAAuD,EAAE,KAEzC,6BAAa,GAAG,kBAAkB,GAAG,oBAAoB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aryaemami59/eslint-config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "ESLint configuration for TypeScript projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -67,26 +67,26 @@
|
|
|
67
67
|
"typecheck": "tsc -p ${INIT_CWD}/tsconfig.json"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@eslint/js": "^10",
|
|
71
|
-
"@typescript-eslint/utils": "^8.
|
|
70
|
+
"@eslint/js": "^10.0.1",
|
|
71
|
+
"@typescript-eslint/utils": "^8.58.0",
|
|
72
72
|
"eslint-config-prettier": "^10.1.8",
|
|
73
|
-
"globals": "^17.
|
|
74
|
-
"typescript-eslint": "^8.
|
|
73
|
+
"globals": "^17.4.0",
|
|
74
|
+
"typescript-eslint": "^8.58.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
78
78
|
"@aryaemami59/tsconfig": "workspace:^",
|
|
79
|
-
"@eslint/core": "^1.
|
|
80
|
-
"@types/node": "^25.2
|
|
81
|
-
"eslint": "^10.
|
|
82
|
-
"publint": "^0.3.
|
|
83
|
-
"rimraf": "^6.1.
|
|
84
|
-
"tsdown": "^0.
|
|
85
|
-
"typescript": "^
|
|
79
|
+
"@eslint/core": "^1.2.0",
|
|
80
|
+
"@types/node": "^25.5.2",
|
|
81
|
+
"eslint": "^10.2.0",
|
|
82
|
+
"publint": "^0.3.18",
|
|
83
|
+
"rimraf": "^6.1.3",
|
|
84
|
+
"tsdown": "^0.21.7",
|
|
85
|
+
"typescript": "^6.0.2"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"@eslint/core": "*",
|
|
89
|
-
"eslint": "
|
|
89
|
+
"eslint": "^9.0.0 || ^10.0.0",
|
|
90
90
|
"typescript": "*"
|
|
91
91
|
},
|
|
92
92
|
"peerDependenciesMeta": {
|
|
@@ -103,8 +103,5 @@
|
|
|
103
103
|
"publishConfig": {
|
|
104
104
|
"access": "public",
|
|
105
105
|
"provenance": true
|
|
106
|
-
},
|
|
107
|
-
"optionalDependencies": {
|
|
108
|
-
"@eslint/core": "*"
|
|
109
106
|
}
|
|
110
107
|
}
|
package/src/disabledRules.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Linter } from '
|
|
1
|
+
import type { Linter } from './external.js'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* An object comprised of ESLint rules to disable.
|
|
@@ -20,7 +20,7 @@ export const disabledRules = {
|
|
|
20
20
|
],
|
|
21
21
|
|
|
22
22
|
// TODO: Remove this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.
|
|
23
|
-
'@typescript-eslint/consistent-generic-constructors': [0],
|
|
23
|
+
// '@typescript-eslint/consistent-generic-constructors': [0],
|
|
24
24
|
|
|
25
25
|
'@typescript-eslint/no-unused-vars': [
|
|
26
26
|
0,
|
package/src/external.ts
CHANGED
|
@@ -1,13 +1,30 @@
|
|
|
1
1
|
import js from '@eslint/js'
|
|
2
2
|
import prettierConfig from 'eslint-config-prettier/flat'
|
|
3
|
-
import
|
|
4
|
-
export {
|
|
3
|
+
import globals from 'globals'
|
|
4
|
+
export type { ESLint, Linter } from 'eslint'
|
|
5
|
+
export { defineConfig } from 'eslint/config'
|
|
6
|
+
export type { Config } from 'eslint/config'
|
|
7
|
+
export {
|
|
8
|
+
config as tseslintConfig,
|
|
9
|
+
configs as tseslintConfigs,
|
|
10
|
+
parser as tseslintParser,
|
|
11
|
+
plugin as tseslintPlugin,
|
|
12
|
+
} from 'typescript-eslint'
|
|
5
13
|
export type {
|
|
6
|
-
Config,
|
|
7
|
-
ConfigArray,
|
|
8
|
-
ConfigWithExtends,
|
|
9
|
-
FlatConfig,
|
|
10
|
-
InfiniteDepthConfigWithExtends,
|
|
14
|
+
Config as TSESLintConfig,
|
|
15
|
+
ConfigArray as TSESLintConfigArray,
|
|
16
|
+
ConfigWithExtends as TSESLintConfigWithExtends,
|
|
17
|
+
FlatConfig as TSESLintFlatConfig,
|
|
18
|
+
InfiniteDepthConfigWithExtends as TSESLintInfiniteDepthConfigWithExtends,
|
|
11
19
|
} from 'typescript-eslint'
|
|
12
20
|
export { js, prettierConfig }
|
|
13
|
-
export const {
|
|
21
|
+
export const {
|
|
22
|
+
browser: browserGlobals,
|
|
23
|
+
node: nodeGlobals,
|
|
24
|
+
nodeBuiltin: nodeBuiltinGlobals,
|
|
25
|
+
vitest: vitestTestGlobals,
|
|
26
|
+
} = globals
|
|
27
|
+
export type GlobalsBrowser = typeof browserGlobals
|
|
28
|
+
export type GlobalsNode = typeof nodeGlobals
|
|
29
|
+
export type GlobalsNodeBuiltin = typeof nodeBuiltinGlobals
|
|
30
|
+
export type GlobalsVitest = typeof vitestTestGlobals
|
package/src/globalIgnores.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import packageJson from '@aryaemami59/eslint-config/package.json' with { type: 'json' }
|
|
2
|
+
import type { Config } from './external.js'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* An object representing
|
|
@@ -28,5 +28,5 @@ export const globalIgnores = {
|
|
|
28
28
|
'**/dist/',
|
|
29
29
|
'**/temp/',
|
|
30
30
|
],
|
|
31
|
-
name: `${
|
|
31
|
+
name: `${packageJson.name}/global-ignores`,
|
|
32
32
|
} as const satisfies Config
|
package/src/globals.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import type { Linter } from '
|
|
2
|
-
import {
|
|
1
|
+
import type { GlobalsVitest, Linter } from './external.js'
|
|
2
|
+
import {
|
|
3
|
+
browserGlobals,
|
|
4
|
+
nodeBuiltinGlobals,
|
|
5
|
+
nodeGlobals,
|
|
6
|
+
vitestTestGlobals,
|
|
7
|
+
} from './external.js'
|
|
3
8
|
|
|
4
9
|
/**
|
|
5
10
|
* An object representing the
|
|
@@ -12,6 +17,8 @@ import { browser, node, nodeBuiltin, vitest } from './external.js'
|
|
|
12
17
|
export const vitestGlobals = {
|
|
13
18
|
afterAll: 'writable',
|
|
14
19
|
afterEach: 'writable',
|
|
20
|
+
aroundAll: 'writable',
|
|
21
|
+
aroundEach: 'writable',
|
|
15
22
|
assert: 'writable',
|
|
16
23
|
assertType: 'writable',
|
|
17
24
|
beforeAll: 'writable',
|
|
@@ -28,7 +35,7 @@ export const vitestGlobals = {
|
|
|
28
35
|
vi: 'writable',
|
|
29
36
|
vitest: 'writable',
|
|
30
37
|
} as const satisfies Linter.Globals satisfies Record<
|
|
31
|
-
keyof
|
|
38
|
+
'aroundAll' | 'aroundEach' | keyof GlobalsVitest,
|
|
32
39
|
Extract<Linter.GlobalConf, 'writable'>
|
|
33
40
|
>
|
|
34
41
|
|
|
@@ -39,17 +46,17 @@ export const vitestGlobals = {
|
|
|
39
46
|
* @since 0.0.3
|
|
40
47
|
* @public
|
|
41
48
|
*/
|
|
42
|
-
export const
|
|
49
|
+
export const sharedEnvironmentGlobals =
|
|
43
50
|
/* @__PURE__ */
|
|
44
51
|
Object.assign(
|
|
45
52
|
{
|
|
46
|
-
...
|
|
47
|
-
...
|
|
48
|
-
...
|
|
53
|
+
...browserGlobals,
|
|
54
|
+
...nodeGlobals,
|
|
55
|
+
...nodeBuiltinGlobals,
|
|
49
56
|
} as const satisfies Linter.Globals,
|
|
50
57
|
|
|
51
58
|
{
|
|
52
|
-
...
|
|
59
|
+
...vitestTestGlobals,
|
|
53
60
|
...vitestGlobals,
|
|
54
61
|
} as const satisfies Linter.Globals,
|
|
55
62
|
) satisfies Linter.Globals
|