@aryaemami59/eslint-config 0.0.4 → 0.0.5
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 +179 -90
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +185 -269
- package/dist/index.d.ts +185 -269
- package/dist/index.js +172 -91
- package/dist/index.js.map +1 -1
- package/package.json +22 -18
- package/src/disabledRules.ts +37 -0
- package/src/external.ts +10 -0
- package/src/globalIgnores.ts +31 -0
- package/src/globals.ts +57 -0
- package/src/index.ts +19 -379
- package/src/packageName.ts +9 -0
- package/src/shareableConfigs.ts +246 -0
- package/src/utils.ts +93 -0
package/dist/index.js
CHANGED
|
@@ -1,24 +1,66 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/disabledRules.ts
|
|
2
|
+
var disabledRules = {
|
|
3
|
+
"no-undef": [0, { typeof: false }],
|
|
4
|
+
"@typescript-eslint/no-unused-vars": [
|
|
5
|
+
0,
|
|
6
|
+
{
|
|
7
|
+
args: "all",
|
|
8
|
+
argsIgnorePattern: "^_",
|
|
9
|
+
caughtErrors: "all",
|
|
10
|
+
caughtErrorsIgnorePattern: "^_",
|
|
11
|
+
destructuredArrayIgnorePattern: "^_",
|
|
12
|
+
varsIgnorePattern: "^_",
|
|
13
|
+
ignoreRestSiblings: true
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"@typescript-eslint/ban-ts-comment": [
|
|
17
|
+
0,
|
|
18
|
+
{
|
|
19
|
+
"ts-expect-error": "allow-with-description",
|
|
20
|
+
"ts-ignore": true,
|
|
21
|
+
"ts-nocheck": true,
|
|
22
|
+
"ts-check": false,
|
|
23
|
+
minimumDescriptionLength: 3
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// src/external.ts
|
|
2
29
|
import js from "@eslint/js";
|
|
3
|
-
import prettierConfig from "eslint-config-prettier";
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
30
|
+
import prettierConfig from "eslint-config-prettier/flat";
|
|
31
|
+
import { config, configs, parser, plugin } from "typescript-eslint";
|
|
32
|
+
|
|
33
|
+
// src/packageName.ts
|
|
34
|
+
var packageName = "@aryaemami59/eslint-config";
|
|
35
|
+
|
|
36
|
+
// src/globalIgnores.ts
|
|
7
37
|
var globalIgnores = {
|
|
8
|
-
name:
|
|
38
|
+
name: `${packageName}/global-ignores`,
|
|
9
39
|
ignores: [
|
|
10
40
|
"**/dist/",
|
|
11
|
-
"**/.yalc/",
|
|
12
41
|
"**/build/",
|
|
13
42
|
"**/lib/",
|
|
43
|
+
"**/coverage/",
|
|
44
|
+
"**/__snapshots__/",
|
|
14
45
|
"**/temp/",
|
|
46
|
+
"**/.temp/",
|
|
47
|
+
"**/.tmp/",
|
|
48
|
+
"**/.yalc/",
|
|
15
49
|
"**/.yarn/",
|
|
16
|
-
"
|
|
50
|
+
"**/.docusaurus/",
|
|
51
|
+
"**/.next/",
|
|
52
|
+
"**/.expo/",
|
|
53
|
+
"**/*.snap"
|
|
17
54
|
]
|
|
18
55
|
};
|
|
56
|
+
|
|
57
|
+
// src/globals.ts
|
|
58
|
+
import globalIdentifiers from "globals";
|
|
59
|
+
var { browser, node, nodeBuiltin, vitest } = globalIdentifiers;
|
|
19
60
|
var vitestGlobals = {
|
|
20
61
|
suite: "writable",
|
|
21
62
|
test: "writable",
|
|
63
|
+
chai: "writable",
|
|
22
64
|
describe: "writable",
|
|
23
65
|
it: "writable",
|
|
24
66
|
expectTypeOf: "writable",
|
|
@@ -35,64 +77,44 @@ var vitestGlobals = {
|
|
|
35
77
|
onTestFinished: "writable"
|
|
36
78
|
};
|
|
37
79
|
var globals = /* @__PURE__ */ Object.assign(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
80
|
+
{
|
|
81
|
+
...browser,
|
|
82
|
+
...node,
|
|
83
|
+
...nodeBuiltin
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
...vitest,
|
|
87
|
+
...vitestGlobals
|
|
88
|
+
}
|
|
42
89
|
);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"@typescript-eslint/no-unused-vars": [
|
|
46
|
-
0,
|
|
47
|
-
{
|
|
48
|
-
vars: "all",
|
|
49
|
-
args: "after-used",
|
|
50
|
-
caughtErrors: "all",
|
|
51
|
-
ignoreRestSiblings: false,
|
|
52
|
-
reportUsedIgnorePattern: false
|
|
53
|
-
}
|
|
54
|
-
],
|
|
55
|
-
"@typescript-eslint/ban-ts-comment": [
|
|
56
|
-
0,
|
|
57
|
-
[
|
|
58
|
-
{
|
|
59
|
-
"ts-expect-error": "allow-with-description",
|
|
60
|
-
"ts-ignore": true,
|
|
61
|
-
"ts-nocheck": true,
|
|
62
|
-
"ts-check": false,
|
|
63
|
-
minimumDescriptionLength: 3
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
]
|
|
67
|
-
};
|
|
90
|
+
|
|
91
|
+
// src/shareableConfigs.ts
|
|
68
92
|
var flatESLintConfig = /* @__PURE__ */ config(
|
|
69
93
|
// `ignores` must be first.
|
|
70
94
|
// config with just `ignores` is the replacement for `.eslintignore`
|
|
71
95
|
globalIgnores,
|
|
72
|
-
{ name: "@aryaemami59/javascript", ...js.configs.recommended },
|
|
73
|
-
...configs.recommended,
|
|
74
|
-
...configs.stylistic,
|
|
75
|
-
{ name: "@aryaemami59/prettier-config", ...prettierConfig },
|
|
76
96
|
{
|
|
77
|
-
name:
|
|
97
|
+
name: `${js.meta.name}/recommended`,
|
|
98
|
+
...js.configs.recommended
|
|
99
|
+
},
|
|
100
|
+
configs.recommended,
|
|
101
|
+
configs.stylistic,
|
|
102
|
+
{
|
|
103
|
+
name: `${packageName}/defaults/overrides`,
|
|
78
104
|
languageOptions: {
|
|
79
105
|
globals,
|
|
80
|
-
parser,
|
|
81
106
|
parserOptions: {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
defaultProject: "./tsconfig.json"
|
|
85
|
-
},
|
|
86
|
-
ecmaVersion: "latest"
|
|
107
|
+
ecmaVersion: "latest",
|
|
108
|
+
projectService: true
|
|
87
109
|
}
|
|
88
110
|
},
|
|
89
111
|
rules: {
|
|
90
112
|
"@typescript-eslint/consistent-type-imports": [
|
|
91
113
|
2,
|
|
92
114
|
{
|
|
93
|
-
|
|
115
|
+
disallowTypeAnnotations: true,
|
|
94
116
|
fixStyle: "separate-type-imports",
|
|
95
|
-
|
|
117
|
+
prefer: "type-imports"
|
|
96
118
|
}
|
|
97
119
|
],
|
|
98
120
|
"@typescript-eslint/consistent-type-exports": [
|
|
@@ -101,11 +123,17 @@ var flatESLintConfig = /* @__PURE__ */ config(
|
|
|
101
123
|
],
|
|
102
124
|
"@typescript-eslint/no-explicit-any": [
|
|
103
125
|
2,
|
|
104
|
-
{
|
|
126
|
+
{
|
|
127
|
+
fixToUnknown: false,
|
|
128
|
+
ignoreRestArgs: false
|
|
129
|
+
}
|
|
105
130
|
],
|
|
106
131
|
"@typescript-eslint/no-empty-object-type": [
|
|
107
132
|
2,
|
|
108
|
-
{
|
|
133
|
+
{
|
|
134
|
+
allowInterfaces: "never",
|
|
135
|
+
allowObjectTypes: "never"
|
|
136
|
+
}
|
|
109
137
|
],
|
|
110
138
|
"@typescript-eslint/no-restricted-types": [
|
|
111
139
|
2,
|
|
@@ -131,86 +159,139 @@ var flatESLintConfig = /* @__PURE__ */ config(
|
|
|
131
159
|
],
|
|
132
160
|
"@typescript-eslint/no-namespace": [
|
|
133
161
|
2,
|
|
134
|
-
{
|
|
162
|
+
{
|
|
163
|
+
allowDeclarations: false,
|
|
164
|
+
allowDefinitionFiles: true
|
|
165
|
+
}
|
|
135
166
|
],
|
|
136
167
|
"@typescript-eslint/consistent-type-definitions": [2, "type"],
|
|
137
168
|
"sort-imports": [
|
|
138
169
|
2,
|
|
139
170
|
{
|
|
171
|
+
allowSeparatedGroups: true,
|
|
140
172
|
ignoreCase: false,
|
|
141
173
|
ignoreDeclarationSort: true,
|
|
142
174
|
ignoreMemberSort: false,
|
|
143
|
-
memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
|
|
144
|
-
allowSeparatedGroups: true
|
|
175
|
+
memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
|
|
145
176
|
}
|
|
146
177
|
],
|
|
147
|
-
"@typescript-eslint/unified-signatures": [
|
|
148
|
-
"@typescript-eslint/dot-notation": [
|
|
178
|
+
"@typescript-eslint/unified-signatures": [
|
|
149
179
|
2,
|
|
150
180
|
{
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
allowKeywords: true,
|
|
154
|
-
allowPattern: "",
|
|
155
|
-
// TypeScript ESLint default options
|
|
156
|
-
allowPrivateClassPropertyAccess: false,
|
|
157
|
-
allowProtectedClassPropertyAccess: false,
|
|
158
|
-
allowIndexSignaturePropertyAccess: false
|
|
181
|
+
ignoreDifferentlyNamedParameters: false,
|
|
182
|
+
ignoreOverloadsWithDifferentJSDoc: false
|
|
159
183
|
}
|
|
160
184
|
],
|
|
161
185
|
"@typescript-eslint/no-unnecessary-type-parameters": [2],
|
|
162
|
-
"@typescript-eslint/no-invalid-void-type": [
|
|
163
|
-
|
|
164
|
-
|
|
186
|
+
"@typescript-eslint/no-invalid-void-type": [
|
|
187
|
+
2,
|
|
188
|
+
{
|
|
189
|
+
allowAsThisParameter: false,
|
|
190
|
+
allowInGenericTypeArguments: true
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"@typescript-eslint/no-confusing-void-expression": [
|
|
194
|
+
2,
|
|
195
|
+
{
|
|
196
|
+
ignoreArrowShorthand: false,
|
|
197
|
+
ignoreVoidOperator: false,
|
|
198
|
+
ignoreVoidReturningFunctions: false
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"@typescript-eslint/no-duplicate-type-constituents": [
|
|
202
|
+
2,
|
|
203
|
+
{
|
|
204
|
+
ignoreIntersections: false,
|
|
205
|
+
ignoreUnions: false
|
|
206
|
+
}
|
|
207
|
+
],
|
|
165
208
|
"@typescript-eslint/require-await": [2],
|
|
166
209
|
"@typescript-eslint/no-redundant-type-constituents": [2],
|
|
167
210
|
"@typescript-eslint/no-unnecessary-type-arguments": [2],
|
|
168
|
-
"@typescript-eslint/no-unnecessary-type-assertion": [
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
211
|
+
"@typescript-eslint/no-unnecessary-type-assertion": [
|
|
212
|
+
2,
|
|
213
|
+
{ typesToIgnore: [] }
|
|
214
|
+
],
|
|
215
|
+
"@typescript-eslint/prefer-nullish-coalescing": [
|
|
172
216
|
2,
|
|
173
217
|
{
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
218
|
+
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
|
|
219
|
+
ignoreBooleanCoercion: false,
|
|
220
|
+
ignoreConditionalTests: true,
|
|
221
|
+
ignoreIfStatements: false,
|
|
222
|
+
ignoreMixedLogicalExpressions: false,
|
|
223
|
+
ignorePrimitives: {
|
|
224
|
+
bigint: false,
|
|
225
|
+
boolean: false,
|
|
226
|
+
number: false,
|
|
227
|
+
string: false
|
|
228
|
+
},
|
|
229
|
+
ignoreTernaryTests: false
|
|
177
230
|
}
|
|
178
231
|
],
|
|
179
|
-
"@typescript-eslint/no-
|
|
232
|
+
"@typescript-eslint/no-inferrable-types": [
|
|
180
233
|
2,
|
|
181
234
|
{
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
allowShortCircuit: false,
|
|
185
|
-
allowTernary: false,
|
|
186
|
-
allowTaggedTemplates: false,
|
|
187
|
-
enforceForJSX: false
|
|
235
|
+
ignoreParameters: false,
|
|
236
|
+
ignoreProperties: false
|
|
188
237
|
}
|
|
189
238
|
],
|
|
190
|
-
"
|
|
191
|
-
|
|
239
|
+
"@typescript-eslint/no-require-imports": [
|
|
240
|
+
2,
|
|
241
|
+
{
|
|
242
|
+
allow: [],
|
|
243
|
+
allowAsImport: true
|
|
244
|
+
}
|
|
245
|
+
],
|
|
246
|
+
"object-shorthand": [
|
|
247
|
+
2,
|
|
248
|
+
"always",
|
|
249
|
+
{
|
|
250
|
+
avoidExplicitReturnArrows: true,
|
|
251
|
+
avoidQuotes: true,
|
|
252
|
+
ignoreConstructors: true,
|
|
253
|
+
methodsIgnorePattern: ""
|
|
254
|
+
}
|
|
255
|
+
],
|
|
256
|
+
...disabledRules
|
|
192
257
|
},
|
|
193
|
-
linterOptions: {
|
|
258
|
+
linterOptions: {
|
|
259
|
+
reportUnusedDisableDirectives: 2
|
|
260
|
+
}
|
|
194
261
|
},
|
|
195
262
|
{
|
|
196
|
-
name:
|
|
197
|
-
files: ["**/*.
|
|
198
|
-
languageOptions: {
|
|
263
|
+
name: `${packageName}/commonjs-files`,
|
|
264
|
+
files: ["**/*.cjs"],
|
|
265
|
+
languageOptions: {
|
|
266
|
+
sourceType: "commonjs"
|
|
267
|
+
},
|
|
199
268
|
rules: {
|
|
200
269
|
"@typescript-eslint/no-require-imports": [
|
|
201
270
|
0,
|
|
202
|
-
|
|
271
|
+
{
|
|
272
|
+
allow: [],
|
|
273
|
+
allowAsImport: false
|
|
274
|
+
}
|
|
203
275
|
]
|
|
204
276
|
}
|
|
205
|
-
}
|
|
277
|
+
},
|
|
278
|
+
prettierConfig
|
|
206
279
|
);
|
|
280
|
+
|
|
281
|
+
// src/utils.ts
|
|
207
282
|
var createESLintConfig = (additionalOverrides = []) => /* @__PURE__ */ config(...flatESLintConfig, ...additionalOverrides);
|
|
208
283
|
export {
|
|
284
|
+
config,
|
|
285
|
+
configs,
|
|
209
286
|
createESLintConfig,
|
|
287
|
+
disabledRules,
|
|
210
288
|
flatESLintConfig,
|
|
211
289
|
globalIgnores,
|
|
212
290
|
globals,
|
|
213
|
-
|
|
291
|
+
js,
|
|
292
|
+
parser,
|
|
293
|
+
plugin,
|
|
294
|
+
prettierConfig,
|
|
214
295
|
vitestGlobals
|
|
215
296
|
};
|
|
216
297
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import js from '@eslint/js'\nimport type { TSESLint } from '@typescript-eslint/utils'\nimport type { Linter } from 'eslint'\nimport prettierConfig from 'eslint-config-prettier'\nimport globalIdentifiers from 'globals'\nimport type { ConfigWithExtends } from 'typescript-eslint'\nimport { config, configs, parser } from 'typescript-eslint'\n\nconst { browser, node, nodeBuiltin } = globalIdentifiers\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 name: '@aryaemami59/global-ignores',\n ignores: [\n '**/dist/',\n '**/.yalc/',\n '**/build/',\n '**/lib/',\n '**/temp/',\n '**/.yarn/',\n '**/coverage/',\n ],\n} as const satisfies Linter.Config\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 suite: 'writable',\n test: 'writable',\n describe: 'writable',\n it: 'writable',\n expectTypeOf: 'writable',\n assertType: 'writable',\n expect: 'writable',\n assert: 'writable',\n vitest: 'writable',\n vi: 'writable',\n beforeAll: 'writable',\n afterAll: 'writable',\n beforeEach: 'writable',\n afterEach: 'writable',\n onTestFailed: 'writable',\n onTestFinished: 'writable',\n} as const satisfies Linter.Globals\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: typeof vitestGlobals &\n typeof browser &\n typeof node &\n typeof nodeBuiltin = /* @__PURE__ */ Object.assign(\n vitestGlobals,\n browser,\n node,\n nodeBuiltin,\n) satisfies Linter.Globals\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 rulesToDisable = {\n 'no-undef': [0],\n '@typescript-eslint/no-unused-vars': [\n 0,\n {\n vars: 'all',\n args: 'after-used',\n caughtErrors: 'all',\n ignoreRestSiblings: false,\n reportUsedIgnorePattern: false,\n },\n ],\n '@typescript-eslint/ban-ts-comment': [\n 0,\n [\n {\n 'ts-expect-error': 'allow-with-description',\n 'ts-ignore': true,\n 'ts-nocheck': true,\n 'ts-check': false,\n minimumDescriptionLength: 3,\n },\n ],\n ],\n} as const satisfies Linter.RulesRecord\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: TSESLint.FlatConfig.Config[] =\n /* @__PURE__ */ config(\n // `ignores` must be first.\n // config with just `ignores` is the replacement for `.eslintignore`\n globalIgnores,\n { name: '@aryaemami59/javascript', ...js.configs.recommended },\n ...configs.recommended,\n ...configs.stylistic,\n { name: '@aryaemami59/prettier-config', ...prettierConfig },\n {\n name: '@aryaemami59/main',\n languageOptions: {\n globals,\n parser,\n parserOptions: {\n projectService: {\n allowDefaultProject: ['.*.js', '.*.mjs', '.*.cjs'],\n defaultProject: './tsconfig.json',\n },\n ecmaVersion: 'latest',\n },\n },\n rules: {\n '@typescript-eslint/consistent-type-imports': [\n 2,\n {\n prefer: 'type-imports',\n fixStyle: 'separate-type-imports',\n disallowTypeAnnotations: true,\n },\n ],\n '@typescript-eslint/consistent-type-exports': [\n 2,\n { fixMixedExportsWithInlineTypeSpecifier: false },\n ],\n '@typescript-eslint/no-explicit-any': [\n 2,\n { fixToUnknown: false, ignoreRestArgs: false },\n ],\n '@typescript-eslint/no-empty-object-type': [\n 2,\n { allowInterfaces: 'never', allowObjectTypes: 'never' },\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-namespace': [\n 2,\n { allowDeclarations: false, allowDefinitionFiles: true },\n ],\n '@typescript-eslint/consistent-type-definitions': [2, 'type'],\n 'sort-imports': [\n 2,\n {\n ignoreCase: false,\n ignoreDeclarationSort: true,\n ignoreMemberSort: false,\n memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],\n allowSeparatedGroups: true,\n },\n ],\n '@typescript-eslint/unified-signatures': [2],\n '@typescript-eslint/dot-notation': [\n 2,\n {\n // Related issue: https://github.com/typescript-eslint/typescript-eslint/issues/10338\n // Base ESLint default options\n allowKeywords: true,\n allowPattern: '',\n // TypeScript ESLint default options\n allowPrivateClassPropertyAccess: false,\n allowProtectedClassPropertyAccess: false,\n allowIndexSignaturePropertyAccess: false,\n },\n ],\n '@typescript-eslint/no-unnecessary-type-parameters': [2],\n '@typescript-eslint/no-invalid-void-type': [2],\n '@typescript-eslint/no-confusing-void-expression': [2],\n '@typescript-eslint/no-duplicate-type-constituents': [2],\n '@typescript-eslint/require-await': [2],\n '@typescript-eslint/no-redundant-type-constituents': [2],\n '@typescript-eslint/no-unnecessary-type-arguments': [2],\n '@typescript-eslint/no-unnecessary-type-assertion': [2],\n '@typescript-eslint/prefer-nullish-coalescing': [2],\n '@typescript-eslint/no-inferrable-types': [2],\n '@typescript-eslint/no-empty-function': [\n 2,\n {\n // Related issue: https://github.com/typescript-eslint/typescript-eslint/issues/10338\n // Base ESLint default options\n allow: [],\n },\n ],\n '@typescript-eslint/no-unused-expressions': [\n 2,\n {\n // Related issue: https://github.com/typescript-eslint/typescript-eslint/issues/10338\n // Base ESLint default options\n allowShortCircuit: false,\n allowTernary: false,\n allowTaggedTemplates: false,\n enforceForJSX: false,\n },\n ],\n 'object-shorthand': [2],\n ...rulesToDisable,\n },\n linterOptions: { reportUnusedDisableDirectives: 2 },\n },\n {\n name: '@aryaemami59/commonjs',\n files: ['**/*.c[jt]s'],\n languageOptions: { sourceType: 'commonjs' },\n rules: {\n '@typescript-eslint/no-require-imports': [\n 0,\n [{ allow: [], allowAsImport: false }],\n ],\n },\n },\n )\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: ConfigWithExtends[] = [],\n): TSESLint.FlatConfig.Config[] =>\n /* @__PURE__ */ config(...flatESLintConfig, ...additionalOverrides)\n"],"mappings":";AAAA,OAAO,QAAQ;AAGf,OAAO,oBAAoB;AAC3B,OAAO,uBAAuB;AAE9B,SAAS,QAAQ,SAAS,cAAc;AAExC,IAAM,EAAE,SAAS,MAAM,YAAY,IAAI;AAUhC,IAAM,gBAAgB;AAAA,EAC3B,MAAM;AAAA,EACN,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAUO,IAAM,gBAAgB;AAAA,EAC3B,OAAO;AAAA,EACP,MAAM;AAAA,EACN,UAAU;AAAA,EAC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,CAAC;AAAA,MACtC,qDAAqD,CAAC,CAAC;AAAA,MACvD,oDAAoD,CAAC,CAAC;AAAA,MACtD,oDAAoD,CAAC,CAAC;AAAA,MACtD,gDAAgD,CAAC,CAAC;AAAA,MAClD,0CAA0C,CAAC,CAAC;AAAA,MAC5C,wCAAwC;AAAA,QACtC;AAAA,QACA;AAAA;AAAA;AAAA,UAGE,OAAO,CAAC;AAAA,QACV;AAAA,MACF;AAAA,MACA,4CAA4C;AAAA,QAC1C;AAAA,QACA;AAAA;AAAA;AAAA,UAGE,mBAAmB;AAAA,UACnB,cAAc;AAAA,UACd,sBAAsB;AAAA,UACtB,eAAe;AAAA,QACjB;AAAA,MACF;AAAA,MACA,oBAAoB,CAAC,CAAC;AAAA,MACtB,GAAG;AAAA,IACL;AAAA,IACA,eAAe,EAAE,+BAA+B,EAAE;AAAA,EACpD;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,OAAO,CAAC,aAAa;AAAA,IACrB,iBAAiB,EAAE,YAAY,WAAW;AAAA,IAC1C,OAAO;AAAA,MACL,yCAAyC;AAAA,QACvC;AAAA,QACA,CAAC,EAAE,OAAO,CAAC,GAAG,eAAe,MAAM,CAAC;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AACF;AAsFK,IAAM,qBAAqB,CAChC,sBAA2C,CAAC,MAE5B,uBAAO,GAAG,kBAAkB,GAAG,mBAAmB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/disabledRules.ts","../src/external.ts","../src/packageName.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 'no-undef': [0, { typeof: false }],\n '@typescript-eslint/no-unused-vars': [\n 0,\n {\n args: 'all',\n argsIgnorePattern: '^_',\n caughtErrors: 'all',\n caughtErrorsIgnorePattern: '^_',\n destructuredArrayIgnorePattern: '^_',\n varsIgnorePattern: '^_',\n ignoreRestSiblings: true,\n },\n ],\n '@typescript-eslint/ban-ts-comment': [\n 0,\n {\n 'ts-expect-error': 'allow-with-description',\n 'ts-ignore': true,\n 'ts-nocheck': true,\n 'ts-check': false,\n minimumDescriptionLength: 3,\n },\n ],\n} as const satisfies Linter.RulesRecord satisfies Record<\n keyof Linter.RulesRecord,\n [Extract<Linter.Severity, 0>, ...(readonly unknown[])]\n>\n","import js from '@eslint/js'\nimport prettierConfig from 'eslint-config-prettier/flat'\nexport { config, configs, parser, plugin } from 'typescript-eslint'\nexport type {\n Config,\n ConfigArray,\n ConfigWithExtends,\n InfiniteDepthConfigWithExtends,\n} from 'typescript-eslint'\nexport { js, prettierConfig }\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 packageName = '@aryaemami59/eslint-config'\n","import type { TSESLint } from '@typescript-eslint/utils'\nimport type { Linter } from 'eslint'\nimport { packageName } from './packageName.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 name: `${packageName}/global-ignores`,\n ignores: [\n '**/dist/',\n '**/build/',\n '**/lib/',\n '**/coverage/',\n '**/__snapshots__/',\n '**/temp/',\n '**/.temp/',\n '**/.tmp/',\n '**/.yalc/',\n '**/.yarn/',\n '**/.docusaurus/',\n '**/.next/',\n '**/.expo/',\n '**/*.snap',\n ],\n} as const satisfies TSESLint.FlatConfig.Config satisfies Linter.Config\n","import type { Linter } from 'eslint'\nimport globalIdentifiers from 'globals'\n\nconst { browser, node, nodeBuiltin, vitest } = globalIdentifiers\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 suite: 'writable',\n test: 'writable',\n chai: 'writable',\n describe: 'writable',\n it: 'writable',\n expectTypeOf: 'writable',\n assertType: 'writable',\n expect: 'writable',\n assert: 'writable',\n vitest: 'writable',\n vi: 'writable',\n beforeAll: 'writable',\n afterAll: 'writable',\n beforeEach: 'writable',\n afterEach: 'writable',\n onTestFailed: 'writable',\n onTestFinished: '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 { TSESLint } from '@typescript-eslint/utils'\nimport type { Linter } from 'eslint'\nimport { disabledRules } from './disabledRules.js'\nimport { config, configs, js, prettierConfig } from './external.js'\nimport { globalIgnores } from './globalIgnores.js'\nimport { globals } from './globals.js'\nimport { packageName } from './packageName.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: TSESLint.FlatConfig.Config[] =\n /* @__PURE__ */ config(\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 TSESLint.FlatConfig.Config satisfies Linter.Config,\n\n configs.recommended,\n configs.stylistic,\n\n {\n name: `${packageName}/defaults/overrides`,\n languageOptions: {\n globals,\n parserOptions: {\n ecmaVersion: 'latest',\n projectService: true,\n },\n },\n rules: {\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/consistent-type-exports': [\n 2,\n { fixMixedExportsWithInlineTypeSpecifier: false },\n ],\n '@typescript-eslint/no-explicit-any': [\n 2,\n {\n fixToUnknown: false,\n ignoreRestArgs: 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-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-namespace': [\n 2,\n {\n allowDeclarations: false,\n allowDefinitionFiles: true,\n },\n ],\n '@typescript-eslint/consistent-type-definitions': [2, 'type'],\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 '@typescript-eslint/unified-signatures': [\n 2,\n {\n ignoreDifferentlyNamedParameters: false,\n ignoreOverloadsWithDifferentJSDoc: false,\n },\n ],\n '@typescript-eslint/no-unnecessary-type-parameters': [2],\n '@typescript-eslint/no-invalid-void-type': [\n 2,\n {\n allowAsThisParameter: false,\n allowInGenericTypeArguments: true,\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/require-await': [2],\n '@typescript-eslint/no-redundant-type-constituents': [2],\n '@typescript-eslint/no-unnecessary-type-arguments': [2],\n '@typescript-eslint/no-unnecessary-type-assertion': [\n 2,\n { typesToIgnore: [] },\n ],\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/no-inferrable-types': [\n 2,\n {\n ignoreParameters: false,\n ignoreProperties: false,\n },\n ],\n '@typescript-eslint/no-require-imports': [\n 2,\n {\n allow: [],\n allowAsImport: true,\n },\n ],\n 'object-shorthand': [\n 2,\n 'always',\n {\n avoidExplicitReturnArrows: true,\n avoidQuotes: true,\n ignoreConstructors: true,\n methodsIgnorePattern: '',\n },\n ],\n\n ...disabledRules,\n },\n\n linterOptions: {\n reportUnusedDisableDirectives: 2,\n },\n } as const satisfies TSESLint.FlatConfig.Config satisfies Linter.Config,\n\n {\n name: `${packageName}/commonjs-files`,\n files: ['**/*.cjs'],\n languageOptions: {\n sourceType: 'commonjs',\n },\n rules: {\n '@typescript-eslint/no-require-imports': [\n 0,\n {\n allow: [],\n allowAsImport: false,\n },\n ],\n },\n } as const satisfies TSESLint.FlatConfig.Config satisfies Linter.Config,\n\n prettierConfig,\n )\n","import type { TSESLint } from '@typescript-eslint/utils'\nimport type { ConfigWithExtends } from './external.js'\nimport { config } 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: ConfigWithExtends[] = [],\n): TSESLint.FlatConfig.Config[] =>\n /* @__PURE__ */ config(...flatESLintConfig, ...additionalOverrides)\n"],"mappings":";AASO,IAAM,gBAAgB;AAAA,EAC3B,YAAY,CAAC,GAAG,EAAE,QAAQ,MAAM,CAAC;AAAA,EACjC,qCAAqC;AAAA,IACnC;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,mBAAmB;AAAA,MACnB,cAAc;AAAA,MACd,2BAA2B;AAAA,MAC3B,gCAAgC;AAAA,MAChC,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,IACtB;AAAA,EACF;AAAA,EACA,qCAAqC;AAAA,IACnC;AAAA,IACA;AAAA,MACE,mBAAmB;AAAA,MACnB,aAAa;AAAA,MACb,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,0BAA0B;AAAA,IAC5B;AAAA,EACF;AACF;;;ACjCA,OAAO,QAAQ;AACf,OAAO,oBAAoB;AAC3B,SAAS,QAAQ,SAAS,QAAQ,cAAc;;;ACMzC,IAAM,cAAc;;;ACIpB,IAAM,gBAAgB;AAAA,EAC3B,MAAM,GAAG,WAAW;AAAA,EACpB,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAC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;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aryaemami59/eslint-config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "ESLint configuration for TypeScript projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -55,28 +55,32 @@
|
|
|
55
55
|
"src"
|
|
56
56
|
],
|
|
57
57
|
"scripts": {
|
|
58
|
-
"build": "
|
|
59
|
-
"check-exports": "attw --pack",
|
|
60
|
-
"check-package-json": "publint --strict
|
|
61
|
-
"clean": "rimraf dist",
|
|
62
|
-
"
|
|
58
|
+
"build": "tsup --config=$INIT_CWD/tsup.config.mts",
|
|
59
|
+
"check-exports": "attw --pack $INIT_CWD",
|
|
60
|
+
"check-package-json": "publint --strict $INIT_CWD",
|
|
61
|
+
"clean": "rimraf $INIT_CWD/dist/",
|
|
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 clean && yarn build",
|
|
67
|
+
"test-types": "tsc -p $INIT_CWD/tsconfig.json"
|
|
63
68
|
},
|
|
64
69
|
"dependencies": {
|
|
65
|
-
"@eslint/js": "^9.
|
|
66
|
-
"@typescript-eslint/utils": "^8.
|
|
67
|
-
"eslint-config-prettier": "^
|
|
68
|
-
"globals": "^
|
|
69
|
-
"typescript-eslint": "^8.
|
|
70
|
+
"@eslint/js": "^9.27.0",
|
|
71
|
+
"@typescript-eslint/utils": "^8.32.1",
|
|
72
|
+
"eslint-config-prettier": "^10.1.5",
|
|
73
|
+
"globals": "^16.1.0",
|
|
74
|
+
"typescript-eslint": "^8.32.1"
|
|
70
75
|
},
|
|
71
76
|
"devDependencies": {
|
|
72
|
-
"@arethetypeswrong/cli": "^0.
|
|
73
|
-
"@aryaemami59/tsconfig": "^0.0.
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"publint": "^0.2.12",
|
|
77
|
+
"@arethetypeswrong/cli": "^0.18.1",
|
|
78
|
+
"@aryaemami59/tsconfig": "^0.0.5",
|
|
79
|
+
"eslint": "^9.27.0",
|
|
80
|
+
"publint": "^0.3.12",
|
|
77
81
|
"rimraf": "^6.0.1",
|
|
78
|
-
"tsup": "^8.
|
|
79
|
-
"typescript": "^5.
|
|
82
|
+
"tsup": "^8.5.0",
|
|
83
|
+
"typescript": "^5.8.3"
|
|
80
84
|
},
|
|
81
85
|
"peerDependencies": {
|
|
82
86
|
"eslint": ">=8.56.0",
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
'no-undef': [0, { typeof: false }],
|
|
12
|
+
'@typescript-eslint/no-unused-vars': [
|
|
13
|
+
0,
|
|
14
|
+
{
|
|
15
|
+
args: 'all',
|
|
16
|
+
argsIgnorePattern: '^_',
|
|
17
|
+
caughtErrors: 'all',
|
|
18
|
+
caughtErrorsIgnorePattern: '^_',
|
|
19
|
+
destructuredArrayIgnorePattern: '^_',
|
|
20
|
+
varsIgnorePattern: '^_',
|
|
21
|
+
ignoreRestSiblings: true,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
'@typescript-eslint/ban-ts-comment': [
|
|
25
|
+
0,
|
|
26
|
+
{
|
|
27
|
+
'ts-expect-error': 'allow-with-description',
|
|
28
|
+
'ts-ignore': true,
|
|
29
|
+
'ts-nocheck': true,
|
|
30
|
+
'ts-check': false,
|
|
31
|
+
minimumDescriptionLength: 3,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
} as const satisfies Linter.RulesRecord satisfies Record<
|
|
35
|
+
keyof Linter.RulesRecord,
|
|
36
|
+
[Extract<Linter.Severity, 0>, ...(readonly unknown[])]
|
|
37
|
+
>
|
package/src/external.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import prettierConfig from 'eslint-config-prettier/flat'
|
|
3
|
+
export { config, configs, parser, plugin } from 'typescript-eslint'
|
|
4
|
+
export type {
|
|
5
|
+
Config,
|
|
6
|
+
ConfigArray,
|
|
7
|
+
ConfigWithExtends,
|
|
8
|
+
InfiniteDepthConfigWithExtends,
|
|
9
|
+
} from 'typescript-eslint'
|
|
10
|
+
export { js, prettierConfig }
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/utils'
|
|
2
|
+
import type { Linter } from 'eslint'
|
|
3
|
+
import { packageName } from './packageName.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An object representing
|
|
7
|
+
* {@link https://eslint.org/docs/latest/use/configure/ignore#ignoring-files | **global ignore patterns**}
|
|
8
|
+
* for ESLint configuration.
|
|
9
|
+
*
|
|
10
|
+
* @since 0.0.3
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export const globalIgnores = {
|
|
14
|
+
name: `${packageName}/global-ignores`,
|
|
15
|
+
ignores: [
|
|
16
|
+
'**/dist/',
|
|
17
|
+
'**/build/',
|
|
18
|
+
'**/lib/',
|
|
19
|
+
'**/coverage/',
|
|
20
|
+
'**/__snapshots__/',
|
|
21
|
+
'**/temp/',
|
|
22
|
+
'**/.temp/',
|
|
23
|
+
'**/.tmp/',
|
|
24
|
+
'**/.yalc/',
|
|
25
|
+
'**/.yarn/',
|
|
26
|
+
'**/.docusaurus/',
|
|
27
|
+
'**/.next/',
|
|
28
|
+
'**/.expo/',
|
|
29
|
+
'**/*.snap',
|
|
30
|
+
],
|
|
31
|
+
} as const satisfies TSESLint.FlatConfig.Config satisfies Linter.Config
|
package/src/globals.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Linter } from 'eslint'
|
|
2
|
+
import globalIdentifiers from 'globals'
|
|
3
|
+
|
|
4
|
+
const { browser, node, nodeBuiltin, vitest } = globalIdentifiers
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* An object representing the
|
|
8
|
+
* {@link https://vitest.dev/config/#globals | globals} provided by
|
|
9
|
+
* {@link https://vitest.dev | **Vitest**} for use in testing.
|
|
10
|
+
*
|
|
11
|
+
* @since 0.0.3
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export const vitestGlobals = {
|
|
15
|
+
suite: 'writable',
|
|
16
|
+
test: 'writable',
|
|
17
|
+
chai: 'writable',
|
|
18
|
+
describe: 'writable',
|
|
19
|
+
it: 'writable',
|
|
20
|
+
expectTypeOf: 'writable',
|
|
21
|
+
assertType: 'writable',
|
|
22
|
+
expect: 'writable',
|
|
23
|
+
assert: 'writable',
|
|
24
|
+
vitest: 'writable',
|
|
25
|
+
vi: 'writable',
|
|
26
|
+
beforeAll: 'writable',
|
|
27
|
+
afterAll: 'writable',
|
|
28
|
+
beforeEach: 'writable',
|
|
29
|
+
afterEach: 'writable',
|
|
30
|
+
onTestFailed: 'writable',
|
|
31
|
+
onTestFinished: 'writable',
|
|
32
|
+
} as const satisfies Linter.Globals satisfies Record<
|
|
33
|
+
keyof typeof vitest,
|
|
34
|
+
Extract<Linter.GlobalConf, 'writable'>
|
|
35
|
+
>
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* An object that specifies which global
|
|
39
|
+
* variables are available during linting.
|
|
40
|
+
*
|
|
41
|
+
* @since 0.0.3
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export const globals =
|
|
45
|
+
/* @__PURE__ */
|
|
46
|
+
Object.assign(
|
|
47
|
+
{
|
|
48
|
+
...browser,
|
|
49
|
+
...node,
|
|
50
|
+
...nodeBuiltin,
|
|
51
|
+
} as const satisfies Linter.Globals,
|
|
52
|
+
|
|
53
|
+
{
|
|
54
|
+
...vitest,
|
|
55
|
+
...vitestGlobals,
|
|
56
|
+
} as const satisfies Linter.Globals,
|
|
57
|
+
) satisfies Linter.Globals
|