@pumpn/eslint-config 17.2.3 → 18.0.0
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/_common/_exports.js +5 -0
- package/_common/all-extensions/_exports.js +1 -0
- package/_common/all-extensions/js-extensions.js +10 -0
- package/_common/all-extensions.js +6 -0
- package/_common/convert-extensions-to-glob.js +12 -0
- package/_common/js-jsx-extensions.js +3 -0
- package/_common/ts-extensions.js +10 -0
- package/_common/ts-jsx-extensions.js +3 -0
- package/config/_common/_exports.js +5 -0
- package/config/_common/add-prefix-to-rules.js +13 -0
- package/config/_common/core-json-rules.js +24 -0
- package/config/_common/json-plugins.js +9 -0
- package/config/_common/pick-unicorn-rules-for-language/_exports.js +2 -0
- package/config/_common/pick-unicorn-rules-for-language/pick-rules-for-language.js +52 -0
- package/config/_common/pick-unicorn-rules-for-language/unicorn/_exports.js +9 -0
- package/config/_common/pick-unicorn-rules-for-language/unicorn/binary-group-length.js +3 -0
- package/config/_common/pick-unicorn-rules-for-language/unicorn/hexadecimal-group-length.js +3 -0
- package/config/_common/pick-unicorn-rules-for-language/unicorn/maximum-nested-calls.js +3 -0
- package/config/_common/pick-unicorn-rules-for-language/unicorn/number-group-length.js +3 -0
- package/config/_common/pick-unicorn-rules-for-language/unicorn/octal-group-length.js +3 -0
- package/config/_common/pick-unicorn-rules-for-language/unicorn/patterns.js +28 -0
- package/config/_common/pick-unicorn-rules-for-language/unicorn/unicorn-consistency-rules/_exports.js +1 -0
- package/config/_common/pick-unicorn-rules-for-language/unicorn/unicorn-consistency-rules/consistent-function-style.js +3 -0
- package/config/_common/pick-unicorn-rules-for-language/unicorn/unicorn-consistency-rules.js +66 -0
- package/config/_common/pick-unicorn-rules-for-language/unicorn/unicorn-preference-rules.js +199 -0
- package/config/_common/pick-unicorn-rules-for-language/unicorn/unicorn-redundancy-rules.js +47 -0
- package/config/_common/pick-unicorn-rules-for-language/unicorn.js +368 -0
- package/config/_common/pick-unicorn-rules-for-language.js +14 -0
- package/config/_exports.js +11 -0
- package/config/converted-globals.js +16 -0
- package/config/css-config/_exports.js +2 -0
- package/config/css-config/css-plugins.js +9 -0
- package/config/css-config/css-rules/_exports.js +1 -0
- package/config/css-config/css-rules/core-css-rules.js +25 -0
- package/config/css-config/css-rules.js +10 -0
- package/config/css-config.js +17 -0
- package/config/default-glob.js +6 -0
- package/config/html-config/_exports.js +2 -0
- package/config/html-config/html-plugins.js +9 -0
- package/config/html-config/html-rules/_exports.js +1 -0
- package/config/html-config/html-rules/core-html-rules/_exports.js +4 -0
- package/config/html-config/html-rules/core-html-rules/core-html-accessibility-rules.js +28 -0
- package/config/html-config/html-rules/core-html-rules/core-html-best-practice-rules.js +42 -0
- package/config/html-config/html-rules/core-html-rules/core-html-seo-rules.js +16 -0
- package/config/html-config/html-rules/core-html-rules/core-html-style-rules.js +23 -0
- package/config/html-config/html-rules/core-html-rules.js +27 -0
- package/config/html-config/html-rules.js +10 -0
- package/config/html-config.js +12 -0
- package/config/json-config/_exports.js +1 -0
- package/config/json-config/json-rules.js +9 -0
- package/config/json-config.js +13 -0
- package/config/jsonc-config/_exports.js +1 -0
- package/config/jsonc-config/jsonc-rules.js +9 -0
- package/config/jsonc-config.js +26 -0
- package/config/jsx-glob/_exports.js +1 -0
- package/config/jsx-glob/jsx-extensions.js +6 -0
- package/config/jsx-glob.js +7 -0
- package/config/md-config/_exports.js +2 -0
- package/config/md-config/md-plugins.js +9 -0
- package/config/md-config/md-rules/_exports.js +1 -0
- package/config/md-config/md-rules/core-md-rules.js +30 -0
- package/config/md-config/md-rules.js +10 -0
- package/config/md-config.js +15 -0
- package/{plugins.js → config/plugins.js} +7 -6
- package/{rules → config/rules}/_common/_exports.js +0 -1
- package/{rules → config/rules}/_exports.js +1 -4
- package/config/rules/better-tailwindcss/correctness.js +13 -0
- package/config/rules/better-tailwindcss/stylistic.js +42 -0
- package/config/rules/better-tailwindcss.js +15 -0
- package/config/rules/command.js +17 -0
- package/config/rules/depend.js +17 -0
- package/config/rules/eslint-comments/best-practices.js +14 -0
- package/config/rules/eslint-comments/stylistic-issues.js +17 -0
- package/config/rules/eslint-comments.js +15 -0
- package/config/rules/import-x/helpful-warnings.js +26 -0
- package/config/rules/import-x/module-systems.js +14 -0
- package/config/rules/import-x/static-analysis.js +40 -0
- package/config/rules/import-x/style-guide/_exports.js +1 -0
- package/config/rules/import-x/style-guide/max-dependencies.js +3 -0
- package/config/rules/import-x/style-guide.js +94 -0
- package/config/rules/import-x.js +22 -0
- package/config/rules/jsdoc.js +464 -0
- package/config/rules/no-secrets/_exports.js +1 -0
- package/config/rules/no-secrets/tolerance.js +3 -0
- package/config/rules/no-secrets.js +30 -0
- package/config/rules/perfectionist.js +331 -0
- package/config/rules/promise.js +53 -0
- package/config/rules/react/core.js +69 -0
- package/config/rules/react/debug.js +14 -0
- package/config/rules/react/dom.js +25 -0
- package/config/rules/react/jsx.js +23 -0
- package/config/rules/react/naming-convention.js +12 -0
- package/config/rules/react/rsc.js +10 -0
- package/config/rules/react/web-api.js +15 -0
- package/config/rules/react.js +28 -0
- package/config/rules/regexp/best-practices.js +47 -0
- package/config/rules/regexp/possible-errors.js +31 -0
- package/config/rules/regexp/stylistic-issues.js +79 -0
- package/config/rules/regexp.js +20 -0
- package/config/rules/security.js +31 -0
- package/config/rules/sonarjs/problem.js +134 -0
- package/config/rules/sonarjs/suggestion.js +167 -0
- package/config/rules/sonarjs.js +15 -0
- package/config/rules/stylistic/_common/_exports.js +1 -0
- package/{rules → config/rules}/stylistic/_exports.js +1 -1
- package/config/rules/stylistic/brackets/_exports.js +2 -0
- package/config/rules/stylistic/brackets/min-elements-for-curly-newline.js +3 -0
- package/config/rules/stylistic/brackets/wrap-multilines-default.js +3 -0
- package/config/rules/stylistic/brackets.js +90 -0
- package/config/rules/stylistic/commas.js +18 -0
- package/config/rules/stylistic/comments.js +13 -0
- package/config/rules/stylistic/disallow.js +36 -0
- package/config/rules/stylistic/indent.js +19 -0
- package/config/rules/stylistic/jsx.js +42 -0
- package/config/rules/stylistic/linebreaks/_exports.js +1 -0
- package/config/rules/stylistic/linebreaks/max-ignored-chain-depth.js +3 -0
- package/config/rules/stylistic/linebreaks.js +67 -0
- package/config/rules/stylistic/misc.js +49 -0
- package/config/rules/stylistic/operators.js +31 -0
- package/config/rules/stylistic/quotes.js +12 -0
- package/config/rules/stylistic/semis.js +19 -0
- package/config/rules/stylistic/spacing.js +68 -0
- package/config/rules/stylistic/types.js +12 -0
- package/config/rules/stylistic.js +40 -0
- package/config/rules/suggestions/_exports.js +9 -0
- package/config/rules/suggestions/max-classes-per-file.js +3 -0
- package/config/rules/suggestions/max-depth.js +3 -0
- package/config/rules/suggestions/max-identifier-length.js +3 -0
- package/config/rules/suggestions/max-lines-per-file.js +3 -0
- package/config/rules/suggestions/max-lines-per-function.js +3 -0
- package/config/rules/suggestions/max-nested-callbacks.js +3 -0
- package/config/rules/suggestions/max-parameters.js +3 -0
- package/config/rules/suggestions/max-statements.js +3 -0
- package/config/rules/suggestions/min-identifier-length.js +3 -0
- package/{rules → config/rules}/suggestions.js +17 -15
- package/config/rules.js +50 -0
- package/config/ts-glob.js +6 -0
- package/config.js +51 -53
- package/package.json +51 -38
- package/.ls-lint.yml +0 -6
- package/.vscode/settings.json +0 -18
- package/deno.json +0 -78
- package/deno.lock +0 -1632
- package/eslint.config.js +0 -25
- package/rules/better-tailwindcss/correctness.js +0 -7
- package/rules/better-tailwindcss/stylistic.js +0 -38
- package/rules/better-tailwindcss.js +0 -19
- package/rules/command.js +0 -12
- package/rules/depend.js +0 -12
- package/rules/eslint-comments/best-practices.js +0 -9
- package/rules/eslint-comments/stylistic-issues.js +0 -12
- package/rules/eslint-comments.js +0 -19
- package/rules/import-x/helpful-warnings.js +0 -21
- package/rules/import-x/module-systems.js +0 -9
- package/rules/import-x/static-analysis.js +0 -35
- package/rules/import-x/style-guide.js +0 -89
- package/rules/import-x.js +0 -19
- package/rules/jsdoc.js +0 -433
- package/rules/no-secrets.js +0 -25
- package/rules/perfectionist.js +0 -318
- package/rules/promise.js +0 -48
- package/rules/react/core.js +0 -59
- package/rules/react/debug.js +0 -6
- package/rules/react/dom.js +0 -15
- package/rules/react/jsx.js +0 -18
- package/rules/react/naming-convention.js +0 -6
- package/rules/react/rsc.js +0 -5
- package/rules/react/web-api.js +0 -10
- package/rules/react.js +0 -19
- package/rules/regexp/best-practices.js +0 -42
- package/rules/regexp/possible-errors.js +0 -26
- package/rules/regexp/stylistic-issues.js +0 -74
- package/rules/regexp.js +0 -19
- package/rules/security.js +0 -25
- package/rules/sonarjs/problem.js +0 -123
- package/rules/sonarjs/suggestion.js +0 -135
- package/rules/sonarjs.js +0 -19
- package/rules/stylistic/_common/_exports.js +0 -3
- package/rules/stylistic/brackets.js +0 -87
- package/rules/stylistic/commas.js +0 -13
- package/rules/stylistic/comments.js +0 -8
- package/rules/stylistic/disallow.js +0 -31
- package/rules/stylistic/indent.js +0 -14
- package/rules/stylistic/jsx.js +0 -37
- package/rules/stylistic/linebreaks.js +0 -63
- package/rules/stylistic/misc.js +0 -45
- package/rules/stylistic/operators.js +0 -26
- package/rules/stylistic/quotes.js +0 -7
- package/rules/stylistic/semis.js +0 -14
- package/rules/stylistic/spacing.js +0 -63
- package/rules/stylistic/types.js +0 -7
- package/rules/stylistic.js +0 -19
- package/rules/unicorn.js +0 -306
- package/rules.js +0 -19
- package/scripts/update-import-map.js +0 -47
- package/scripts/update-package-json.js +0 -66
- package/scripts/update-tsconfig.js +0 -46
- package/tsconfig.json +0 -27
- /package/{rules → config}/_common/tab-width.js +0 -0
- /package/{rules → config/rules}/_common/maximum-line-length.js +0 -0
- /package/{rules → config/rules}/better-tailwindcss/_exports.js +0 -0
- /package/{rules → config/rules}/eslint-comments/_exports.js +0 -0
- /package/{rules → config/rules}/import-x/_exports.js +0 -0
- /package/{rules → config/rules}/layout-and-formatting.js +0 -0
- /package/{rules → config/rules}/possible-problems.js +0 -0
- /package/{rules → config/rules}/react/_exports.js +0 -0
- /package/{rules → config/rules}/regexp/_exports.js +0 -0
- /package/{rules → config/rules}/sonarjs/_exports.js +0 -0
- /package/{rules → config/rules}/stylistic/_common/min-items-for-array-newline.js +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as allExtensions } from "./all-extensions.js";
|
|
2
|
+
export { default as convertExtensionsToGlob } from "./convert-extensions-to-glob.js";
|
|
3
|
+
export { default as jsJsxExtensions } from "./js-jsx-extensions.js";
|
|
4
|
+
export { default as tsExtensions } from "./ts-extensions.js";
|
|
5
|
+
export { default as tsJsxExtensions } from "./ts-jsx-extensions.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as jsExtensions } from "./js-extensions.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {readonly `.${string}`[]} extensions
|
|
3
|
+
*/
|
|
4
|
+
const convertExtensionsToGlob = (extensions) => {
|
|
5
|
+
const suffix = extensions.length > 1
|
|
6
|
+
? `.{${extensions.map((extension) => extension.replace(/^\./v, "")).join(",")}}`
|
|
7
|
+
: extensions[0];
|
|
8
|
+
|
|
9
|
+
return `**/*${suffix}`;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default convertExtensionsToGlob;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as addPrefixToRules } from "./add-prefix-to-rules.js";
|
|
2
|
+
export { default as coreJsonRules } from "./core-json-rules.js";
|
|
3
|
+
export { default as jsonPlugins } from "./json-plugins.js";
|
|
4
|
+
export { default as pickUnicornRulesForLanguage } from "./pick-unicorn-rules-for-language.js";
|
|
5
|
+
export { default as tabWidth } from "./tab-width.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { mapKeys } from "radashi";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @import { Linter } from "eslint";
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {string} prefix
|
|
9
|
+
* @param {Linter.RulesRecord} rules
|
|
10
|
+
*/
|
|
11
|
+
const addPrefixToRules = (prefix, rules) => mapKeys(rules, (key) => `${prefix}/${key}`);
|
|
12
|
+
|
|
13
|
+
export default addPrefixToRules;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import addPrefixToRules from "./add-prefix-to-rules.js";
|
|
2
|
+
|
|
3
|
+
const coreJsonRules = addPrefixToRules(
|
|
4
|
+
"json",
|
|
5
|
+
{
|
|
6
|
+
"no-duplicate-keys": "error",
|
|
7
|
+
"no-empty-keys": "error",
|
|
8
|
+
"no-unnormalized-keys": ["error", { form: "NFC" }],
|
|
9
|
+
"no-unsafe-values": "error",
|
|
10
|
+
"sort-keys": [
|
|
11
|
+
"error",
|
|
12
|
+
"asc",
|
|
13
|
+
{
|
|
14
|
+
minKeys: 2,
|
|
15
|
+
allowLineSeparatedGroups: true,
|
|
16
|
+
caseSensitive: false,
|
|
17
|
+
natural: true
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"top-level-interop": "error"
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export default coreJsonRules;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { pick } from "radashi";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @import { Linter } from "eslint";
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {Linter.RulesRecord} rules
|
|
10
|
+
* @param {string} language
|
|
11
|
+
* @param {Exclude<Linter.Config["plugins"], undefined>[string]} plugin
|
|
12
|
+
*/
|
|
13
|
+
const pickRulesForLanguage = (
|
|
14
|
+
rules,
|
|
15
|
+
language,
|
|
16
|
+
plugin
|
|
17
|
+
) => pick(
|
|
18
|
+
rules,
|
|
19
|
+
(rule, prefixedRuleKey) => {
|
|
20
|
+
const ruleId = String(prefixedRuleKey);
|
|
21
|
+
|
|
22
|
+
// same split as ESLint, so scoped prefixes like `@scope/plugin` work
|
|
23
|
+
const prefix = /^(?<prefix>@.+|[^\/]+)\//v.exec(ruleId)?.groups?.prefix ?? "";
|
|
24
|
+
|
|
25
|
+
const pluginRule = plugin.rules?.[ruleId.slice(prefix.length + 1)];
|
|
26
|
+
|
|
27
|
+
if (pluginRule === undefined) {
|
|
28
|
+
throw new Error(`Rule "${ruleId}" does not exist`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const {
|
|
32
|
+
meta: {
|
|
33
|
+
deprecated,
|
|
34
|
+
languages
|
|
35
|
+
} = {}
|
|
36
|
+
} = pluginRule;
|
|
37
|
+
|
|
38
|
+
const isDeprecated = deprecated !== undefined && Boolean(deprecated);
|
|
39
|
+
|
|
40
|
+
const isLanguage = (
|
|
41
|
+
languages !== undefined &&
|
|
42
|
+
(languages.includes(language) || languages.includes("*"))
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
!isDeprecated &&
|
|
47
|
+
isLanguage
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
export default pickRulesForLanguage;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as binaryGroupLength } from "./binary-group-length.js";
|
|
2
|
+
export { default as hexadecimalGroupLength } from "./hexadecimal-group-length.js";
|
|
3
|
+
export { default as maximumNestedCalls } from "./maximum-nested-calls.js";
|
|
4
|
+
export { default as numberGroupLength } from "./number-group-length.js";
|
|
5
|
+
export { default as octalGroupLength } from "./octal-group-length.js";
|
|
6
|
+
export { default as patterns } from "./patterns.js";
|
|
7
|
+
export { default as unicornConsistencyRules } from "./unicorn-consistency-rules.js";
|
|
8
|
+
export { default as unicornPreferenceRules } from "./unicorn-preference-rules.js";
|
|
9
|
+
export { default as unicornRedundancyRules } from "./unicorn-redundancy-rules.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const patterns = {
|
|
2
|
+
"'": "’",
|
|
3
|
+
"(?<=“[^“]*?\\s)['‘]([^'‘]+?)['’](?=\\s[^“]*?”)": "‘$1’",
|
|
4
|
+
"(?<=[!?])”\\.(?=(?:(?:\\s+[\\p{Letter}\\p{Number}])|$))": "”",
|
|
5
|
+
"(?<=[!?])\\.": "",
|
|
6
|
+
"(?<=[\\p{Letter}\\p{Number}] )-+(?= [\\p{Letter}\\p{Number}])": "—",
|
|
7
|
+
"(?<=\\p{Punctuation})\\p{Zs}{2,}(?=[\\p{Letter}\\p{Number}])": " ",
|
|
8
|
+
"([\"'])((?:\\\\.|[^\\\\])*?)\\1": "“$2”",
|
|
9
|
+
"-->": "⟶",
|
|
10
|
+
"->": "→",
|
|
11
|
+
"\\.”\\.(?=(?:(?:\\s+[\\p{Letter}\\p{Number}])|$))": ".”",
|
|
12
|
+
"<-": "←",
|
|
13
|
+
"<--": "⟵",
|
|
14
|
+
"<-->": "⟷",
|
|
15
|
+
"<->": "↔",
|
|
16
|
+
"<=": "≤",
|
|
17
|
+
"<==": "⇐",
|
|
18
|
+
"<===": "⟸",
|
|
19
|
+
"<==>": "⟺",
|
|
20
|
+
"<=>": "⇔",
|
|
21
|
+
"===>": "⟹",
|
|
22
|
+
"==>": "⇒",
|
|
23
|
+
">=": "≥",
|
|
24
|
+
"\\.\\.(?=(?:(?:\\s+[\\p{Letter}\\p{Number}])|$))": ".",
|
|
25
|
+
"\\.\\.\\.": "…"
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default patterns;
|
package/config/_common/pick-unicorn-rules-for-language/unicorn/unicorn-consistency-rules/_exports.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as consistentFunctionStyle } from "./consistent-function-style.js";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { consistentFunctionStyle } from "./unicorn-consistency-rules/_exports.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @import { Linter } from "eslint";
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @satisfies {Linter.RulesRecord}
|
|
9
|
+
*/
|
|
10
|
+
const unicornConsistencyRules = {
|
|
11
|
+
"consistent-arrow-return-style": "off",
|
|
12
|
+
"consistent-assert": "error",
|
|
13
|
+
"consistent-boolean-name": [
|
|
14
|
+
"error",
|
|
15
|
+
{
|
|
16
|
+
checkArguments: "always",
|
|
17
|
+
checkFields: "never",
|
|
18
|
+
checkFunctions: "always",
|
|
19
|
+
checkMethods: "never",
|
|
20
|
+
checkVariables: "always",
|
|
21
|
+
ignore: [],
|
|
22
|
+
prefixes: {
|
|
23
|
+
are: true,
|
|
24
|
+
can: true,
|
|
25
|
+
did: true,
|
|
26
|
+
has: true,
|
|
27
|
+
have: true,
|
|
28
|
+
is: true,
|
|
29
|
+
requires: true,
|
|
30
|
+
should: true,
|
|
31
|
+
was: true,
|
|
32
|
+
were: true,
|
|
33
|
+
will: true
|
|
34
|
+
},
|
|
35
|
+
wrappers: {}
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"consistent-class-member-order": "off",
|
|
39
|
+
"consistent-compound-words": "error",
|
|
40
|
+
"consistent-conditional-object-spread": ["error", "ternary"],
|
|
41
|
+
"consistent-date-clone": "error",
|
|
42
|
+
"consistent-destructuring": "error",
|
|
43
|
+
"consistent-empty-array-spread": "error",
|
|
44
|
+
"consistent-existence-index-check": "error",
|
|
45
|
+
"consistent-export-decorator-position": ["error", "above"],
|
|
46
|
+
"consistent-function-scoping": "error",
|
|
47
|
+
"consistent-function-style": [
|
|
48
|
+
"error",
|
|
49
|
+
{
|
|
50
|
+
callbacks: consistentFunctionStyle,
|
|
51
|
+
default: consistentFunctionStyle,
|
|
52
|
+
defaultExport: consistentFunctionStyle,
|
|
53
|
+
namedExports: consistentFunctionStyle,
|
|
54
|
+
namedFunctions: consistentFunctionStyle,
|
|
55
|
+
objectProperties: consistentFunctionStyle,
|
|
56
|
+
reassignedVariables: consistentFunctionStyle,
|
|
57
|
+
typedVariables: consistentFunctionStyle
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"consistent-json-file-read": ["error", "string"],
|
|
61
|
+
"consistent-optional-chaining": "error",
|
|
62
|
+
"consistent-template-literal-escape": "error",
|
|
63
|
+
"consistent-tuple-labels": "error"
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default unicornConsistencyRules;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import { Linter } from "eslint";
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @satisfies {Linter.RulesRecord}
|
|
7
|
+
*/
|
|
8
|
+
const unicornPreferenceRules = {
|
|
9
|
+
"prefer-abort-signal-any": "error",
|
|
10
|
+
"prefer-abort-signal-timeout": "error",
|
|
11
|
+
"prefer-add-event-listener": "error",
|
|
12
|
+
"prefer-add-event-listener-options": "error",
|
|
13
|
+
"prefer-aggregate-error": "error",
|
|
14
|
+
"prefer-array-find": "error",
|
|
15
|
+
"prefer-array-flat": "error",
|
|
16
|
+
"prefer-array-flat-map": "error",
|
|
17
|
+
"prefer-array-from-async": "error",
|
|
18
|
+
"prefer-array-from-map": "error",
|
|
19
|
+
"prefer-array-from-range": "error",
|
|
20
|
+
"prefer-array-index-of": "error",
|
|
21
|
+
"prefer-array-iterable-methods": "error",
|
|
22
|
+
"prefer-array-last-methods": "error",
|
|
23
|
+
"prefer-array-slice": "error",
|
|
24
|
+
"prefer-array-some": "error",
|
|
25
|
+
"prefer-at": "error",
|
|
26
|
+
"prefer-await": "error",
|
|
27
|
+
"prefer-bigint-literals": "error",
|
|
28
|
+
"prefer-blob-reading-methods": "error",
|
|
29
|
+
"prefer-block-statement-over-iife": "error",
|
|
30
|
+
"prefer-boolean-return": "error",
|
|
31
|
+
"prefer-class-fields": "error",
|
|
32
|
+
"prefer-classlist-toggle": "error",
|
|
33
|
+
"prefer-code-point": "error",
|
|
34
|
+
"prefer-combined-guards": [
|
|
35
|
+
"error",
|
|
36
|
+
{
|
|
37
|
+
checkCompoundConditions: true,
|
|
38
|
+
checkMultiStatementBodies: true
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"prefer-continue": [
|
|
42
|
+
"error",
|
|
43
|
+
{
|
|
44
|
+
maximumStatements: 1,
|
|
45
|
+
checkShortBodies: false
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"prefer-date-now": "error",
|
|
49
|
+
"prefer-default-parameters": ["error", { checkFallbackExpressions: true }],
|
|
50
|
+
"prefer-direct-iteration": "error",
|
|
51
|
+
"prefer-dispose": "error",
|
|
52
|
+
"prefer-dom-node-append": "error",
|
|
53
|
+
"prefer-dom-node-html-methods": [
|
|
54
|
+
"error",
|
|
55
|
+
{
|
|
56
|
+
checkGetHTML: true,
|
|
57
|
+
checkSetHTML: true
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"prefer-dom-node-remove": "error",
|
|
61
|
+
"prefer-dom-node-replace-children": "error",
|
|
62
|
+
"prefer-dom-node-text-content": "error",
|
|
63
|
+
"prefer-early-return": [
|
|
64
|
+
"error",
|
|
65
|
+
{
|
|
66
|
+
maximumStatements: 1,
|
|
67
|
+
checkShortBodies: false
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"prefer-else-if": "error",
|
|
71
|
+
"prefer-error-is-error": "error",
|
|
72
|
+
"prefer-escaped-irregular-whitespace": "error",
|
|
73
|
+
"prefer-event-target": "error",
|
|
74
|
+
"prefer-export-from": "error",
|
|
75
|
+
"prefer-flat-math-min-max": "error",
|
|
76
|
+
"prefer-get-or-insert-computed": "error",
|
|
77
|
+
"prefer-global-number-constants": "off",
|
|
78
|
+
"prefer-global-this": "error",
|
|
79
|
+
"prefer-group-by": "error",
|
|
80
|
+
"prefer-has-check": "error",
|
|
81
|
+
"prefer-hoisting-branch-code": "error",
|
|
82
|
+
"prefer-https": "error",
|
|
83
|
+
"prefer-identifier-import-export-specifiers": "error",
|
|
84
|
+
"prefer-import-meta-properties": "error",
|
|
85
|
+
"prefer-includes": "error",
|
|
86
|
+
"prefer-includes-over-repeated-comparisons": "error",
|
|
87
|
+
"prefer-iterable-in-constructor": "error",
|
|
88
|
+
"prefer-iterator-concat": "off",
|
|
89
|
+
"prefer-iterator-helpers": "error",
|
|
90
|
+
"prefer-iterator-to-array": "error",
|
|
91
|
+
"prefer-iterator-to-array-at-end": "error",
|
|
92
|
+
"prefer-iterator-zip": "error",
|
|
93
|
+
"prefer-json-import": "error",
|
|
94
|
+
"prefer-keyboard-event-key": "error",
|
|
95
|
+
"prefer-literal-ascii": "error",
|
|
96
|
+
"prefer-location-assign": "error",
|
|
97
|
+
"prefer-logical-operator-over-ternary": "error",
|
|
98
|
+
"prefer-map-from-entries": "error",
|
|
99
|
+
"prefer-math-abs": "error",
|
|
100
|
+
"prefer-math-constants": "error",
|
|
101
|
+
"prefer-math-min-max": "error",
|
|
102
|
+
"prefer-math-trunc": "error",
|
|
103
|
+
"prefer-minimal-ternary": [
|
|
104
|
+
"error",
|
|
105
|
+
{
|
|
106
|
+
checkComputedMemberAccess: true,
|
|
107
|
+
checkVaryingBase: false
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"prefer-modern-dom-apis": "error",
|
|
111
|
+
"prefer-modern-math-apis": "error",
|
|
112
|
+
"prefer-module": "error",
|
|
113
|
+
"prefer-native-coercion-functions": "error",
|
|
114
|
+
"prefer-negative-index": "error",
|
|
115
|
+
"prefer-node-protocol": "error",
|
|
116
|
+
"prefer-number-coercion": "error",
|
|
117
|
+
"prefer-number-is-safe-integer": "error",
|
|
118
|
+
"prefer-number-properties": [
|
|
119
|
+
"error",
|
|
120
|
+
{
|
|
121
|
+
checkInfinity: false
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"prefer-object-define-properties": "error",
|
|
125
|
+
"prefer-object-destructuring-defaults": "error",
|
|
126
|
+
"prefer-object-from-entries": "error",
|
|
127
|
+
"prefer-object-iterable-methods": "error",
|
|
128
|
+
"prefer-observer-apis": "error",
|
|
129
|
+
"prefer-optional-catch-binding": "error",
|
|
130
|
+
"prefer-path2d": "error",
|
|
131
|
+
"prefer-private-class-fields": "error",
|
|
132
|
+
"prefer-promise-static-methods": "error",
|
|
133
|
+
"prefer-promise-try": "error",
|
|
134
|
+
"prefer-promise-with-resolvers": "error",
|
|
135
|
+
"prefer-prototype-methods": "error",
|
|
136
|
+
"prefer-query-selector": "error",
|
|
137
|
+
"prefer-queue-microtask": [
|
|
138
|
+
"error",
|
|
139
|
+
{
|
|
140
|
+
checkSetImmediate: true,
|
|
141
|
+
checkSetTimeout: true
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
"prefer-reflect-apply": "error",
|
|
145
|
+
"prefer-regexp-escape": "error",
|
|
146
|
+
"prefer-regexp-test": "error",
|
|
147
|
+
"prefer-response-static-json": "error",
|
|
148
|
+
"prefer-scoped-selector": "error",
|
|
149
|
+
"prefer-set-has": "error",
|
|
150
|
+
"prefer-set-methods": "error",
|
|
151
|
+
"prefer-set-size": "error",
|
|
152
|
+
"prefer-short-arrow-method": ["error", "always"],
|
|
153
|
+
"prefer-short-escape-sequences": "error",
|
|
154
|
+
"prefer-simple-condition-first": "error",
|
|
155
|
+
"prefer-simple-sort-comparator": "error",
|
|
156
|
+
"prefer-simplified-conditions": ["error", { negatedConditions: "simplify" }],
|
|
157
|
+
"prefer-single-array-predicate": "error",
|
|
158
|
+
"prefer-single-call": "error",
|
|
159
|
+
"prefer-single-object-destructuring": "error",
|
|
160
|
+
"prefer-single-replace": "error",
|
|
161
|
+
"prefer-smaller-scope": "error",
|
|
162
|
+
"prefer-split-limit": "error",
|
|
163
|
+
"prefer-spread": "error",
|
|
164
|
+
"prefer-string-match-all": "error",
|
|
165
|
+
"prefer-string-pad-start-end": "error",
|
|
166
|
+
"prefer-string-raw": "error",
|
|
167
|
+
"prefer-string-repeat": "error",
|
|
168
|
+
"prefer-string-replace-all": "error",
|
|
169
|
+
"prefer-string-slice": "error",
|
|
170
|
+
"prefer-string-starts-ends-with": "error",
|
|
171
|
+
"prefer-string-trim-start-end": "error",
|
|
172
|
+
"prefer-structured-clone": "error",
|
|
173
|
+
"prefer-switch": "error",
|
|
174
|
+
"prefer-temporal": [
|
|
175
|
+
"error",
|
|
176
|
+
{
|
|
177
|
+
checkDateNow: true,
|
|
178
|
+
checkMethods: true,
|
|
179
|
+
checkReferences: false
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
"prefer-temporal-conversion": "error",
|
|
183
|
+
"prefer-ternary": ["error", "only-single-line"],
|
|
184
|
+
"prefer-then-catch": "error",
|
|
185
|
+
"prefer-toggle-attribute": "error",
|
|
186
|
+
"prefer-top-level-await": "error",
|
|
187
|
+
"prefer-type-error": "error",
|
|
188
|
+
"prefer-type-literal-last": "error",
|
|
189
|
+
"prefer-uint8array-base64": "error",
|
|
190
|
+
"prefer-uint8array-hex": "error",
|
|
191
|
+
"prefer-unary-minus": "error",
|
|
192
|
+
"prefer-unicode-code-point-escapes": "error",
|
|
193
|
+
"prefer-url-can-parse": "error",
|
|
194
|
+
"prefer-url-href": "error",
|
|
195
|
+
"prefer-url-search-parameters": "error",
|
|
196
|
+
"prefer-while-loop-condition": "error"
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export default unicornPreferenceRules;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import { Linter } from "eslint";
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @satisfies {Linter.RulesRecord}
|
|
7
|
+
*/
|
|
8
|
+
const unicornRedundancyRules = {
|
|
9
|
+
"no-unnecessary-array-flat-depth": "error",
|
|
10
|
+
"no-unnecessary-array-flat-map": "error",
|
|
11
|
+
"no-unnecessary-array-splice-count": "error",
|
|
12
|
+
"no-unnecessary-await": "error",
|
|
13
|
+
"no-unnecessary-boolean-comparison": "error",
|
|
14
|
+
"no-unnecessary-default-arguments": "error",
|
|
15
|
+
"no-unnecessary-fetch-options": "error",
|
|
16
|
+
"no-unnecessary-global-this": "error",
|
|
17
|
+
"no-unnecessary-nested-ternary": "error",
|
|
18
|
+
"no-unnecessary-parameters": ["error", { minimumCallCount: 2 }],
|
|
19
|
+
"no-unnecessary-polyfills": "error",
|
|
20
|
+
"no-unnecessary-slice-end": "error",
|
|
21
|
+
"no-unnecessary-splice": "error",
|
|
22
|
+
"no-unnecessary-string-trim": "error",
|
|
23
|
+
"no-useless-boolean-cast": "error",
|
|
24
|
+
"no-useless-coercion": "error",
|
|
25
|
+
"no-useless-collection-argument": "error",
|
|
26
|
+
"no-useless-compound-assignment": "error",
|
|
27
|
+
"no-useless-concat": "error",
|
|
28
|
+
"no-useless-continue": "error",
|
|
29
|
+
"no-useless-delete-check": "error",
|
|
30
|
+
"no-useless-else": "error",
|
|
31
|
+
"no-useless-error-capture-stack-trace": "error",
|
|
32
|
+
"no-useless-fallback-in-spread": "error",
|
|
33
|
+
"no-useless-iterator-to-array": "error",
|
|
34
|
+
"no-useless-length-check": "error",
|
|
35
|
+
"no-useless-logical-operand": "error",
|
|
36
|
+
"no-useless-override": "error",
|
|
37
|
+
"no-useless-promise-resolve-reject": "error",
|
|
38
|
+
"no-useless-re-export": "error",
|
|
39
|
+
"no-useless-recursion": "error",
|
|
40
|
+
"no-useless-set-construction": "error",
|
|
41
|
+
"no-useless-spread": "error",
|
|
42
|
+
"no-useless-switch-case": "error",
|
|
43
|
+
"no-useless-template-literals": "error",
|
|
44
|
+
"no-useless-undefined": "off"
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default unicornRedundancyRules;
|