eslint-config-complete 1.2.0 → 1.2.2

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 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.2.0",
3
+ "version": "1.2.2",
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.7.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.4.0"
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
- /** @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>} */
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
- /** @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>} */
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
- /** @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>} */
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
- /** @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>} */
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
- /** @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>} */
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,14 @@ 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
53
+ "**/typedoc.config.{js,cjs,mjs,ts,cts,mts}", // TypeDoc config
54
+ "**/typedoc.config.*.{js,cjs,mjs,ts,cts,mts}", // TypeDoc config
50
55
  ],
51
56
  optionalDependencies: false,
52
57
  },
@@ -61,6 +66,12 @@ const HELPFUL_WARNINGS = {
61
66
  */
62
67
  "import-x/no-named-as-default-member": "off",
63
68
 
69
+ /**
70
+ * Temporarily disabled due to [false
71
+ * positives](https://github.com/un-ts/eslint-plugin-import-x/pull/157).
72
+ */
73
+ "import-x/no-rename-default": "off",
74
+
64
75
  /**
65
76
  * Disabled since this check is better performed by the [`knip`](https://github.com/webpro/knip)
66
77
  * tool.
@@ -68,7 +79,10 @@ const HELPFUL_WARNINGS = {
68
79
  "import-x/no-unused-modules": "off",
69
80
  };
70
81
 
71
- /** @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>} */
82
+ /**
83
+ * @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/README.md#module-systems
84
+ * @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
85
+ */
72
86
  const MODULE_SYSTEMS = {
73
87
  "import-x/no-amd": "warn",
74
88
  "import-x/no-commonjs": "warn",
@@ -81,7 +95,10 @@ const MODULE_SYSTEMS = {
81
95
  "import-x/unambiguous": "off",
82
96
  };
83
97
 
84
- /** @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>} */
98
+ /**
99
+ * @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/README.md#static-analysis
100
+ * @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
101
+ */
85
102
  const STATIC_ANALYSIS = {
86
103
  /**
87
104
  * Disabled because this is [already handled by the TypeScript
@@ -130,7 +147,10 @@ const STATIC_ANALYSIS = {
130
147
  "import-x/no-webpack-loader-syntax": "warn",
131
148
  };
132
149
 
133
- /** @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>} */
150
+ /**
151
+ * @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/README.md#style-guide
152
+ * @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
153
+ */
134
154
  const STYLE_GUIDE = {
135
155
  "import-x/consistent-type-specifier-style": "warn",
136
156
 
@@ -235,9 +255,6 @@ export const baseImportX = tseslint.config(
235
255
  // https://github.com/un-ts/eslint-plugin-import-x/issues/150
236
256
  // - Second, we extend the upstream TypeScript configuration:
237
257
  // 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
258
  settings: {
242
259
  "import-x/extensions": ALL_EXTENSIONS,
243
260
  "import-x/external-module-folders": [
@@ -249,9 +266,6 @@ export const baseImportX = tseslint.config(
249
266
  },
250
267
  "import-x/resolver": {
251
268
  typescript: true,
252
- node: {
253
- extensions: ALL_EXTENSIONS,
254
- },
255
269
  },
256
270
  },
257
271
 
@@ -295,26 +309,4 @@ export const baseImportX = tseslint.config(
295
309
  "import-x/no-default-export": "off",
296
310
  },
297
311
  },
298
-
299
- {
300
- files: ["eslint.config.js", "eslint.config.cjs", "eslint.config.mjs"],
301
-
302
- rules: {
303
- "import-x/no-extraneous-dependencies": [
304
- "warn",
305
- {
306
- devDependencies: [
307
- "eslint.config.js",
308
- "eslint.config.cjs",
309
- "eslint.config.mjs",
310
- ],
311
-
312
- // ESLint configs in monorepos will import from "eslint-config-complete" and
313
- // "typescript-eslint", which might be installed as part of `complete-lint` (as a
314
- // transitive dependency).
315
- whitelist: ["eslint-config-complete", "typescript-eslint"],
316
- },
317
- ],
318
- },
319
- },
320
312
  );
@@ -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
- /** @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>} */
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
- /** @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>} */
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 "./baseConfigs/base-eslint.js";
4
- import { baseImportX } from "./baseConfigs/base-import-x.js";
5
- import { baseJSDoc } from "./baseConfigs/base-jsdoc.js";
6
- import { baseN } from "./baseConfigs/base-n.js";
7
- import { baseStylistic } from "./baseConfigs/base-stylistic.js";
8
- import { baseTypeScriptESLint } from "./baseConfigs/base-typescript-eslint.js";
9
- import { baseUnicorn } from "./baseConfigs/base-unicorn.js";
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 the "dist" directory since it is the idiomatic place for
53
- // compiled output in TypeScript.
54
- ignores: ["**/dist/"],
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
- files: ["**/scripts/*.{js,cjs,mjs,ts,cts,mts}"],
10
- rules: {
11
- // The dependencies that are used in monorepo package scripts are often installed at the root
12
- // of the monorepo (instead of as a "devDependency" in the package's "package.json" file).
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
- // ESLint configs in monorepos will import from "typescript-eslint" (and potentially other
29
- // plugins), which is often installed at root of the monorepo.
30
- "import-x/no-extraneous-dependencies": "off",
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