eslint-config-complete 1.1.0 → 1.2.1
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/package.json +16 -3
- package/src/{baseConfigs → base}/base-eslint.js +16 -4
- package/src/{baseConfigs → base}/base-import-x.js +31 -19
- package/src/{baseConfigs → base}/base-typescript-eslint.js +1 -0
- package/src/{baseConfigs → base}/base-unicorn.js +8 -2
- package/src/base.js +11 -10
- package/src/monorepo.js +10 -25
- /package/src/{baseConfigs → base}/base-jsdoc.js +0 -0
- /package/src/{baseConfigs → base}/base-n.js +0 -0
- /package/src/{baseConfigs → base}/base-stylistic.js +0 -0
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright The Complete Contributors
|
|
3
|
+
Copyright (c) 2024 The Complete Contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-complete",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "A sharable ESLint config for TypeScript projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -29,10 +29,11 @@
|
|
|
29
29
|
"src"
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
|
+
"docs": "tsx ./scripts/docs.ts",
|
|
32
33
|
"lint": "tsx ./scripts/lint.ts"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@stylistic/eslint-plugin": "^2.
|
|
36
|
+
"@stylistic/eslint-plugin": "^2.8.0",
|
|
36
37
|
"confusing-browser-globals": "^1.0.11",
|
|
37
38
|
"eslint-import-resolver-typescript": "^3.6.3",
|
|
38
39
|
"eslint-plugin-complete": "^1.0.0",
|
|
@@ -40,6 +41,18 @@
|
|
|
40
41
|
"eslint-plugin-jsdoc": "^50.2.2",
|
|
41
42
|
"eslint-plugin-n": "^17.10.2",
|
|
42
43
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
43
|
-
"typescript-eslint": "^8.
|
|
44
|
+
"typescript-eslint": "^8.5.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@eslint/js": "^9.10.0",
|
|
48
|
+
"@types/confusing-browser-globals": "^1.0.3",
|
|
49
|
+
"@types/eslint-config-prettier": "^6.11.3",
|
|
50
|
+
"@types/eslint__js": "^8.42.3",
|
|
51
|
+
"@types/node": "^22.5.4",
|
|
52
|
+
"complete-common": "^1.0.0",
|
|
53
|
+
"complete-node": "^1.3.0",
|
|
54
|
+
"eslint-config-prettier": "^9.1.0",
|
|
55
|
+
"extract-comments": "^1.1.0",
|
|
56
|
+
"typescript": "5.5.4"
|
|
44
57
|
}
|
|
45
58
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import confusingBrowserGlobals from "confusing-browser-globals";
|
|
2
2
|
import tseslint from "typescript-eslint";
|
|
3
3
|
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* @see https://eslint.org/docs/latest/rules/#possible-problems
|
|
6
|
+
* @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
|
|
7
|
+
*/
|
|
5
8
|
const POSSIBLE_PROBLEMS = {
|
|
6
9
|
/** The `checkForEach` option is enabled to make the rule stricter. */
|
|
7
10
|
"array-callback-return": [
|
|
@@ -87,7 +90,10 @@ const POSSIBLE_PROBLEMS = {
|
|
|
87
90
|
"valid-typeof": "warn",
|
|
88
91
|
};
|
|
89
92
|
|
|
90
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* @see https://eslint.org/docs/latest/rules/#suggestions
|
|
95
|
+
* @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
|
|
96
|
+
*/
|
|
91
97
|
const SUGGESTIONS = {
|
|
92
98
|
"accessor-pairs": "warn",
|
|
93
99
|
"arrow-body-style": "warn",
|
|
@@ -627,12 +633,18 @@ const SUGGESTIONS = {
|
|
|
627
633
|
yoda: "warn",
|
|
628
634
|
};
|
|
629
635
|
|
|
630
|
-
/**
|
|
636
|
+
/**
|
|
637
|
+
* @see https://eslint.org/docs/latest/rules/#suggestions
|
|
638
|
+
* @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
|
|
639
|
+
*/
|
|
631
640
|
const LAYOUT_AND_FORMATTING = {
|
|
632
641
|
"unicode-bom": "warn",
|
|
633
642
|
};
|
|
634
643
|
|
|
635
|
-
/**
|
|
644
|
+
/**
|
|
645
|
+
* @see https://eslint.org/docs/latest/rules/#deprecated
|
|
646
|
+
* @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
|
|
647
|
+
*/
|
|
636
648
|
const DEPRECATED = {
|
|
637
649
|
/** Disabled since the rule is deprecated. */
|
|
638
650
|
"array-bracket-newline": "off",
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import ESLintPluginImportX from "eslint-plugin-import-x";
|
|
2
2
|
import tseslint from "typescript-eslint";
|
|
3
3
|
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/README.md#helpful-warnings
|
|
6
|
+
* @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
|
|
7
|
+
*/
|
|
5
8
|
const HELPFUL_WARNINGS = {
|
|
6
9
|
"import-x/export": "warn",
|
|
7
10
|
|
|
@@ -13,16 +16,13 @@ const HELPFUL_WARNINGS = {
|
|
|
13
16
|
|
|
14
17
|
"import-x/no-empty-named-blocks": "warn",
|
|
15
18
|
|
|
16
|
-
/**
|
|
17
|
-
* The options are [copied from
|
|
18
|
-
* Airbnb](https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/import.js).
|
|
19
|
-
*
|
|
20
|
-
* We also add a "scripts" directory entry for "devDependencies".
|
|
21
|
-
*/
|
|
19
|
+
/** We add common patterns to the "devDependencies" array. */
|
|
22
20
|
"import-x/no-extraneous-dependencies": [
|
|
23
21
|
"warn",
|
|
24
22
|
{
|
|
25
23
|
devDependencies: [
|
|
24
|
+
// From:
|
|
25
|
+
// https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/imports.js
|
|
26
26
|
"test/**", // tape, common npm pattern
|
|
27
27
|
"tests/**", // also common npm pattern
|
|
28
28
|
"spec/**", // mocha, rspec-like pattern
|
|
@@ -31,8 +31,8 @@ const HELPFUL_WARNINGS = {
|
|
|
31
31
|
"test.{js,jsx}", // repos with a single test file
|
|
32
32
|
"test-*.{js,jsx}", // repos with multiple top-level test files
|
|
33
33
|
"**/*{.,_}{test,spec}.{js,jsx}", // tests where the extension or filename suffix denotes that it is a test
|
|
34
|
-
"**/jest.config.js", // jest config
|
|
35
|
-
"**/jest.setup.js", // jest setup
|
|
34
|
+
"**/jest.config.{js,cjs,mjs,ts,cts,mts}", // jest config // Modified for extra file extensions.
|
|
35
|
+
"**/jest.setup.{js,cjs,mjs,ts,cts,mts}", // jest setup // Modified for extra file extensions.
|
|
36
36
|
"**/vue.config.js", // vue-cli config
|
|
37
37
|
"**/webpack.config.js", // webpack config
|
|
38
38
|
"**/webpack.config.*.js", // webpack config
|
|
@@ -44,9 +44,12 @@ const HELPFUL_WARNINGS = {
|
|
|
44
44
|
"**/protractor.conf.js", // protractor config
|
|
45
45
|
"**/protractor.conf.*.js", // protractor config
|
|
46
46
|
"**/karma.conf.js", // karma config
|
|
47
|
-
"**/.eslintrc.js", // eslint config
|
|
47
|
+
"**/.eslintrc.{js,cjs,mjs,ts,cts,mts}", // eslint config // Modified for extra file extensions.
|
|
48
48
|
|
|
49
49
|
"**/scripts/*.{js,cjs,mjs,ts,cts,mts}", // Files inside of a "scripts" directory.
|
|
50
|
+
"**/tests/*.{js,cjs,mjs,ts,cts,mts}", // Files inside of a "tests" directory.
|
|
51
|
+
"**/eslint.config.{js,cjs,mjs,ts,cts,mts}", // ESLint config
|
|
52
|
+
"**/prettier.config.{js,cjs,mjs,ts,cts,mts}", // Prettier config
|
|
50
53
|
],
|
|
51
54
|
optionalDependencies: false,
|
|
52
55
|
},
|
|
@@ -61,6 +64,12 @@ const HELPFUL_WARNINGS = {
|
|
|
61
64
|
*/
|
|
62
65
|
"import-x/no-named-as-default-member": "off",
|
|
63
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Temporarily disabled due to [false
|
|
69
|
+
* positives](https://github.com/un-ts/eslint-plugin-import-x/pull/157).
|
|
70
|
+
*/
|
|
71
|
+
"import-x/no-rename-default": "off",
|
|
72
|
+
|
|
64
73
|
/**
|
|
65
74
|
* Disabled since this check is better performed by the [`knip`](https://github.com/webpro/knip)
|
|
66
75
|
* tool.
|
|
@@ -68,7 +77,10 @@ const HELPFUL_WARNINGS = {
|
|
|
68
77
|
"import-x/no-unused-modules": "off",
|
|
69
78
|
};
|
|
70
79
|
|
|
71
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/README.md#module-systems
|
|
82
|
+
* @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
|
|
83
|
+
*/
|
|
72
84
|
const MODULE_SYSTEMS = {
|
|
73
85
|
"import-x/no-amd": "warn",
|
|
74
86
|
"import-x/no-commonjs": "warn",
|
|
@@ -81,7 +93,10 @@ const MODULE_SYSTEMS = {
|
|
|
81
93
|
"import-x/unambiguous": "off",
|
|
82
94
|
};
|
|
83
95
|
|
|
84
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/README.md#static-analysis
|
|
98
|
+
* @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
|
|
99
|
+
*/
|
|
85
100
|
const STATIC_ANALYSIS = {
|
|
86
101
|
/**
|
|
87
102
|
* Disabled because this is [already handled by the TypeScript
|
|
@@ -130,7 +145,10 @@ const STATIC_ANALYSIS = {
|
|
|
130
145
|
"import-x/no-webpack-loader-syntax": "warn",
|
|
131
146
|
};
|
|
132
147
|
|
|
133
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/README.md#style-guide
|
|
150
|
+
* @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
|
|
151
|
+
*/
|
|
134
152
|
const STYLE_GUIDE = {
|
|
135
153
|
"import-x/consistent-type-specifier-style": "warn",
|
|
136
154
|
|
|
@@ -235,9 +253,6 @@ export const baseImportX = tseslint.config(
|
|
|
235
253
|
// https://github.com/un-ts/eslint-plugin-import-x/issues/150
|
|
236
254
|
// - Second, we extend the upstream TypeScript configuration:
|
|
237
255
|
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/src/config/typescript.ts
|
|
238
|
-
// - Third, we need to specify "typescript: true" under the resolver, as documented here:
|
|
239
|
-
// https://github.com/un-ts/eslint-plugin-import-x/issues/29
|
|
240
|
-
// (Otherwise, the "no-cycle" rule will not work.)
|
|
241
256
|
settings: {
|
|
242
257
|
"import-x/extensions": ALL_EXTENSIONS,
|
|
243
258
|
"import-x/external-module-folders": [
|
|
@@ -249,9 +264,6 @@ export const baseImportX = tseslint.config(
|
|
|
249
264
|
},
|
|
250
265
|
"import-x/resolver": {
|
|
251
266
|
typescript: true,
|
|
252
|
-
node: {
|
|
253
|
-
extensions: ALL_EXTENSIONS,
|
|
254
|
-
},
|
|
255
267
|
},
|
|
256
268
|
},
|
|
257
269
|
|
|
@@ -140,6 +140,7 @@ export const baseTypeScriptESLint = tseslint.config(
|
|
|
140
140
|
"@typescript-eslint/no-base-to-string": "warn",
|
|
141
141
|
"@typescript-eslint/no-confusing-non-null-assertion": "warn",
|
|
142
142
|
"@typescript-eslint/no-confusing-void-expression": "warn",
|
|
143
|
+
"@typescript-eslint/no-deprecated": "warn",
|
|
143
144
|
"@typescript-eslint/no-duplicate-enum-values": "warn",
|
|
144
145
|
"@typescript-eslint/no-duplicate-type-constituents": "warn",
|
|
145
146
|
"@typescript-eslint/no-dynamic-delete": "warn",
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import ESLintPluginUnicorn from "eslint-plugin-unicorn";
|
|
2
2
|
import tseslint from "typescript-eslint";
|
|
3
3
|
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/readme.md#rules
|
|
6
|
+
* @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
|
|
7
|
+
*/
|
|
5
8
|
const NORMAL_RULES = {
|
|
6
9
|
"unicorn/better-regex": "warn",
|
|
7
10
|
"unicorn/catch-error-name": "warn",
|
|
@@ -166,7 +169,10 @@ const NORMAL_RULES = {
|
|
|
166
169
|
"unicorn/throw-new-error": "warn",
|
|
167
170
|
};
|
|
168
171
|
|
|
169
|
-
/**
|
|
172
|
+
/**
|
|
173
|
+
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/deprecated-rules.md
|
|
174
|
+
* @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
|
|
175
|
+
*/
|
|
170
176
|
const DEPRECATED_RULES = {
|
|
171
177
|
/** Disabled because this rule is deprecated. */
|
|
172
178
|
"unicorn/import-index": "off",
|
package/src/base.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import ESLintPluginComplete from "eslint-plugin-complete";
|
|
2
2
|
import tseslint from "typescript-eslint";
|
|
3
|
-
import { baseESLint } from "./
|
|
4
|
-
import { baseImportX } from "./
|
|
5
|
-
import { baseJSDoc } from "./
|
|
6
|
-
import { baseN } from "./
|
|
7
|
-
import { baseStylistic } from "./
|
|
8
|
-
import { baseTypeScriptESLint } from "./
|
|
9
|
-
import { baseUnicorn } from "./
|
|
3
|
+
import { baseESLint } from "./base/base-eslint.js";
|
|
4
|
+
import { baseImportX } from "./base/base-import-x.js";
|
|
5
|
+
import { baseJSDoc } from "./base/base-jsdoc.js";
|
|
6
|
+
import { baseN } from "./base/base-n.js";
|
|
7
|
+
import { baseStylistic } from "./base/base-stylistic.js";
|
|
8
|
+
import { baseTypeScriptESLint } from "./base/base-typescript-eslint.js";
|
|
9
|
+
import { baseUnicorn } from "./base/base-unicorn.js";
|
|
10
10
|
|
|
11
11
|
// Hot-patch "eslint-plugin-complete" to convert errors to warnings.
|
|
12
12
|
for (const config of ESLintPluginComplete.configs.recommended) {
|
|
@@ -49,8 +49,9 @@ export const completeConfigBase = tseslint.config(
|
|
|
49
49
|
{
|
|
50
50
|
// By default, ESLint ignores "**/node_modules/" and ".git/":
|
|
51
51
|
// https://eslint.org/docs/latest/use/configure/ignore#ignoring-files
|
|
52
|
-
// We also ignore want to ignore
|
|
53
|
-
// compiled output in TypeScript.
|
|
54
|
-
|
|
52
|
+
// We also ignore want to ignore:
|
|
53
|
+
// - The "dist" directory since it is the idiomatic place for compiled output in TypeScript.
|
|
54
|
+
// - Minified files.
|
|
55
|
+
ignores: ["**/dist/", "*.min.js"],
|
|
55
56
|
},
|
|
56
57
|
);
|
package/src/monorepo.js
CHANGED
|
@@ -4,30 +4,15 @@ import tseslint from "typescript-eslint";
|
|
|
4
4
|
* This ESLint config is meant to be used in monorepos that install dependencies at the root (in
|
|
5
5
|
* addition to the `completeBase` config).
|
|
6
6
|
*/
|
|
7
|
-
export const completeConfigMonorepo = tseslint.config(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"import-x/no-extraneous-dependencies": "off",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
{
|
|
18
|
-
files: ["eslint.config.mjs"],
|
|
19
|
-
rules: {
|
|
20
|
-
// ESLint configs in monorepos often intentionally import from the "src" subdirectory (because
|
|
21
|
-
// the config files are JavaScript so they cannot use tsconfig-paths).
|
|
22
|
-
"@typescript-eslint/no-restricted-imports": "off",
|
|
23
|
-
|
|
24
|
-
// ESLint configs in monorepos often intentionally import from the "packages" subdirectory
|
|
25
|
-
// (because the config files are JavaScript so they cannot use tsconfig-paths).
|
|
26
|
-
"import-x/no-relative-packages": "off",
|
|
7
|
+
export const completeConfigMonorepo = tseslint.config({
|
|
8
|
+
files: ["eslint.config.mjs"],
|
|
9
|
+
rules: {
|
|
10
|
+
// ESLint configs in monorepos often intentionally import from the "src" subdirectory (because
|
|
11
|
+
// the config files are JavaScript so they cannot use tsconfig-paths).
|
|
12
|
+
"@typescript-eslint/no-restricted-imports": "off",
|
|
27
13
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
14
|
+
// ESLint configs in monorepos often intentionally import from the "packages" subdirectory
|
|
15
|
+
// (because the config files are JavaScript so they cannot use tsconfig-paths).
|
|
16
|
+
"import-x/no-relative-packages": "off",
|
|
32
17
|
},
|
|
33
|
-
);
|
|
18
|
+
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|