eslint-config-complete 1.2.2 → 1.2.4

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.
Files changed (39) hide show
  1. package/dist/base/base-eslint.d.ts +12 -0
  2. package/dist/base/base-eslint.d.ts.map +1 -0
  3. package/dist/base/base-eslint.js +670 -0
  4. package/dist/base/base-import-x.d.ts +12 -0
  5. package/dist/base/base-import-x.d.ts.map +1 -0
  6. package/dist/base/base-import-x.js +262 -0
  7. package/dist/base/base-jsdoc.d.ts +6 -0
  8. package/dist/base/base-jsdoc.d.ts.map +1 -0
  9. package/dist/base/base-jsdoc.js +212 -0
  10. package/dist/base/base-n.d.ts +7 -0
  11. package/dist/base/base-n.d.ts.map +1 -0
  12. package/dist/base/base-n.js +108 -0
  13. package/dist/base/base-stylistic.d.ts +6 -0
  14. package/dist/base/base-stylistic.d.ts.map +1 -0
  15. package/dist/base/base-stylistic.js +35 -0
  16. package/dist/base/base-typescript-eslint.d.ts +6 -0
  17. package/dist/base/base-typescript-eslint.d.ts.map +1 -0
  18. package/dist/base/base-typescript-eslint.js +479 -0
  19. package/dist/base/base-unicorn.d.ts +10 -0
  20. package/dist/base/base-unicorn.d.ts.map +1 -0
  21. package/dist/base/base-unicorn.js +203 -0
  22. package/dist/base.d.ts +8 -0
  23. package/dist/base.d.ts.map +1 -0
  24. package/{src → dist}/base.js +17 -30
  25. package/dist/index.d.ts +3 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/monorepo.d.ts +6 -0
  28. package/dist/monorepo.d.ts.map +1 -0
  29. package/dist/monorepo.js +16 -0
  30. package/package.json +5 -3
  31. package/src/base/base-eslint.js +0 -850
  32. package/src/base/base-import-x.js +0 -312
  33. package/src/base/base-jsdoc.js +0 -276
  34. package/src/base/base-n.js +0 -150
  35. package/src/base/base-stylistic.js +0 -38
  36. package/src/base/base-typescript-eslint.js +0 -554
  37. package/src/base/base-unicorn.js +0 -246
  38. package/src/monorepo.js +0 -18
  39. /package/{src → dist}/index.js +0 -0
@@ -0,0 +1,203 @@
1
+ import ESLintPluginUnicorn from "eslint-plugin-unicorn";
2
+ import tseslint from "typescript-eslint";
3
+ /**
4
+ * @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/readme.md#rules
5
+ * @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
6
+ */
7
+ const NORMAL_RULES = {
8
+ "unicorn/better-regex": "warn",
9
+ "unicorn/catch-error-name": "warn",
10
+ /** Disabled because it has too many false positives. */
11
+ "unicorn/consistent-destructuring": "off",
12
+ "unicorn/consistent-empty-array-spread": "warn",
13
+ "unicorn/consistent-function-scoping": "warn",
14
+ "unicorn/custom-error-definition": "warn",
15
+ "unicorn/empty-brace-spaces": "off", // eslint-config-prettier
16
+ "unicorn/error-message": "warn",
17
+ "unicorn/escape-case": "warn",
18
+ "unicorn/expiring-todo-comments": "warn",
19
+ "unicorn/explicit-length-check": "warn",
20
+ /** Disabled since projects may use different file naming conventions. */
21
+ "unicorn/filename-case": "off",
22
+ "unicorn/import-style": "warn",
23
+ "unicorn/new-for-builtins": "warn",
24
+ /**
25
+ * Disabled because if a line breaks three or more ESLint rules, then it is useful to use a single
26
+ * "eslint-disable" comment to make things more concise.
27
+ */
28
+ "unicorn/no-abusive-eslint-disable": "off",
29
+ "unicorn/no-anonymous-default-export": "warn",
30
+ /** Disabled since it is not helpful when using TypeScript. */
31
+ "unicorn/no-array-callback-reference": "off",
32
+ "unicorn/no-array-for-each": "warn",
33
+ "unicorn/no-array-method-this-argument": "warn",
34
+ "unicorn/no-array-push-push": "warn",
35
+ "unicorn/no-array-reduce": "warn",
36
+ "unicorn/no-await-expression-member": "warn",
37
+ "unicorn/no-await-in-promise-methods": "warn",
38
+ "unicorn/no-console-spaces": "warn",
39
+ "unicorn/no-document-cookie": "warn",
40
+ "unicorn/no-empty-file": "warn",
41
+ "unicorn/no-for-loop": "warn",
42
+ "unicorn/no-hex-escape": "warn",
43
+ "unicorn/no-instanceof-array": "warn",
44
+ "unicorn/no-invalid-fetch-options": "warn",
45
+ "unicorn/no-invalid-remove-event-listener": "warn",
46
+ /** Disabled because it is common to prefix variables with "new". */
47
+ "unicorn/no-keyword-prefix": "off",
48
+ "unicorn/no-length-as-slice-end": "warn",
49
+ "unicorn/no-lonely-if": "warn",
50
+ "unicorn/no-magic-array-flat-depth": "warn",
51
+ "unicorn/no-negated-condition": "warn",
52
+ "unicorn/no-negation-in-equality-check": "warn",
53
+ "unicorn/no-nested-ternary": "off", // eslint-config-prettier
54
+ "unicorn/no-new-array": "warn",
55
+ "unicorn/no-new-buffer": "warn",
56
+ "unicorn/no-null": "warn",
57
+ "unicorn/no-object-as-default-parameter": "warn",
58
+ /**
59
+ * Disabled because using `process.exit` is common to exit command-line applications without
60
+ * verbose output.
61
+ */
62
+ "unicorn/no-process-exit": "off",
63
+ "unicorn/no-single-promise-in-promise-methods": "warn",
64
+ "unicorn/no-static-only-class": "warn",
65
+ "unicorn/no-thenable": "warn",
66
+ /** Superseded by the `@typescript-eslint/no-this-alias` rule. */
67
+ "unicorn/no-this-assignment": "off",
68
+ "unicorn/no-typeof-undefined": "warn",
69
+ "unicorn/no-unnecessary-await": "warn",
70
+ "unicorn/no-unnecessary-polyfills": "warn",
71
+ "unicorn/no-unreadable-array-destructuring": "warn",
72
+ "unicorn/no-unreadable-iife": "warn",
73
+ "unicorn/no-unused-properties": "warn",
74
+ "unicorn/no-useless-fallback-in-spread": "warn",
75
+ "unicorn/no-useless-length-check": "warn",
76
+ "unicorn/no-useless-promise-resolve-reject": "warn",
77
+ "unicorn/no-useless-spread": "warn",
78
+ "unicorn/no-useless-switch-case": "warn",
79
+ /** Disabled since it does not work properly with TypeScript. */
80
+ "unicorn/no-useless-undefined": "off",
81
+ "unicorn/no-zero-fractions": "warn",
82
+ "unicorn/number-literal-case": "off", // eslint-config-prettier
83
+ "unicorn/numeric-separators-style": "warn",
84
+ "unicorn/prefer-add-event-listener": "warn",
85
+ "unicorn/prefer-array-find": "warn",
86
+ "unicorn/prefer-array-flat": "warn",
87
+ "unicorn/prefer-array-flat-map": "warn",
88
+ "unicorn/prefer-array-index-of": "warn",
89
+ "unicorn/prefer-array-some": "warn",
90
+ "unicorn/prefer-at": "warn",
91
+ "unicorn/prefer-blob-reading-methods": "warn",
92
+ "unicorn/prefer-code-point": "warn",
93
+ "unicorn/prefer-date-now": "warn",
94
+ "unicorn/prefer-default-parameters": "warn",
95
+ "unicorn/prefer-dom-node-append": "warn",
96
+ "unicorn/prefer-dom-node-dataset": "warn",
97
+ "unicorn/prefer-dom-node-remove": "warn",
98
+ "unicorn/prefer-dom-node-text-content": "warn",
99
+ "unicorn/prefer-event-target": "warn",
100
+ "unicorn/prefer-export-from": "warn",
101
+ "unicorn/prefer-includes": "warn",
102
+ /** Disabled because the rule is not compatible with TypeScript. */
103
+ "unicorn/prefer-json-parse-buffer": "off",
104
+ "unicorn/prefer-keyboard-event-key": "warn",
105
+ "unicorn/prefer-logical-operator-over-ternary": "warn",
106
+ "unicorn/prefer-math-trunc": "warn",
107
+ "unicorn/prefer-modern-dom-apis": "warn",
108
+ "unicorn/prefer-modern-math-apis": "warn",
109
+ "unicorn/prefer-module": "warn",
110
+ "unicorn/prefer-native-coercion-functions": "warn",
111
+ "unicorn/prefer-negative-index": "warn",
112
+ "unicorn/prefer-node-protocol": "warn",
113
+ "unicorn/prefer-number-properties": "warn",
114
+ "unicorn/prefer-object-from-entries": "warn",
115
+ "unicorn/prefer-optional-catch-binding": "warn",
116
+ "unicorn/prefer-prototype-methods": "warn",
117
+ "unicorn/prefer-query-selector": "warn",
118
+ "unicorn/prefer-reflect-apply": "warn",
119
+ "unicorn/prefer-regexp-test": "warn",
120
+ "unicorn/prefer-set-has": "warn",
121
+ "unicorn/prefer-set-size": "warn",
122
+ "unicorn/prefer-spread": "warn",
123
+ "unicorn/prefer-string-raw": "warn",
124
+ "unicorn/prefer-string-replace-all": "warn",
125
+ "unicorn/prefer-string-slice": "warn",
126
+ "unicorn/prefer-string-starts-ends-with": "warn",
127
+ "unicorn/prefer-string-trim-start-end": "warn",
128
+ "unicorn/prefer-structured-clone": "warn",
129
+ "unicorn/prefer-switch": "warn",
130
+ "unicorn/prefer-ternary": "warn",
131
+ "unicorn/prefer-top-level-await": "warn",
132
+ "unicorn/prefer-type-error": "warn",
133
+ /** Disabled since it is common to use the variable name of "i". */
134
+ "unicorn/prevent-abbreviations": "off",
135
+ "unicorn/relative-url-style": "warn",
136
+ "unicorn/require-array-join-separator": "warn",
137
+ "unicorn/require-number-to-fixed-digits-argument": "warn",
138
+ /** Disabled since it is not recommended by the plugin authors. */
139
+ "unicorn/require-post-message-target-origin": "off",
140
+ /** Disabled since string content enforcement is too project-specific. */
141
+ "unicorn/string-content": "off",
142
+ "unicorn/switch-case-braces": "warn",
143
+ "unicorn/template-indent": "warn",
144
+ "unicorn/text-encoding-identifier-case": "warn",
145
+ "unicorn/throw-new-error": "warn",
146
+ };
147
+ /**
148
+ * @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/deprecated-rules.md
149
+ * @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
150
+ */
151
+ const DEPRECATED_RULES = {
152
+ /** Disabled because this rule is deprecated. */
153
+ "unicorn/import-index": "off",
154
+ /** Disabled because this rule is deprecated. */
155
+ "unicorn/no-array-instanceof": "off",
156
+ /** Disabled because this rule is deprecated. */
157
+ "unicorn/no-fn-reference-in-iterator": "off",
158
+ /** Disabled because this rule is deprecated. */
159
+ "unicorn/no-reduce": "off",
160
+ /** Disabled because this rule is deprecated. */
161
+ "unicorn/no-unsafe-regex": "off",
162
+ /** Disabled because this rule is deprecated. */
163
+ "unicorn/prefer-dataset": "off",
164
+ /** Disabled because this rule is deprecated. */
165
+ "unicorn/prefer-event-key": "off",
166
+ /** Disabled because this rule is deprecated. */
167
+ "unicorn/prefer-exponentiation-operator": "off",
168
+ /** Disabled because this rule is deprecated. */
169
+ "unicorn/prefer-flat-map": "off",
170
+ /** Disabled because this rule is deprecated. */
171
+ "unicorn/prefer-node-append": "off",
172
+ /** Disabled because this rule is deprecated. */
173
+ "unicorn/prefer-node-remove": "off",
174
+ /** Disabled because this rule is deprecated. */
175
+ "unicorn/prefer-object-has-own": "off",
176
+ /** Disabled because this rule is deprecated. */
177
+ "unicorn/prefer-replace-all": "off",
178
+ /** Disabled because this rule is deprecated. */
179
+ "unicorn/prefer-starts-ends-with": "off",
180
+ /** Disabled because this rule is deprecated. */
181
+ "unicorn/prefer-text-content": "off",
182
+ /** Disabled because this rule is deprecated. */
183
+ "unicorn/prefer-trim-start-end": "off",
184
+ /** Disabled because this rule is deprecated. */
185
+ "unicorn/regex-shorthand": "off",
186
+ };
187
+ /**
188
+ * This ESLint config only contains rules from `eslint-plugin-unicorn`:
189
+ * https://github.com/sindresorhus/eslint-plugin-unicorn
190
+ *
191
+ * Rules are separated into categories:
192
+ * 1) Normal rules
193
+ * 2) Deprecated rules
194
+ */
195
+ export const baseUnicorn = tseslint.config({
196
+ plugins: {
197
+ unicorn: ESLintPluginUnicorn,
198
+ },
199
+ rules: {
200
+ ...NORMAL_RULES,
201
+ ...DEPRECATED_RULES,
202
+ },
203
+ });
package/dist/base.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This ESLint config is meant to be used as a base for all TypeScript projects.
3
+ *
4
+ * Rule modifications are split out into different files for better organization (based on the
5
+ * originating plugin) .
6
+ */
7
+ export const completeConfigBase: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
8
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.js"],"names":[],"mappings":"AAqBA;;;;;GAKG;AACH,qGA6BE"}
@@ -7,51 +7,38 @@ import { baseN } from "./base/base-n.js";
7
7
  import { baseStylistic } from "./base/base-stylistic.js";
8
8
  import { baseTypeScriptESLint } from "./base/base-typescript-eslint.js";
9
9
  import { baseUnicorn } from "./base/base-unicorn.js";
10
-
11
10
  // Hot-patch "eslint-plugin-complete" to convert errors to warnings.
12
11
  for (const config of ESLintPluginComplete.configs.recommended) {
13
- if (config.rules !== undefined) {
14
- for (const [key, value] of Object.entries(config.rules)) {
15
- if (value === "error") {
16
- config.rules[key] = "warn";
17
- }
12
+ if (config.rules !== undefined) {
13
+ for (const [key, value] of Object.entries(config.rules)) {
14
+ if (value === "error") {
15
+ config.rules[key] = "warn";
16
+ }
17
+ }
18
18
  }
19
- }
20
19
  }
21
-
22
20
  /**
23
21
  * This ESLint config is meant to be used as a base for all TypeScript projects.
24
22
  *
25
23
  * Rule modifications are split out into different files for better organization (based on the
26
24
  * originating plugin) .
27
25
  */
28
- export const completeConfigBase = tseslint.config(
29
- ...baseESLint,
30
- ...baseTypeScriptESLint,
31
- ...baseStylistic,
32
- ...baseImportX,
33
- ...baseJSDoc,
34
- ...baseN, // "n" stands for Node.
35
- ...baseUnicorn,
36
-
37
- // `eslint-plugin-complete` provides extra miscellaneous rules to keep code safe:
38
- // https://github.com/complete-ts/complete/tree/main/packages/eslint-plugin-complete
39
- ...ESLintPluginComplete.configs.recommended,
40
-
41
- // We prefer the official `reportUnusedDisableDirectives` linter option over the 3rd-party plugin
42
- // of "eslint-plugin-eslint-comments".
43
- {
26
+ export const completeConfigBase = tseslint.config(...baseESLint, ...baseTypeScriptESLint, ...baseStylistic, ...baseImportX, ...baseJSDoc, ...baseN, // "n" stands for Node.
27
+ ...baseUnicorn,
28
+ // `eslint-plugin-complete` provides extra miscellaneous rules to keep code safe:
29
+ // https://github.com/complete-ts/complete/tree/main/packages/eslint-plugin-complete
30
+ ...ESLintPluginComplete.configs.recommended,
31
+ // We prefer the official `reportUnusedDisableDirectives` linter option over the 3rd-party plugin
32
+ // of "eslint-plugin-eslint-comments".
33
+ {
44
34
  linterOptions: {
45
- reportUnusedDisableDirectives: "warn",
35
+ reportUnusedDisableDirectives: "warn",
46
36
  },
47
- },
48
-
49
- {
37
+ }, {
50
38
  // By default, ESLint ignores "**/node_modules/" and ".git/":
51
39
  // https://eslint.org/docs/latest/use/configure/ignore#ignoring-files
52
40
  // We also ignore want to ignore:
53
41
  // - The "dist" directory since it is the idiomatic place for compiled output in TypeScript.
54
42
  // - Minified files.
55
43
  ignores: ["**/dist/", "*.min.js"],
56
- },
57
- );
44
+ });
@@ -0,0 +1,3 @@
1
+ export { completeConfigBase } from "./base.js";
2
+ export { completeConfigMonorepo } from "./monorepo.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This ESLint config is meant to be used in monorepos that install dependencies at the root (in
3
+ * addition to the `completeBase` config).
4
+ */
5
+ export const completeConfigMonorepo: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
6
+ //# sourceMappingURL=monorepo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monorepo.d.ts","sourceRoot":"","sources":["../src/monorepo.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,yGAWG"}
@@ -0,0 +1,16 @@
1
+ import tseslint from "typescript-eslint";
2
+ /**
3
+ * This ESLint config is meant to be used in monorepos that install dependencies at the root (in
4
+ * addition to the `completeBase` config).
5
+ */
6
+ export const completeConfigMonorepo = tseslint.config({
7
+ files: ["eslint.config.mjs"],
8
+ rules: {
9
+ // ESLint configs in monorepos often intentionally import from the "src" subdirectory (because
10
+ // the config files are JavaScript so they cannot use tsconfig-paths).
11
+ "@typescript-eslint/no-restricted-imports": "off",
12
+ // ESLint configs in monorepos often intentionally import from the "packages" subdirectory
13
+ // (because the config files are JavaScript so they cannot use tsconfig-paths).
14
+ "import-x/no-relative-packages": "off",
15
+ },
16
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-complete",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "A sharable ESLint config for TypeScript projects.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -21,14 +21,16 @@
21
21
  "license": "MIT",
22
22
  "author": "Zamiell",
23
23
  "type": "module",
24
- "main": "./src/index.js",
24
+ "main": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
25
26
  "files": [
26
27
  "LICENSE",
27
28
  "package.json",
28
29
  "README.md",
29
- "src"
30
+ "dist"
30
31
  ],
31
32
  "scripts": {
33
+ "build": "tsx ./scripts/build.ts",
32
34
  "docs": "tsx ./scripts/docs.ts",
33
35
  "lint": "tsx ./scripts/lint.ts"
34
36
  },