@aryaemami59/eslint-config 0.0.7 → 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 +99 -195
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +98 -7
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +98 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +94 -167
- package/dist/index.js.map +1 -1
- package/package.json +13 -16
- package/src/disabledRules.ts +1 -1
- package/src/external.ts +23 -9
- package/src/globalIgnores.ts +1 -1
- package/src/globals.ts +15 -8
- package/src/index.ts +11 -10
- package/src/packageJsonName.ts +1 -1
- package/src/shareableConfigs.ts +147 -135
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
|
|
3
|
+
import globals from "globals";
|
|
4
4
|
import { defineConfig } from "eslint/config";
|
|
5
|
-
import { config, configs, parser, plugin } from "typescript-eslint";
|
|
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,7 +30,7 @@ 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
|
|
@@ -46,14 +38,6 @@ var name = "@aryaemami59/eslint-config";
|
|
|
46
38
|
|
|
47
39
|
//#endregion
|
|
48
40
|
//#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
41
|
const globalIgnores = {
|
|
58
42
|
ignores: [
|
|
59
43
|
"**/__snapshots__/",
|
|
@@ -78,17 +62,11 @@ const globalIgnores = {
|
|
|
78
62
|
|
|
79
63
|
//#endregion
|
|
80
64
|
//#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
65
|
const vitestGlobals = {
|
|
90
66
|
afterAll: "writable",
|
|
91
67
|
afterEach: "writable",
|
|
68
|
+
aroundAll: "writable",
|
|
69
|
+
aroundEach: "writable",
|
|
92
70
|
assert: "writable",
|
|
93
71
|
assertType: "writable",
|
|
94
72
|
beforeAll: "writable",
|
|
@@ -105,75 +83,29 @@ const vitestGlobals = {
|
|
|
105
83
|
vi: "writable",
|
|
106
84
|
vitest: "writable"
|
|
107
85
|
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
* @since 0.0.3
|
|
113
|
-
* @public
|
|
114
|
-
*/
|
|
115
|
-
const globals = /* @__PURE__ */ Object.assign({
|
|
116
|
-
...browser,
|
|
117
|
-
...node,
|
|
118
|
-
...nodeBuiltin
|
|
86
|
+
const sharedEnvironmentGlobals = /* @__PURE__ */ Object.assign({
|
|
87
|
+
...browserGlobals,
|
|
88
|
+
...nodeGlobals,
|
|
89
|
+
...nodeBuiltinGlobals
|
|
119
90
|
}, {
|
|
120
|
-
...
|
|
91
|
+
...vitestTestGlobals,
|
|
121
92
|
...vitestGlobals
|
|
122
93
|
});
|
|
123
94
|
|
|
124
95
|
//#endregion
|
|
125
96
|
//#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
97
|
const flatESLintConfig = [
|
|
169
98
|
globalIgnores,
|
|
170
99
|
{
|
|
171
100
|
name: `${js.meta.name}/recommended`,
|
|
172
101
|
...js.configs.recommended
|
|
173
102
|
},
|
|
103
|
+
...tseslintConfigs.recommended,
|
|
104
|
+
...tseslintConfigs.stylistic,
|
|
174
105
|
{
|
|
175
106
|
languageOptions: {
|
|
176
|
-
globals,
|
|
107
|
+
globals: sharedEnvironmentGlobals,
|
|
108
|
+
parser: tseslintParser,
|
|
177
109
|
parserOptions: {
|
|
178
110
|
ecmaVersion: "latest",
|
|
179
111
|
projectService: true
|
|
@@ -184,7 +116,86 @@ const flatESLintConfig = [
|
|
|
184
116
|
reportUnusedInlineConfigs: 2
|
|
185
117
|
},
|
|
186
118
|
name: `${name}/defaults/overrides`,
|
|
119
|
+
plugins: { "@typescript-eslint": tseslintPlugin },
|
|
187
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
|
+
}],
|
|
188
199
|
"object-shorthand": [
|
|
189
200
|
2,
|
|
190
201
|
"always",
|
|
@@ -224,92 +235,8 @@ const flatESLintConfig = [
|
|
|
224
235
|
|
|
225
236
|
//#endregion
|
|
226
237
|
//#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
238
|
const createESLintConfig = (additionalOverrides = []) => /* @__PURE__ */ defineConfig(...flatESLintConfig, ...additionalOverrides);
|
|
312
239
|
|
|
313
240
|
//#endregion
|
|
314
|
-
export {
|
|
241
|
+
export { createESLintConfig, defineConfig, disabledRules, flatESLintConfig, globalIgnores, js, prettierConfig, sharedEnvironmentGlobals, tseslintConfig, tseslintConfigs, tseslintParser, tseslintPlugin, vitestGlobals };
|
|
315
242
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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 globalIdentifiers from 'globals'\nexport type { Linter } from 'eslint'\nexport { defineConfig } from 'eslint/config'\nexport type { Config } from 'eslint/config'\nexport { config, configs, parser, plugin } from 'typescript-eslint'\nexport type {\n ConfigArray,\n ConfigWithExtends,\n FlatConfig,\n InfiniteDepthConfigWithExtends,\n Config as TSESlintConfig,\n} from 'typescript-eslint'\nexport { js, prettierConfig }\nexport const { browser, node, nodeBuiltin, vitest } = globalIdentifiers\n","","import packageJson from '../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 { Linter } from './external.js'\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 packageJson from '../package.json' with { type: 'json' }\nimport { disabledRules } from './disabledRules.js'\nimport type { Config, FlatConfig, Linter } from './external.js'\nimport { js, prettierConfig } from './external.js'\nimport { globalIgnores } from './globalIgnores.js'\nimport { globals } 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 FlatConfig.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 // ...(configs.recommended satisfies Config[] as 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 Config[] as 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: `${packageJson.name}/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 Config,\n\n {\n files: ['**/*.cjs'],\n languageOptions: {\n sourceType: 'commonjs',\n } as const satisfies FlatConfig.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;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;;;;AClCD,MAAa,EAAE,SAAS,MAAM,aAAa,WAAW;;;;;;;;;;;;;;;;AEJtD,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;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACLH,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,GAAGC,KAAiB;EAE1B,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,GAAGA,KAAiB;EAC1B,OAAO,EACL,yCAAyC,CACvC,GACA;GACE,OAAO,EAAE;GACT,eAAe;GAChB,CACF,EACF;EACF;CAED;CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjKD,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": "^
|
|
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": "^
|
|
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": "^9 || ^10",
|
|
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
|
@@ -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,16 +1,30 @@
|
|
|
1
1
|
import js from '@eslint/js'
|
|
2
2
|
import prettierConfig from 'eslint-config-prettier/flat'
|
|
3
|
-
import
|
|
4
|
-
export type { Linter } from 'eslint'
|
|
3
|
+
import globals from 'globals'
|
|
4
|
+
export type { ESLint, Linter } from 'eslint'
|
|
5
5
|
export { defineConfig } from 'eslint/config'
|
|
6
6
|
export type { Config } from 'eslint/config'
|
|
7
|
-
export {
|
|
7
|
+
export {
|
|
8
|
+
config as tseslintConfig,
|
|
9
|
+
configs as tseslintConfigs,
|
|
10
|
+
parser as tseslintParser,
|
|
11
|
+
plugin as tseslintPlugin,
|
|
12
|
+
} from 'typescript-eslint'
|
|
8
13
|
export type {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
Config as TSESLintConfig,
|
|
15
|
+
ConfigArray as TSESLintConfigArray,
|
|
16
|
+
ConfigWithExtends as TSESLintConfigWithExtends,
|
|
17
|
+
FlatConfig as TSESLintFlatConfig,
|
|
18
|
+
InfiniteDepthConfigWithExtends as TSESLintInfiniteDepthConfigWithExtends,
|
|
14
19
|
} from 'typescript-eslint'
|
|
15
20
|
export { js, prettierConfig }
|
|
16
|
-
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
package/src/globals.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import type { Linter } from './external.js'
|
|
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
|
package/src/index.ts
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
export { disabledRules } from './disabledRules.js'
|
|
2
2
|
export {
|
|
3
|
-
config,
|
|
4
|
-
configs,
|
|
5
3
|
defineConfig,
|
|
6
4
|
js,
|
|
7
|
-
parser,
|
|
8
|
-
plugin,
|
|
9
5
|
prettierConfig,
|
|
6
|
+
tseslintConfig,
|
|
7
|
+
tseslintConfigs,
|
|
8
|
+
tseslintParser,
|
|
9
|
+
tseslintPlugin,
|
|
10
10
|
} from './external.js'
|
|
11
11
|
export type {
|
|
12
12
|
Config,
|
|
13
|
-
|
|
14
|
-
ConfigWithExtends,
|
|
15
|
-
FlatConfig,
|
|
16
|
-
InfiniteDepthConfigWithExtends,
|
|
13
|
+
ESLint,
|
|
17
14
|
Linter,
|
|
18
|
-
|
|
15
|
+
TSESLintConfig,
|
|
16
|
+
TSESLintConfigArray,
|
|
17
|
+
TSESLintConfigWithExtends,
|
|
18
|
+
TSESLintFlatConfig,
|
|
19
|
+
TSESLintInfiniteDepthConfigWithExtends,
|
|
19
20
|
} from './external.js'
|
|
20
21
|
export { globalIgnores } from './globalIgnores.js'
|
|
21
|
-
export {
|
|
22
|
+
export { sharedEnvironmentGlobals, vitestGlobals } from './globals.js'
|
|
22
23
|
export { flatESLintConfig } from './shareableConfigs.js'
|
|
23
24
|
export { createESLintConfig } from './utils.js'
|
package/src/packageJsonName.ts
CHANGED