@aryaemami59/eslint-config 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/index.cjs +374 -241
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2533 -1321
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +2533 -1321
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +321 -210
- package/dist/index.js.map +1 -1
- package/package.json +34 -21
- package/src/disabledRules.ts +56 -0
- package/src/external.ts +13 -0
- package/src/globalIgnores.ts +32 -0
- package/src/globals.ts +55 -0
- package/src/index.ts +20 -379
- package/src/packageJsonName.ts +11 -0
- package/src/shareableConfigs.ts +251 -0
- package/src/utils.ts +92 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aryaemami59/eslint-config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "ESLint configuration for TypeScript projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -55,34 +55,44 @@
|
|
|
55
55
|
"src"
|
|
56
56
|
],
|
|
57
57
|
"scripts": {
|
|
58
|
-
"build": "yarn clean &&
|
|
59
|
-
"check-exports": "attw --pack",
|
|
60
|
-
"check-package-json": "publint --strict
|
|
61
|
-
"clean": "rimraf dist",
|
|
62
|
-
"
|
|
58
|
+
"build": "yarn run clean && tsdown --config-loader='unrun' --config=\"${INIT_CWD}/tsdown.config.mts\"",
|
|
59
|
+
"check-exports": "attw --pack ${INIT_CWD}",
|
|
60
|
+
"check-package-json": "publint --strict ${INIT_CWD}",
|
|
61
|
+
"clean": "rimraf ${INIT_CWD}/dist/ ${INIT_CWD}/.rolldown/",
|
|
62
|
+
"format-check": "yarn run -T format-check",
|
|
63
|
+
"format": "yarn run -T format",
|
|
64
|
+
"lint-fix": "yarn run -T lint-fix",
|
|
65
|
+
"lint": "yarn run -T lint",
|
|
66
|
+
"prepack": "yarn run build",
|
|
67
|
+
"typecheck": "tsc -p ${INIT_CWD}/tsconfig.json"
|
|
63
68
|
},
|
|
64
69
|
"dependencies": {
|
|
65
|
-
"@eslint/js": "^
|
|
66
|
-
"@typescript-eslint/utils": "^8.
|
|
67
|
-
"eslint-config-prettier": "^
|
|
68
|
-
"globals": "^
|
|
69
|
-
"typescript-eslint": "^8.
|
|
70
|
+
"@eslint/js": "^10",
|
|
71
|
+
"@typescript-eslint/utils": "^8.54.0",
|
|
72
|
+
"eslint-config-prettier": "^10.1.8",
|
|
73
|
+
"globals": "^17.3.0",
|
|
74
|
+
"typescript-eslint": "^8.54.0"
|
|
70
75
|
},
|
|
71
76
|
"devDependencies": {
|
|
72
|
-
"@arethetypeswrong/cli": "^0.
|
|
73
|
-
"@aryaemami59/tsconfig": "
|
|
74
|
-
"@
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
77
|
+
"@arethetypeswrong/cli": "^0.18.2",
|
|
78
|
+
"@aryaemami59/tsconfig": "workspace:^",
|
|
79
|
+
"@eslint/core": "^1.1.0",
|
|
80
|
+
"@types/node": "^25.2.1",
|
|
81
|
+
"eslint": "^10.0.0",
|
|
82
|
+
"publint": "^0.3.17",
|
|
83
|
+
"rimraf": "^6.1.2",
|
|
84
|
+
"tsdown": "^0.20.3",
|
|
85
|
+
"typescript": "^5.9.3"
|
|
80
86
|
},
|
|
81
87
|
"peerDependencies": {
|
|
82
|
-
"eslint": "
|
|
88
|
+
"@eslint/core": "*",
|
|
89
|
+
"eslint": ">=9",
|
|
83
90
|
"typescript": "*"
|
|
84
91
|
},
|
|
85
92
|
"peerDependenciesMeta": {
|
|
93
|
+
"@eslint/core": {
|
|
94
|
+
"optional": true
|
|
95
|
+
},
|
|
86
96
|
"eslint": {
|
|
87
97
|
"optional": true
|
|
88
98
|
},
|
|
@@ -93,5 +103,8 @@
|
|
|
93
103
|
"publishConfig": {
|
|
94
104
|
"access": "public",
|
|
95
105
|
"provenance": true
|
|
106
|
+
},
|
|
107
|
+
"optionalDependencies": {
|
|
108
|
+
"@eslint/core": "*"
|
|
96
109
|
}
|
|
97
|
-
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Linter } from 'eslint'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An object comprised of ESLint rules to disable.
|
|
5
|
+
* These rules are disabled in {@linkcode flatESLintConfig}.
|
|
6
|
+
*
|
|
7
|
+
* @since 0.0.3
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export const disabledRules = {
|
|
11
|
+
'@typescript-eslint/ban-ts-comment': [
|
|
12
|
+
0,
|
|
13
|
+
{
|
|
14
|
+
minimumDescriptionLength: 3,
|
|
15
|
+
'ts-check': false,
|
|
16
|
+
'ts-expect-error': 'allow-with-description',
|
|
17
|
+
'ts-ignore': true,
|
|
18
|
+
'ts-nocheck': true,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
|
|
22
|
+
// TODO: Remove this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.
|
|
23
|
+
'@typescript-eslint/consistent-generic-constructors': [0],
|
|
24
|
+
|
|
25
|
+
'@typescript-eslint/no-unused-vars': [
|
|
26
|
+
0,
|
|
27
|
+
{
|
|
28
|
+
args: 'after-used',
|
|
29
|
+
// Not included in default options
|
|
30
|
+
argsIgnorePattern: '^_',
|
|
31
|
+
caughtErrors: 'all',
|
|
32
|
+
// Not included in default options
|
|
33
|
+
caughtErrorsIgnorePattern: '^_',
|
|
34
|
+
// Not included in default options
|
|
35
|
+
destructuredArrayIgnorePattern: '^_',
|
|
36
|
+
ignoreClassWithStaticInitBlock: false,
|
|
37
|
+
ignoreRestSiblings: false,
|
|
38
|
+
reportUsedIgnorePattern: false,
|
|
39
|
+
vars: 'all',
|
|
40
|
+
// Not included in default options
|
|
41
|
+
varsIgnorePattern: '^_',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
'no-undef': [
|
|
45
|
+
0,
|
|
46
|
+
{
|
|
47
|
+
typeof: false,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
} as const satisfies Linter.RulesRecord satisfies Record<
|
|
51
|
+
keyof Linter.RulesRecord,
|
|
52
|
+
[
|
|
53
|
+
ruleSeverity: Extract<Linter.Severity, 0>,
|
|
54
|
+
...ruleOptions: readonly unknown[],
|
|
55
|
+
]
|
|
56
|
+
>
|
package/src/external.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import prettierConfig from 'eslint-config-prettier/flat'
|
|
3
|
+
import globalIdentifiers from 'globals'
|
|
4
|
+
export { config, configs, parser, plugin } from 'typescript-eslint'
|
|
5
|
+
export type {
|
|
6
|
+
Config,
|
|
7
|
+
ConfigArray,
|
|
8
|
+
ConfigWithExtends,
|
|
9
|
+
FlatConfig,
|
|
10
|
+
InfiniteDepthConfigWithExtends,
|
|
11
|
+
} from 'typescript-eslint'
|
|
12
|
+
export { js, prettierConfig }
|
|
13
|
+
export const { browser, node, nodeBuiltin, vitest } = globalIdentifiers
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Config } from 'eslint/config'
|
|
2
|
+
import { packageJsonName } from './packageJsonName.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* An object representing
|
|
6
|
+
* {@link https://eslint.org/docs/latest/use/configure/ignore#ignoring-files | **global ignore patterns**}
|
|
7
|
+
* for ESLint configuration.
|
|
8
|
+
*
|
|
9
|
+
* @since 0.0.3
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export const globalIgnores = {
|
|
13
|
+
ignores: [
|
|
14
|
+
'**/__snapshots__/',
|
|
15
|
+
'**/.docusaurus/',
|
|
16
|
+
'**/.expo/',
|
|
17
|
+
'**/.next/',
|
|
18
|
+
'**/.playwright/',
|
|
19
|
+
'**/.temp/',
|
|
20
|
+
'**/.tmp/',
|
|
21
|
+
'**/.turbo/',
|
|
22
|
+
'**/.wrangler/',
|
|
23
|
+
'**/.yalc/',
|
|
24
|
+
'**/.yarn/',
|
|
25
|
+
'**/*.snap',
|
|
26
|
+
'**/build/',
|
|
27
|
+
'**/coverage/',
|
|
28
|
+
'**/dist/',
|
|
29
|
+
'**/temp/',
|
|
30
|
+
],
|
|
31
|
+
name: `${packageJsonName}/global-ignores`,
|
|
32
|
+
} as const satisfies Config
|
package/src/globals.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Linter } from 'eslint'
|
|
2
|
+
import { browser, node, nodeBuiltin, vitest } from './external.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* An object representing the
|
|
6
|
+
* {@link https://vitest.dev/config/#globals | globals} provided by
|
|
7
|
+
* {@link https://vitest.dev | **Vitest**} for use in testing.
|
|
8
|
+
*
|
|
9
|
+
* @since 0.0.3
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export const vitestGlobals = {
|
|
13
|
+
afterAll: 'writable',
|
|
14
|
+
afterEach: 'writable',
|
|
15
|
+
assert: 'writable',
|
|
16
|
+
assertType: 'writable',
|
|
17
|
+
beforeAll: 'writable',
|
|
18
|
+
beforeEach: 'writable',
|
|
19
|
+
chai: 'writable',
|
|
20
|
+
describe: 'writable',
|
|
21
|
+
expect: 'writable',
|
|
22
|
+
expectTypeOf: 'writable',
|
|
23
|
+
it: 'writable',
|
|
24
|
+
onTestFailed: 'writable',
|
|
25
|
+
onTestFinished: 'writable',
|
|
26
|
+
suite: 'writable',
|
|
27
|
+
test: 'writable',
|
|
28
|
+
vi: 'writable',
|
|
29
|
+
vitest: 'writable',
|
|
30
|
+
} as const satisfies Linter.Globals satisfies Record<
|
|
31
|
+
keyof typeof vitest,
|
|
32
|
+
Extract<Linter.GlobalConf, 'writable'>
|
|
33
|
+
>
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* An object that specifies which global
|
|
37
|
+
* variables are available during linting.
|
|
38
|
+
*
|
|
39
|
+
* @since 0.0.3
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export const globals =
|
|
43
|
+
/* @__PURE__ */
|
|
44
|
+
Object.assign(
|
|
45
|
+
{
|
|
46
|
+
...browser,
|
|
47
|
+
...node,
|
|
48
|
+
...nodeBuiltin,
|
|
49
|
+
} as const satisfies Linter.Globals,
|
|
50
|
+
|
|
51
|
+
{
|
|
52
|
+
...vitest,
|
|
53
|
+
...vitestGlobals,
|
|
54
|
+
} as const satisfies Linter.Globals,
|
|
55
|
+
) satisfies Linter.Globals
|
package/src/index.ts
CHANGED
|
@@ -1,379 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
ignores: [
|
|
22
|
-
'**/dist/',
|
|
23
|
-
'**/.yalc/',
|
|
24
|
-
'**/build/',
|
|
25
|
-
'**/lib/',
|
|
26
|
-
'**/temp/',
|
|
27
|
-
'**/.yarn/',
|
|
28
|
-
'**/coverage/',
|
|
29
|
-
],
|
|
30
|
-
} as const satisfies Linter.Config
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* An object representing the
|
|
34
|
-
* {@link https://vitest.dev/config/#globals | globals} provided by
|
|
35
|
-
* {@link https://vitest.dev | **Vitest**} for use in testing.
|
|
36
|
-
*
|
|
37
|
-
* @since 0.0.3
|
|
38
|
-
* @public
|
|
39
|
-
*/
|
|
40
|
-
export const vitestGlobals = {
|
|
41
|
-
suite: 'writable',
|
|
42
|
-
test: 'writable',
|
|
43
|
-
describe: 'writable',
|
|
44
|
-
it: 'writable',
|
|
45
|
-
expectTypeOf: 'writable',
|
|
46
|
-
assertType: 'writable',
|
|
47
|
-
expect: 'writable',
|
|
48
|
-
assert: 'writable',
|
|
49
|
-
vitest: 'writable',
|
|
50
|
-
vi: 'writable',
|
|
51
|
-
beforeAll: 'writable',
|
|
52
|
-
afterAll: 'writable',
|
|
53
|
-
beforeEach: 'writable',
|
|
54
|
-
afterEach: 'writable',
|
|
55
|
-
onTestFailed: 'writable',
|
|
56
|
-
onTestFinished: 'writable',
|
|
57
|
-
} as const satisfies Linter.Globals
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* An object that specifies which global
|
|
61
|
-
* variables are available during linting.
|
|
62
|
-
*
|
|
63
|
-
* @since 0.0.3
|
|
64
|
-
* @public
|
|
65
|
-
*/
|
|
66
|
-
export const globals: typeof vitestGlobals &
|
|
67
|
-
typeof browser &
|
|
68
|
-
typeof node &
|
|
69
|
-
typeof nodeBuiltin = /* @__PURE__ */ Object.assign(
|
|
70
|
-
vitestGlobals,
|
|
71
|
-
browser,
|
|
72
|
-
node,
|
|
73
|
-
nodeBuiltin,
|
|
74
|
-
) satisfies Linter.Globals
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* An object comprised of ESLint rules to disable.
|
|
78
|
-
* These rules are disabled in {@linkcode flatESLintConfig}.
|
|
79
|
-
*
|
|
80
|
-
* @since 0.0.3
|
|
81
|
-
* @public
|
|
82
|
-
*/
|
|
83
|
-
export const rulesToDisable = {
|
|
84
|
-
'no-undef': [0],
|
|
85
|
-
'@typescript-eslint/no-unused-vars': [
|
|
86
|
-
0,
|
|
87
|
-
{
|
|
88
|
-
vars: 'all',
|
|
89
|
-
args: 'after-used',
|
|
90
|
-
caughtErrors: 'all',
|
|
91
|
-
ignoreRestSiblings: false,
|
|
92
|
-
reportUsedIgnorePattern: false,
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
'@typescript-eslint/ban-ts-comment': [
|
|
96
|
-
0,
|
|
97
|
-
[
|
|
98
|
-
{
|
|
99
|
-
'ts-expect-error': 'allow-with-description',
|
|
100
|
-
'ts-ignore': true,
|
|
101
|
-
'ts-nocheck': true,
|
|
102
|
-
'ts-check': false,
|
|
103
|
-
minimumDescriptionLength: 3,
|
|
104
|
-
},
|
|
105
|
-
],
|
|
106
|
-
],
|
|
107
|
-
} as const satisfies Linter.RulesRecord
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Flat ESLint configuration tailored for projects using TypeScript.
|
|
111
|
-
*
|
|
112
|
-
* @example
|
|
113
|
-
* <caption>#### __ECMAScript Modules (ESM) usage inside a file like `eslint.config.mts` or `eslint.config.mjs`__</caption>
|
|
114
|
-
*
|
|
115
|
-
* ```ts
|
|
116
|
-
* import { flatESLintConfig } from '@aryaemami59/eslint-config'
|
|
117
|
-
*
|
|
118
|
-
* export default flatESLintConfig
|
|
119
|
-
* ```
|
|
120
|
-
*
|
|
121
|
-
* @example
|
|
122
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using `require`)__</caption>
|
|
123
|
-
*
|
|
124
|
-
* ```ts
|
|
125
|
-
* const { flatESLintConfig } = require('@aryaemami59/eslint-config')
|
|
126
|
-
*
|
|
127
|
-
* module.exports = flatESLintConfig
|
|
128
|
-
* ```
|
|
129
|
-
*
|
|
130
|
-
* @example
|
|
131
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cjs` or `eslint.config.cts` (using dynamic import)__</caption>
|
|
132
|
-
*
|
|
133
|
-
* ```ts
|
|
134
|
-
* module.exports = (async () =>
|
|
135
|
-
* (await import('@aryaemami59/eslint-config')).flatESLintConfig)()
|
|
136
|
-
* ```
|
|
137
|
-
*
|
|
138
|
-
* @example
|
|
139
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` (using import and export assignment)__</caption>
|
|
140
|
-
*
|
|
141
|
-
* ```ts
|
|
142
|
-
* import eslintConfigModule = require('@aryaemami59/eslint-config')
|
|
143
|
-
* import flatESLintConfig = eslintConfigModule.flatESLintConfig
|
|
144
|
-
*
|
|
145
|
-
* export = flatESLintConfig
|
|
146
|
-
* ```
|
|
147
|
-
*
|
|
148
|
-
* @since 0.0.3
|
|
149
|
-
* @public
|
|
150
|
-
*/
|
|
151
|
-
export const flatESLintConfig: TSESLint.FlatConfig.Config[] =
|
|
152
|
-
/* @__PURE__ */ config(
|
|
153
|
-
// `ignores` must be first.
|
|
154
|
-
// config with just `ignores` is the replacement for `.eslintignore`
|
|
155
|
-
globalIgnores,
|
|
156
|
-
{ name: '@aryaemami59/javascript', ...js.configs.recommended },
|
|
157
|
-
...configs.recommended,
|
|
158
|
-
...configs.stylistic,
|
|
159
|
-
{ name: '@aryaemami59/prettier-config', ...prettierConfig },
|
|
160
|
-
{
|
|
161
|
-
name: '@aryaemami59/main',
|
|
162
|
-
languageOptions: {
|
|
163
|
-
globals,
|
|
164
|
-
parser,
|
|
165
|
-
parserOptions: {
|
|
166
|
-
projectService: {
|
|
167
|
-
allowDefaultProject: ['.*.js', '.*.mjs', '.*.cjs'],
|
|
168
|
-
defaultProject: './tsconfig.json',
|
|
169
|
-
},
|
|
170
|
-
ecmaVersion: 'latest',
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
rules: {
|
|
174
|
-
'@typescript-eslint/consistent-type-imports': [
|
|
175
|
-
2,
|
|
176
|
-
{
|
|
177
|
-
prefer: 'type-imports',
|
|
178
|
-
fixStyle: 'separate-type-imports',
|
|
179
|
-
disallowTypeAnnotations: true,
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
'@typescript-eslint/consistent-type-exports': [
|
|
183
|
-
2,
|
|
184
|
-
{ fixMixedExportsWithInlineTypeSpecifier: false },
|
|
185
|
-
],
|
|
186
|
-
'@typescript-eslint/no-explicit-any': [
|
|
187
|
-
2,
|
|
188
|
-
{ fixToUnknown: false, ignoreRestArgs: false },
|
|
189
|
-
],
|
|
190
|
-
'@typescript-eslint/no-empty-object-type': [
|
|
191
|
-
2,
|
|
192
|
-
{ allowInterfaces: 'never', allowObjectTypes: 'never' },
|
|
193
|
-
],
|
|
194
|
-
'@typescript-eslint/no-restricted-types': [
|
|
195
|
-
2,
|
|
196
|
-
{
|
|
197
|
-
types: {
|
|
198
|
-
'{}': {
|
|
199
|
-
message: `
|
|
200
|
-
- If you want to represent an empty object, use \`type EmptyObject = Record<string, never>\`.
|
|
201
|
-
- If you want to represent an object literal, use either \`type AnyObject = Record<string, any>\` or \`object\`.
|
|
202
|
-
- If you want to represent any non-nullish value, use \`type AnyNonNullishValue = NonNullable<unknown>\`.`,
|
|
203
|
-
suggest: [
|
|
204
|
-
'AnyNonNullishValue',
|
|
205
|
-
'EmptyObject',
|
|
206
|
-
'AnyObject',
|
|
207
|
-
'object',
|
|
208
|
-
'Record<string, never>',
|
|
209
|
-
'Record<string, any>',
|
|
210
|
-
'NonNullable<unknown>',
|
|
211
|
-
],
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
},
|
|
215
|
-
],
|
|
216
|
-
'@typescript-eslint/no-namespace': [
|
|
217
|
-
2,
|
|
218
|
-
{ allowDeclarations: false, allowDefinitionFiles: true },
|
|
219
|
-
],
|
|
220
|
-
'@typescript-eslint/consistent-type-definitions': [2, 'type'],
|
|
221
|
-
'sort-imports': [
|
|
222
|
-
2,
|
|
223
|
-
{
|
|
224
|
-
ignoreCase: false,
|
|
225
|
-
ignoreDeclarationSort: true,
|
|
226
|
-
ignoreMemberSort: false,
|
|
227
|
-
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
|
|
228
|
-
allowSeparatedGroups: true,
|
|
229
|
-
},
|
|
230
|
-
],
|
|
231
|
-
'@typescript-eslint/unified-signatures': [2],
|
|
232
|
-
'@typescript-eslint/dot-notation': [
|
|
233
|
-
2,
|
|
234
|
-
{
|
|
235
|
-
// Related issue: https://github.com/typescript-eslint/typescript-eslint/issues/10338
|
|
236
|
-
// Base ESLint default options
|
|
237
|
-
allowKeywords: true,
|
|
238
|
-
allowPattern: '',
|
|
239
|
-
// TypeScript ESLint default options
|
|
240
|
-
allowPrivateClassPropertyAccess: false,
|
|
241
|
-
allowProtectedClassPropertyAccess: false,
|
|
242
|
-
allowIndexSignaturePropertyAccess: false,
|
|
243
|
-
},
|
|
244
|
-
],
|
|
245
|
-
'@typescript-eslint/no-unnecessary-type-parameters': [2],
|
|
246
|
-
'@typescript-eslint/no-invalid-void-type': [2],
|
|
247
|
-
'@typescript-eslint/no-confusing-void-expression': [2],
|
|
248
|
-
'@typescript-eslint/no-duplicate-type-constituents': [2],
|
|
249
|
-
'@typescript-eslint/require-await': [2],
|
|
250
|
-
'@typescript-eslint/no-redundant-type-constituents': [2],
|
|
251
|
-
'@typescript-eslint/no-unnecessary-type-arguments': [2],
|
|
252
|
-
'@typescript-eslint/no-unnecessary-type-assertion': [2],
|
|
253
|
-
'@typescript-eslint/prefer-nullish-coalescing': [2],
|
|
254
|
-
'@typescript-eslint/no-inferrable-types': [2],
|
|
255
|
-
'@typescript-eslint/no-empty-function': [
|
|
256
|
-
2,
|
|
257
|
-
{
|
|
258
|
-
// Related issue: https://github.com/typescript-eslint/typescript-eslint/issues/10338
|
|
259
|
-
// Base ESLint default options
|
|
260
|
-
allow: [],
|
|
261
|
-
},
|
|
262
|
-
],
|
|
263
|
-
'@typescript-eslint/no-unused-expressions': [
|
|
264
|
-
2,
|
|
265
|
-
{
|
|
266
|
-
// Related issue: https://github.com/typescript-eslint/typescript-eslint/issues/10338
|
|
267
|
-
// Base ESLint default options
|
|
268
|
-
allowShortCircuit: false,
|
|
269
|
-
allowTernary: false,
|
|
270
|
-
allowTaggedTemplates: false,
|
|
271
|
-
enforceForJSX: false,
|
|
272
|
-
},
|
|
273
|
-
],
|
|
274
|
-
'object-shorthand': [2],
|
|
275
|
-
...rulesToDisable,
|
|
276
|
-
},
|
|
277
|
-
linterOptions: { reportUnusedDisableDirectives: 2 },
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
name: '@aryaemami59/commonjs',
|
|
281
|
-
files: ['**/*.c[jt]s'],
|
|
282
|
-
languageOptions: { sourceType: 'commonjs' },
|
|
283
|
-
rules: {
|
|
284
|
-
'@typescript-eslint/no-require-imports': [
|
|
285
|
-
0,
|
|
286
|
-
[{ allow: [], allowAsImport: false }],
|
|
287
|
-
],
|
|
288
|
-
},
|
|
289
|
-
},
|
|
290
|
-
)
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* A function that returns {@linkcode flatESLintConfig}
|
|
294
|
-
* along with optional additional overrides.
|
|
295
|
-
* It's made mainly to provide intellisense and eliminate
|
|
296
|
-
* the need for manual type annotations using JSDoc comments.
|
|
297
|
-
*
|
|
298
|
-
* @param additionalOverrides - **Optional** additional overrides to apply to the configuration.
|
|
299
|
-
* @returns An augmented version of the default {@linkcode flatESLintConfig}, incorporating any provided overrides.
|
|
300
|
-
*
|
|
301
|
-
* @example
|
|
302
|
-
* <caption>#### __ECMAScript Modules (ESM) usage inside a file like `eslint.config.mts` or `eslint.config.mjs`__</caption>
|
|
303
|
-
*
|
|
304
|
-
* ```ts
|
|
305
|
-
* import { createESLintConfig } from '@aryaemami59/eslint-config'
|
|
306
|
-
*
|
|
307
|
-
* export default createESLintConfig([
|
|
308
|
-
* {
|
|
309
|
-
* rules: {
|
|
310
|
-
* 'no-console': [0],
|
|
311
|
-
* },
|
|
312
|
-
* },
|
|
313
|
-
* {
|
|
314
|
-
* // ...Other additional overrides
|
|
315
|
-
* },
|
|
316
|
-
* ])
|
|
317
|
-
* ```
|
|
318
|
-
*
|
|
319
|
-
* @example
|
|
320
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using `require`)__</caption>
|
|
321
|
-
*
|
|
322
|
-
* ```ts
|
|
323
|
-
* const { createESLintConfig } = require('@aryaemami59/eslint-config')
|
|
324
|
-
*
|
|
325
|
-
* module.exports = createESLintConfig([
|
|
326
|
-
* {
|
|
327
|
-
* rules: {
|
|
328
|
-
* 'no-console': [0],
|
|
329
|
-
* },
|
|
330
|
-
* },
|
|
331
|
-
* {
|
|
332
|
-
* // ...Other additional overrides
|
|
333
|
-
* },
|
|
334
|
-
* ])
|
|
335
|
-
* ```
|
|
336
|
-
*
|
|
337
|
-
* @example
|
|
338
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using dynamic import)__</caption>
|
|
339
|
-
*
|
|
340
|
-
* ```ts
|
|
341
|
-
* module.exports = (async () =>
|
|
342
|
-
* (await import('@aryaemami59/eslint-config')).createESLintConfig([
|
|
343
|
-
* {
|
|
344
|
-
* rules: {
|
|
345
|
-
* 'no-console': [0],
|
|
346
|
-
* },
|
|
347
|
-
* },
|
|
348
|
-
* {
|
|
349
|
-
* // ...Other additional overrides
|
|
350
|
-
* },
|
|
351
|
-
* ]))()
|
|
352
|
-
* ```
|
|
353
|
-
*
|
|
354
|
-
* @example
|
|
355
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` (using import and export assignment)__</caption>
|
|
356
|
-
*
|
|
357
|
-
* ```ts
|
|
358
|
-
* import eslintConfigModule = require('@aryaemami59/eslint-config')
|
|
359
|
-
* import createESLintConfig = eslintConfigModule.createESLintConfig
|
|
360
|
-
*
|
|
361
|
-
* export = createESLintConfig([
|
|
362
|
-
* {
|
|
363
|
-
* rules: {
|
|
364
|
-
* 'no-console': [0],
|
|
365
|
-
* },
|
|
366
|
-
* },
|
|
367
|
-
* {
|
|
368
|
-
* // ...Other additional overrides
|
|
369
|
-
* },
|
|
370
|
-
* ])
|
|
371
|
-
* ```
|
|
372
|
-
*
|
|
373
|
-
* @since 0.0.3
|
|
374
|
-
* @public
|
|
375
|
-
*/
|
|
376
|
-
export const createESLintConfig = (
|
|
377
|
-
additionalOverrides: ConfigWithExtends[] = [],
|
|
378
|
-
): TSESLint.FlatConfig.Config[] =>
|
|
379
|
-
/* @__PURE__ */ config(...flatESLintConfig, ...additionalOverrides)
|
|
1
|
+
export { disabledRules } from './disabledRules.js'
|
|
2
|
+
export {
|
|
3
|
+
config,
|
|
4
|
+
configs,
|
|
5
|
+
js,
|
|
6
|
+
parser,
|
|
7
|
+
plugin,
|
|
8
|
+
prettierConfig,
|
|
9
|
+
} from './external.js'
|
|
10
|
+
export type {
|
|
11
|
+
Config,
|
|
12
|
+
ConfigArray,
|
|
13
|
+
ConfigWithExtends,
|
|
14
|
+
FlatConfig,
|
|
15
|
+
InfiniteDepthConfigWithExtends,
|
|
16
|
+
} from './external.js'
|
|
17
|
+
export { globalIgnores } from './globalIgnores.js'
|
|
18
|
+
export { globals, vitestGlobals } from './globals.js'
|
|
19
|
+
export { flatESLintConfig } from './shareableConfigs.js'
|
|
20
|
+
export { createESLintConfig } from './utils.js'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import packageJson from '../package.json' with { type: 'json' }
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This is used because if we import the package name from the
|
|
5
|
+
* `package.json` file, it will be bundled into the final output,
|
|
6
|
+
* which is not desired.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.0.5
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export const packageJsonName = packageJson.name
|