@peerigon/configs 4.2.0 → 4.3.0-beta.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/CHANGELOG.md +16 -0
- package/{types → dist}/eslint/lib/glob-patterns.d.ts +0 -1
- package/dist/eslint/lib/glob-patterns.js +11 -0
- package/{types → dist}/eslint/lib/rule-options.d.ts +0 -1
- package/dist/eslint/lib/rule-options.js +127 -0
- package/{types → dist}/eslint/presets/javascript-browser.d.ts +0 -1
- package/{eslint → dist/eslint}/presets/javascript-browser.js +4 -6
- package/{types → dist}/eslint/presets/javascript-node.d.ts +0 -1
- package/{eslint → dist/eslint}/presets/javascript-node.js +4 -6
- package/{types → dist}/eslint/presets/javascript.d.ts +0 -1
- package/{eslint → dist/eslint}/presets/javascript.js +0 -2
- package/{types → dist}/eslint/presets/typescript-node.d.ts +0 -1
- package/{eslint → dist/eslint}/presets/typescript-node.js +5 -7
- package/{types → dist}/eslint/presets/typescript-react.d.ts +0 -1
- package/{eslint → dist/eslint}/presets/typescript-react.js +6 -8
- package/{types → dist}/eslint/presets/typescript.d.ts +0 -1
- package/{eslint → dist/eslint}/presets/typescript.js +4 -6
- package/{types → dist}/eslint/rules/base.d.ts +0 -1
- package/{eslint → dist/eslint}/rules/base.js +5 -8
- package/{types → dist}/eslint/rules/browser.d.ts +0 -1
- package/{eslint → dist/eslint}/rules/browser.js +4 -6
- package/{types → dist}/eslint/rules/javascript.d.ts +0 -1
- package/dist/eslint/rules/javascript.js +151 -0
- package/{types → dist}/eslint/rules/node.d.ts +0 -1
- package/{eslint → dist/eslint}/rules/node.js +4 -6
- package/{types → dist}/eslint/rules/react.d.ts +0 -1
- package/dist/eslint/rules/react.js +166 -0
- package/{types → dist}/eslint/rules/typescript.d.ts +0 -1
- package/dist/eslint/rules/typescript.js +195 -0
- package/{types → dist}/eslint/styles/jsx-no-literals.d.ts +0 -1
- package/dist/eslint/styles/jsx-no-literals.js +29 -0
- package/{types → dist}/eslint/styles/no-default-export.d.ts +0 -1
- package/dist/eslint/styles/no-default-export.js +18 -0
- package/{types → dist}/eslint/styles/no-null.d.ts +0 -1
- package/{eslint → dist/eslint}/styles/no-null.js +4 -5
- package/{types → dist}/eslint/styles/prefer-array-shorthand.d.ts +0 -1
- package/dist/eslint/styles/prefer-array-shorthand.js +14 -0
- package/{types → dist}/eslint/styles/prefer-interface.d.ts +0 -1
- package/dist/eslint/styles/prefer-interface.js +9 -0
- package/dist/prettier/base.d.ts +8 -0
- package/dist/prettier/base.js +55 -0
- package/{types → dist}/semantic-release/base.d.ts +0 -1
- package/dist/semantic-release/base.js +40 -0
- package/{types → dist}/semantic-release/cross-publish.d.ts +4 -1
- package/dist/semantic-release/cross-publish.js +35 -0
- package/dist/typescript/base.json +43 -0
- package/dist/typescript/configs.d.ts +1 -0
- package/dist/typescript/configs.js +4 -0
- package/dist/typescript/js-lib.json +11 -0
- package/dist/typescript/lib.json +13 -0
- package/package.json +24 -74
- package/eslint/README.md +0 -119
- package/eslint/lib/glob-patterns.js +0 -11
- package/eslint/lib/rule-options.js +0 -130
- package/eslint/presets/javascript.test/eslint.config.js +0 -1
- package/eslint/presets/javascript.test/main.js +0 -62
- package/eslint/presets/javascript.test/other.js +0 -2
- package/eslint/presets/typescript-react.test/App.tsx +0 -47
- package/eslint/presets/typescript-react.test/Other.tsx +0 -5
- package/eslint/presets/typescript-react.test/eslint.config.js +0 -1
- package/eslint/presets/typescript-react.test/tsconfig.json +0 -7
- package/eslint/presets/typescript.test/eslint.config.js +0 -1
- package/eslint/presets/typescript.test/main.ts +0 -42
- package/eslint/presets/typescript.test/message.ts +0 -3
- package/eslint/presets/typescript.test/test.json +0 -1
- package/eslint/presets/typescript.test/tsconfig.json +0 -4
- package/eslint/presets/typescript.test/types.d.ts +0 -11
- package/eslint/rules/javascript.js +0 -157
- package/eslint/rules/react.js +0 -169
- package/eslint/rules/typescript.js +0 -206
- package/eslint/styles/jsx-no-literals.js +0 -31
- package/eslint/styles/jsx-no-literals.test/eslint.config.js +0 -4
- package/eslint/styles/jsx-no-literals.test/main.tsx +0 -4
- package/eslint/styles/jsx-no-literals.test/tsconfig.json +0 -7
- package/eslint/styles/no-default-export.js +0 -20
- package/eslint/styles/no-default-export.test/eslint.config.js +0 -4
- package/eslint/styles/no-default-export.test/main.ts +0 -2
- package/eslint/styles/no-default-export.test/tsconfig.json +0 -4
- package/eslint/styles/no-default-export.test/vitest.config.ts +0 -1
- package/eslint/styles/no-null.test/eslint.config.js +0 -4
- package/eslint/styles/no-null.test/main.ts +0 -2
- package/eslint/styles/no-null.test/tsconfig.json +0 -4
- package/eslint/styles/prefer-array-shorthand.js +0 -15
- package/eslint/styles/prefer-array-shorthand.test/eslint.config.js +0 -4
- package/eslint/styles/prefer-array-shorthand.test/main.ts +0 -4
- package/eslint/styles/prefer-array-shorthand.test/tsconfig.json +0 -4
- package/eslint/styles/prefer-interface.js +0 -10
- package/eslint/styles/prefer-interface.test/eslint.config.js +0 -4
- package/eslint/styles/prefer-interface.test/main.ts +0 -8
- package/eslint/styles/prefer-interface.test/tsconfig.json +0 -4
- package/eslint/types.d.ts +0 -50
- package/prettier/README.md +0 -35
- package/prettier/base.js +0 -35
- package/prettier/css.test/styles.css +0 -9
- package/semantic-release/README.md +0 -81
- package/semantic-release/base.js +0 -41
- package/semantic-release/cross-publish.js +0 -41
- package/types/eslint/lib/glob-patterns.d.ts.map +0 -1
- package/types/eslint/lib/rule-options.d.ts.map +0 -1
- package/types/eslint/presets/javascript-browser.d.ts.map +0 -1
- package/types/eslint/presets/javascript-node.d.ts.map +0 -1
- package/types/eslint/presets/javascript.d.ts.map +0 -1
- package/types/eslint/presets/javascript.test/eslint.config.d.ts +0 -2
- package/types/eslint/presets/javascript.test/eslint.config.d.ts.map +0 -1
- package/types/eslint/presets/javascript.test/main.d.ts +0 -2
- package/types/eslint/presets/javascript.test/main.d.ts.map +0 -1
- package/types/eslint/presets/javascript.test/other.d.ts +0 -3
- package/types/eslint/presets/javascript.test/other.d.ts.map +0 -1
- package/types/eslint/presets/typescript-node.d.ts.map +0 -1
- package/types/eslint/presets/typescript-react.d.ts.map +0 -1
- package/types/eslint/presets/typescript.d.ts.map +0 -1
- package/types/eslint/rules/base.d.ts.map +0 -1
- package/types/eslint/rules/browser.d.ts.map +0 -1
- package/types/eslint/rules/javascript.d.ts.map +0 -1
- package/types/eslint/rules/node.d.ts.map +0 -1
- package/types/eslint/rules/react.d.ts.map +0 -1
- package/types/eslint/rules/typescript.d.ts.map +0 -1
- package/types/eslint/styles/jsx-no-literals.d.ts.map +0 -1
- package/types/eslint/styles/no-default-export.d.ts.map +0 -1
- package/types/eslint/styles/no-default-export.test/eslint.config.d.ts +0 -3
- package/types/eslint/styles/no-default-export.test/eslint.config.d.ts.map +0 -1
- package/types/eslint/styles/no-default-export.test/main.d.ts +0 -3
- package/types/eslint/styles/no-default-export.test/main.d.ts.map +0 -1
- package/types/eslint/styles/no-default-export.test/vitest.config.d.ts +0 -3
- package/types/eslint/styles/no-default-export.test/vitest.config.d.ts.map +0 -1
- package/types/eslint/styles/no-null.d.ts.map +0 -1
- package/types/eslint/styles/no-null.test/eslint.config.d.ts +0 -3
- package/types/eslint/styles/no-null.test/eslint.config.d.ts.map +0 -1
- package/types/eslint/styles/no-null.test/main.d.ts +0 -2
- package/types/eslint/styles/no-null.test/main.d.ts.map +0 -1
- package/types/eslint/styles/prefer-array-shorthand.d.ts.map +0 -1
- package/types/eslint/styles/prefer-array-shorthand.test/eslint.config.d.ts +0 -3
- package/types/eslint/styles/prefer-array-shorthand.test/eslint.config.d.ts.map +0 -1
- package/types/eslint/styles/prefer-array-shorthand.test/main.d.ts +0 -3
- package/types/eslint/styles/prefer-array-shorthand.test/main.d.ts.map +0 -1
- package/types/eslint/styles/prefer-interface.d.ts.map +0 -1
- package/types/eslint/styles/prefer-interface.test/eslint.config.d.ts +0 -3
- package/types/eslint/styles/prefer-interface.test/eslint.config.d.ts.map +0 -1
- package/types/eslint/styles/prefer-interface.test/main.d.ts +0 -7
- package/types/eslint/styles/prefer-interface.test/main.d.ts.map +0 -1
- package/types/prettier/base.d.ts +0 -4
- package/types/prettier/base.d.ts.map +0 -1
- package/types/semantic-release/base.d.ts.map +0 -1
- package/types/semantic-release/cross-publish.d.ts.map +0 -1
- package/typescript/README.md +0 -63
- package/typescript/base.json +0 -44
- package/typescript/js-lib.json +0 -8
- package/typescript/lib.json +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
# [4.3.0-beta.2](https://github.com/peerigon/configs/compare/v4.3.0-beta.1...v4.3.0-beta.2) (2025-03-23)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- **eslint:** Turn of unicorn/consistent-function-scoping ([6570db3](https://github.com/peerigon/configs/commit/6570db32a4037f0e00d99cfacc95a024f9892b95))
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- **typescript:** Change base target to es2024 ([58b217a](https://github.com/peerigon/configs/commit/58b217ab0e4d64b7b969f1dbda748886f11009c5))
|
|
10
|
+
|
|
11
|
+
# [4.3.0-beta.1](https://github.com/peerigon/configs/compare/v4.2.0...v4.3.0-beta.1) (2025-03-12)
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- Compile JS code instead of just emitDeclarationOnly ([c7d29f7](https://github.com/peerigon/configs/commit/c7d29f700ee53aa6be5b16175b355f000fba778c))
|
|
16
|
+
|
|
1
17
|
# [4.2.0](https://github.com/peerigon/configs/compare/v4.1.0...v4.2.0) (2025-03-10)
|
|
2
18
|
|
|
3
19
|
### Features
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const globPatterns = {
|
|
2
|
+
javascript: ["**/*.{js,mjs,cjs}"],
|
|
3
|
+
typescript: ["**/*.{ts,cts,mts}"],
|
|
4
|
+
typescriptAmbient: ["**/*.d.ts"],
|
|
5
|
+
jsx: ["**/*.jsx"],
|
|
6
|
+
typescriptJsx: ["**/*.tsx"],
|
|
7
|
+
tests: [
|
|
8
|
+
"**/*.{test,spec,stories}.{js,mjs,cjs,ts,cts,mts,jsx,tsx}",
|
|
9
|
+
"**/test{s,}/**/*.{js,mjs,cjs,ts,cts,mts,jsx,tsx}",
|
|
10
|
+
],
|
|
11
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
const camelcase = {
|
|
2
|
+
allow: ["^UNSAFE_"], // Allows React UNSAFE_ methods
|
|
3
|
+
ignoreDestructuring: false,
|
|
4
|
+
properties: "always",
|
|
5
|
+
};
|
|
6
|
+
export const ruleOptions = {
|
|
7
|
+
camelcase,
|
|
8
|
+
"max-lines": {
|
|
9
|
+
max: 700,
|
|
10
|
+
skipBlankLines: true,
|
|
11
|
+
skipComments: true,
|
|
12
|
+
},
|
|
13
|
+
"no-unused-expressions": {
|
|
14
|
+
allowShortCircuit: true,
|
|
15
|
+
allowTernary: true,
|
|
16
|
+
},
|
|
17
|
+
"no-unused-vars": {
|
|
18
|
+
vars: "all",
|
|
19
|
+
varsIgnorePattern: "^_",
|
|
20
|
+
args: "after-used",
|
|
21
|
+
argsIgnorePattern: "^_",
|
|
22
|
+
caughtErrors: "all",
|
|
23
|
+
reportUsedIgnorePattern: false,
|
|
24
|
+
// This pattern is pretty common
|
|
25
|
+
ignoreRestSiblings: true,
|
|
26
|
+
},
|
|
27
|
+
"@typescript-eslint/naming-convention": (() => {
|
|
28
|
+
const options = {
|
|
29
|
+
default: {
|
|
30
|
+
selector: "default",
|
|
31
|
+
format: ["camelCase", "PascalCase", "UPPER_CASE"],
|
|
32
|
+
leadingUnderscore: "allow",
|
|
33
|
+
trailingUnderscore: "allow",
|
|
34
|
+
},
|
|
35
|
+
function: {
|
|
36
|
+
selector: "function",
|
|
37
|
+
format: ["camelCase"],
|
|
38
|
+
leadingUnderscore: "allow",
|
|
39
|
+
trailingUnderscore: "allow",
|
|
40
|
+
},
|
|
41
|
+
parameter: {
|
|
42
|
+
selector: "parameter",
|
|
43
|
+
format: ["camelCase", "PascalCase"],
|
|
44
|
+
leadingUnderscore: "allow",
|
|
45
|
+
trailingUnderscore: "allow",
|
|
46
|
+
},
|
|
47
|
+
method: {
|
|
48
|
+
selector: "method",
|
|
49
|
+
format: ["camelCase"],
|
|
50
|
+
leadingUnderscore: "allow",
|
|
51
|
+
trailingUnderscore: "allow",
|
|
52
|
+
},
|
|
53
|
+
typeLike: {
|
|
54
|
+
selector: "typeLike",
|
|
55
|
+
format: ["PascalCase"],
|
|
56
|
+
leadingUnderscore: "allow",
|
|
57
|
+
trailingUnderscore: "allow",
|
|
58
|
+
},
|
|
59
|
+
enumMember: {
|
|
60
|
+
selector: "enumMember",
|
|
61
|
+
format: ["PascalCase"],
|
|
62
|
+
leadingUnderscore: "allow",
|
|
63
|
+
trailingUnderscore: "allow",
|
|
64
|
+
},
|
|
65
|
+
// In case it's destructured, we don't want to force the developer to change the casing
|
|
66
|
+
destructuring: {
|
|
67
|
+
selector: "variable",
|
|
68
|
+
modifiers: ["destructured"],
|
|
69
|
+
format: null,
|
|
70
|
+
},
|
|
71
|
+
// In case the property name requires quotes, we don't enforce any convention
|
|
72
|
+
requiresQuites: {
|
|
73
|
+
selector: [
|
|
74
|
+
"classProperty",
|
|
75
|
+
"objectLiteralProperty",
|
|
76
|
+
"typeProperty",
|
|
77
|
+
"classMethod",
|
|
78
|
+
"objectLiteralMethod",
|
|
79
|
+
"typeMethod",
|
|
80
|
+
"accessor",
|
|
81
|
+
"enumMember",
|
|
82
|
+
],
|
|
83
|
+
modifiers: ["requiresQuotes"],
|
|
84
|
+
format: null,
|
|
85
|
+
},
|
|
86
|
+
// We don't enforce any convention on object literals since these are often used
|
|
87
|
+
// for data object where we're not in control of the type (e.g. an api that takes camel_case properties)
|
|
88
|
+
objectLiteralProperty: {
|
|
89
|
+
selector: "objectLiteralProperty",
|
|
90
|
+
format: null,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
// By enumerating all selectors explicitly we increase the
|
|
94
|
+
// specificity of these rules.
|
|
95
|
+
const escapeHatches = [
|
|
96
|
+
"variable",
|
|
97
|
+
"function",
|
|
98
|
+
"parameter",
|
|
99
|
+
"property",
|
|
100
|
+
"parameterProperty",
|
|
101
|
+
"method",
|
|
102
|
+
"accessor",
|
|
103
|
+
"enumMember",
|
|
104
|
+
"class",
|
|
105
|
+
"interface",
|
|
106
|
+
"typeAlias",
|
|
107
|
+
"enum",
|
|
108
|
+
"typeParameter",
|
|
109
|
+
].map((selector) => ({
|
|
110
|
+
filter: {
|
|
111
|
+
match: true,
|
|
112
|
+
// UNSAFE_ is a prefix used by React for all lifecycle hooks that are about to be deprecated
|
|
113
|
+
regex: "^(__|UNSAFE_).+$",
|
|
114
|
+
},
|
|
115
|
+
format: null,
|
|
116
|
+
selector,
|
|
117
|
+
}));
|
|
118
|
+
return {
|
|
119
|
+
...options,
|
|
120
|
+
defaultRules: [...Object.values(options), ...escapeHatches],
|
|
121
|
+
ignoreProperties: {
|
|
122
|
+
selector: "property",
|
|
123
|
+
format: null,
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
})(),
|
|
127
|
+
};
|
|
@@ -2,13 +2,11 @@ import eslintConfigPrettier from "eslint-config-prettier";
|
|
|
2
2
|
import { base } from "../rules/base.js";
|
|
3
3
|
import { browser } from "../rules/browser.js";
|
|
4
4
|
import { javascript } from "../rules/javascript.js";
|
|
5
|
-
|
|
6
5
|
/** @type {import("eslint").Linter.Config[]} */
|
|
7
6
|
export const javascriptBrowserPreset = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
...base,
|
|
8
|
+
...javascript,
|
|
9
|
+
...browser,
|
|
10
|
+
eslintConfigPrettier,
|
|
12
11
|
];
|
|
13
|
-
|
|
14
12
|
export default javascriptBrowserPreset;
|
|
@@ -2,13 +2,11 @@ import eslintConfigPrettier from "eslint-config-prettier";
|
|
|
2
2
|
import { base } from "../rules/base.js";
|
|
3
3
|
import { javascript } from "../rules/javascript.js";
|
|
4
4
|
import { node } from "../rules/node.js";
|
|
5
|
-
|
|
6
5
|
/** @type {import("eslint").Linter.Config[]} */
|
|
7
6
|
export const javascriptNodePreset = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
...base,
|
|
8
|
+
...javascript,
|
|
9
|
+
...node,
|
|
10
|
+
eslintConfigPrettier,
|
|
12
11
|
];
|
|
13
|
-
|
|
14
12
|
export default javascriptNodePreset;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import eslintConfigPrettier from "eslint-config-prettier";
|
|
2
2
|
import { base } from "../rules/base.js";
|
|
3
3
|
import { javascript } from "../rules/javascript.js";
|
|
4
|
-
|
|
5
4
|
/** @type {import("eslint").Linter.Config[]} */
|
|
6
5
|
export const javascriptPreset = [...base, ...javascript, eslintConfigPrettier];
|
|
7
|
-
|
|
8
6
|
export default javascriptPreset;
|
|
@@ -3,14 +3,12 @@ import { base } from "../rules/base.js";
|
|
|
3
3
|
import { javascript } from "../rules/javascript.js";
|
|
4
4
|
import { node } from "../rules/node.js";
|
|
5
5
|
import { typescript } from "../rules/typescript.js";
|
|
6
|
-
|
|
7
6
|
/** @type {import("eslint").Linter.Config[]} */
|
|
8
7
|
export const typescriptNodePreset = [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
...base,
|
|
9
|
+
...javascript,
|
|
10
|
+
...typescript,
|
|
11
|
+
...node,
|
|
12
|
+
eslintConfigPrettier,
|
|
14
13
|
];
|
|
15
|
-
|
|
16
14
|
export default typescriptNodePreset;
|
|
@@ -4,15 +4,13 @@ import { browser } from "../rules/browser.js";
|
|
|
4
4
|
import { javascript } from "../rules/javascript.js";
|
|
5
5
|
import { react } from "../rules/react.js";
|
|
6
6
|
import { typescript } from "../rules/typescript.js";
|
|
7
|
-
|
|
8
7
|
/** @type {import("eslint").Linter.Config[]} */
|
|
9
8
|
export const typescriptReactPreset = [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
...base,
|
|
10
|
+
...javascript,
|
|
11
|
+
...typescript,
|
|
12
|
+
...react,
|
|
13
|
+
...browser,
|
|
14
|
+
eslintConfigPrettier,
|
|
16
15
|
];
|
|
17
|
-
|
|
18
16
|
export default typescriptReactPreset;
|
|
@@ -2,13 +2,11 @@ import eslintConfigPrettier from "eslint-config-prettier";
|
|
|
2
2
|
import { base } from "../rules/base.js";
|
|
3
3
|
import { javascript } from "../rules/javascript.js";
|
|
4
4
|
import { typescript } from "../rules/typescript.js";
|
|
5
|
-
|
|
6
5
|
/** @type {import("eslint").Linter.Config[]} */
|
|
7
6
|
export const typescriptPreset = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
...base,
|
|
8
|
+
...javascript,
|
|
9
|
+
...typescript,
|
|
10
|
+
eslintConfigPrettier,
|
|
12
11
|
];
|
|
13
|
-
|
|
14
12
|
export default typescriptPreset;
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { includeIgnoreFile } from "@eslint/compat";
|
|
4
|
-
|
|
5
4
|
const gitignorePath = path.resolve(process.cwd(), ".gitignore");
|
|
6
5
|
const gitignoreExists = fs.existsSync(gitignorePath);
|
|
7
|
-
|
|
8
6
|
/** @type {import("eslint").Linter.Config[]} */
|
|
9
7
|
export const base = [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
gitignoreExists ? includeIgnoreFile(gitignorePath) : {},
|
|
9
|
+
{
|
|
10
|
+
linterOptions: {
|
|
11
|
+
reportUnusedDisableDirectives: "warn",
|
|
12
|
+
},
|
|
14
13
|
},
|
|
15
|
-
},
|
|
16
14
|
];
|
|
17
|
-
|
|
18
15
|
export default base;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import globals from "globals";
|
|
2
|
-
|
|
3
2
|
/** @type {import("eslint").Linter.Config[]} */
|
|
4
3
|
export const browser = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
{
|
|
5
|
+
languageOptions: {
|
|
6
|
+
globals: { ...globals.browser },
|
|
7
|
+
},
|
|
8
8
|
},
|
|
9
|
-
},
|
|
10
9
|
];
|
|
11
|
-
|
|
12
10
|
export default browser;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import unicornPlugin from "eslint-plugin-unicorn";
|
|
3
|
+
import { globPatterns } from "../lib/glob-patterns.js";
|
|
4
|
+
import { ruleOptions } from "../lib/rule-options.js";
|
|
5
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
6
|
+
export const javascript = [
|
|
7
|
+
js.configs.recommended,
|
|
8
|
+
unicornPlugin.configs["flat/recommended"],
|
|
9
|
+
{
|
|
10
|
+
rules: {
|
|
11
|
+
// Turn of too opinionated rules
|
|
12
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/issues/896
|
|
13
|
+
"unicorn/prevent-abbreviations": "off",
|
|
14
|
+
"unicorn/filename-case": "off",
|
|
15
|
+
"unicorn/no-nested-ternary": "off",
|
|
16
|
+
"unicorn/no-null": "off",
|
|
17
|
+
"unicorn/no-useless-undefined": "off",
|
|
18
|
+
"unicorn/prefer-query-selector": "off",
|
|
19
|
+
// Also turn off the following rules because they're too opinionated
|
|
20
|
+
"unicorn/consistent-function-scoping": "off", // This rule forces to move arrow functions up the scope where it is often more readable to keep the function in the scope where it is used called.
|
|
21
|
+
"unicorn/import-style": "off", // The default of import-style is highly subjective and not always the best choice. E.g. bundlers are able to tree-shake named imports easier than default imports.
|
|
22
|
+
"unicorn/no-array-for-each": "off",
|
|
23
|
+
"unicorn/no-array-reduce": "off",
|
|
24
|
+
"unicorn/no-object-as-default-parameter": "off", // This rule also complains about the object when we already use destructuring. E.g. it would complain about the following pattern which is perfectly fine: { github = false, jsr = false } = { github: true, jsr: true }
|
|
25
|
+
"unicorn/no-single-promise-in-promise-methods": "off", // It makes sense to use Promise.all() with a single promise when we expect more to be added later. In that case we don't want to refactor the code, but just add the new promise.
|
|
26
|
+
"unicorn/prefer-global-this": "off", // Too many false positives
|
|
27
|
+
"unicorn/prefer-ternary": "off",
|
|
28
|
+
"unicorn/require-array-join-separator": "off",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
linterOptions: {
|
|
33
|
+
reportUnusedDisableDirectives: "warn",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
files: globPatterns.javascript,
|
|
38
|
+
languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
rules: {
|
|
42
|
+
// Possible Problems
|
|
43
|
+
// ----------------------------------------------
|
|
44
|
+
"array-callback-return": "warn", // https://eslint.org/docs/latest/rules/array-callback-return
|
|
45
|
+
"no-await-in-loop": "warn", // https://eslint.org/docs/latest/rules/no-await-in-loop
|
|
46
|
+
"no-constructor-return": "warn", // https://eslint.org/docs/latest/rules/no-constructor-return
|
|
47
|
+
"no-duplicate-imports": "warn", // https://eslint.org/docs/latest/rules/no-duplicate-imports
|
|
48
|
+
"no-promise-executor-return": "warn", // https://eslint.org/docs/latest/rules/no-promise-executor-return
|
|
49
|
+
"no-self-compare": "warn", // https://eslint.org/docs/latest/rules/no-self-compare
|
|
50
|
+
"no-template-curly-in-string": "warn", // https://eslint.org/docs/latest/rules/no-template-curly-in-string
|
|
51
|
+
"no-unmodified-loop-condition": "warn", // https://eslint.org/docs/latest/rules/no-unmodified-loop-condition
|
|
52
|
+
"no-unreachable-loop": "warn", // https://eslint.org/docs/latest/rules/no-unreachable-loop
|
|
53
|
+
"no-useless-assignment": "warn", // https://eslint.org/docs/latest/rules/no-useless-assignment
|
|
54
|
+
"require-atomic-updates": "warn", // https://eslint.org/docs/latest/rules/require-atomic-updates
|
|
55
|
+
// Suggestions
|
|
56
|
+
// ----------------------------------------------
|
|
57
|
+
"accessor-pairs": "warn", // https://eslint.org/docs/latest/rules/accessor-pairs
|
|
58
|
+
"block-scoped-var": "warn", // https://eslint.org/docs/latest/rules/block-scoped-var
|
|
59
|
+
camelcase: ["warn", ruleOptions.camelcase], // https://eslint.org/docs/latest/rules/camelcase
|
|
60
|
+
"consistent-return": "warn", // https://eslint.org/docs/latest/rules/consistent-return
|
|
61
|
+
"dot-notation": "warn", // https://eslint.org/docs/latest/rules/dot-notation
|
|
62
|
+
eqeqeq: ["warn", "always", { null: "ignore" }], // https://eslint.org/docs/latest/rules/eqeqeq
|
|
63
|
+
"func-style": ["warn", "declaration"], // https://eslint.org/docs/latest/rules/func-style
|
|
64
|
+
"grouped-accessor-pairs": ["warn", "setBeforeGet"], // https://eslint.org/docs/latest/rules/grouped-accessor-pairs
|
|
65
|
+
"max-depth": ["warn", 5], // https://eslint.org/docs/latest/rules/max-depth
|
|
66
|
+
"max-nested-callbacks": ["warn", 3], // https://eslint.org/docs/latest/rules/max-nested-callbacks
|
|
67
|
+
"max-params": ["warn", { max: 4 }], // https://eslint.org/docs/latest/rules/max-params
|
|
68
|
+
"new-cap": "warn", // https://eslint.org/docs/latest/rules/new-cap
|
|
69
|
+
"no-alert": "warn", // https://eslint.org/docs/latest/rules/no-alert
|
|
70
|
+
"no-array-constructor": "warn", // https://eslint.org/docs/latest/rules/no-array-constructor
|
|
71
|
+
"no-bitwise": "warn", // https://eslint.org/docs/latest/rules/no-bitwise
|
|
72
|
+
"no-caller": "warn", // https://eslint.org/docs/latest/rules/no-caller
|
|
73
|
+
"no-else-return": "warn", // https://eslint.org/docs/latest/rules/no-else-return
|
|
74
|
+
"no-eval": "warn", // https://eslint.org/docs/latest/rules/no-eval
|
|
75
|
+
"no-extend-native": "warn", // https://eslint.org/docs/latest/rules/no-extend-native
|
|
76
|
+
"no-extra-bind": "warn", // https://eslint.org/docs/latest/rules/no-extra-bind
|
|
77
|
+
"no-extra-label": "warn", // https://eslint.org/docs/latest/rules/no-extra-label
|
|
78
|
+
"no-implicit-globals": "warn", // https://eslint.org/docs/latest/rules/no-implicit-globals
|
|
79
|
+
"no-implied-eval": "warn", // https://eslint.org/docs/latest/rules/no-implied-eval
|
|
80
|
+
"no-iterator": "warn", // https://eslint.org/docs/latest/rules/no-iterator
|
|
81
|
+
"no-label-var": "warn", // https://eslint.org/docs/latest/rules/no-label-var
|
|
82
|
+
"no-labels": "warn", // https://eslint.org/docs/latest/rules/no-labels
|
|
83
|
+
"no-lone-blocks": "warn", // https://eslint.org/docs/latest/rules/no-lone-blocks
|
|
84
|
+
"no-multi-str": "warn", // https://eslint.org/docs/latest/rules/no-multi-str
|
|
85
|
+
"no-negated-condition": "warn", // https://eslint.org/docs/latest/rules/no-negated-condition
|
|
86
|
+
"no-new": "warn", // https://eslint.org/docs/latest/rules/no-new
|
|
87
|
+
"no-new-func": "warn", // https://eslint.org/docs/latest/rules/no-new-func
|
|
88
|
+
"no-new-wrappers": "warn", // https://eslint.org/docs/latest/rules/no-new-wrappers
|
|
89
|
+
"no-object-constructor": "warn", // https://eslint.org/docs/latest/rules/no-object-constructor
|
|
90
|
+
"no-octal-escape": "warn", // https://eslint.org/docs/latest/rules/no-octal-escape
|
|
91
|
+
"no-proto": "warn", // https://eslint.org/docs/latest/rules/no-proto
|
|
92
|
+
"no-restricted-exports": [
|
|
93
|
+
"warn",
|
|
94
|
+
{
|
|
95
|
+
restrictedNamedExports: [
|
|
96
|
+
// If "then" is a function, the module will not be loadedable by an async import()
|
|
97
|
+
// because it looks like a promise. The JS engine will call the .then() function in that case
|
|
98
|
+
// Since this is super confusing, let's warn the user about it
|
|
99
|
+
"then",
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
], // https://eslint.org/docs/latest/rules/no-restricted-exports
|
|
103
|
+
"no-restricted-globals": ["warn", "event"], // https://eslint.org/docs/latest/rules/no-restricted-globals
|
|
104
|
+
"no-restricted-syntax": ["warn", "WithStatement"], // https://eslint.org/docs/latest/rules/no-restricted-syntax
|
|
105
|
+
"no-script-url": "warn", // https://eslint.org/docs/latest/rules/no-script-url
|
|
106
|
+
"no-sequences": "warn", // https://eslint.org/docs/latest/rules/no-sequences
|
|
107
|
+
"no-throw-literal": "warn", // https://eslint.org/docs/latest/rules/no-throw-literal
|
|
108
|
+
"no-undef-init": "warn", // https://eslint.org/docs/latest/rules/no-undef-init
|
|
109
|
+
"no-unneeded-ternary": "warn", // https://eslint.org/docs/latest/rules/no-unneeded-ternary
|
|
110
|
+
"no-unused-expressions": ["warn", ruleOptions["no-unused-expressions"]], // https://eslint.org/docs/latest/rules/no-unused-expressions
|
|
111
|
+
"no-unused-vars": ["error", ruleOptions["no-unused-vars"]],
|
|
112
|
+
"no-useless-call": "warn", // https://eslint.org/docs/latest/rules/no-useless-call
|
|
113
|
+
"no-useless-computed-key": "warn", // https://eslint.org/docs/latest/rules/no-useless-computed-key
|
|
114
|
+
"no-useless-concat": "warn", // https://eslint.org/docs/latest/rules/no-useless-concat
|
|
115
|
+
"no-useless-constructor": "warn", // https://eslint.org/docs/latest/rules/no-useless-constructor
|
|
116
|
+
"no-useless-escape": "warn", // https://eslint.org/docs/latest/rules/no-useless-escape
|
|
117
|
+
"no-useless-rename": "warn", // https://eslint.org/docs/latest/rules/no-useless-rename
|
|
118
|
+
"no-useless-return": "warn", // https://eslint.org/docs/latest/rules/no-useless-return
|
|
119
|
+
"no-var": "warn", // https://eslint.org/docs/latest/rules/no-var
|
|
120
|
+
"object-shorthand": ["warn", "always"], // https://eslint.org/docs/latest/rules/object-shorthand
|
|
121
|
+
"one-var": ["warn", "never"], // https://eslint.org/docs/latest/rules/one-var
|
|
122
|
+
"prefer-arrow-callback": "warn", // https://eslint.org/docs/latest/rules/prefer-arrow-callback
|
|
123
|
+
"prefer-const": "warn", // https://eslint.org/docs/latest/rules/prefer-const
|
|
124
|
+
"prefer-exponentiation-operator": "warn", // https://eslint.org/docs/latest/rules/prefer-exponentiation-operator
|
|
125
|
+
"prefer-numeric-literals": "warn", // https://eslint.org/docs/latest/rules/prefer-numeric-literals
|
|
126
|
+
"prefer-object-has-own": "warn", // https://eslint.org/docs/latest/rules/prefer-object-has-own
|
|
127
|
+
"prefer-promise-reject-errors": "warn", // https://eslint.org/docs/latest/rules/prefer-promise-reject-errors
|
|
128
|
+
"prefer-regex-literals": "warn", // https://eslint.org/docs/latest/rules/prefer-regex-literals
|
|
129
|
+
"prefer-rest-params": "warn", // https://eslint.org/docs/latest/rules/prefer-rest-params
|
|
130
|
+
"prefer-spread": "warn", // https://eslint.org/docs/latest/rules/prefer-spread
|
|
131
|
+
strict: "warn", // https://eslint.org/docs/latest/rules/strict
|
|
132
|
+
"symbol-description": "warn", // https://eslint.org/docs/latest/rules/symbol-description
|
|
133
|
+
yoda: ["warn", "never"], // https://eslint.org/docs/latest/rules/yoda
|
|
134
|
+
// Layout & Formatting
|
|
135
|
+
// ----------------------------------------------
|
|
136
|
+
"unicode-bom": "warn", // https://eslint.org/docs/latest/rules/unicode-bom
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
files: globPatterns.tests,
|
|
141
|
+
rules: {
|
|
142
|
+
// Top-level await might slow down the test suite start up
|
|
143
|
+
"unicorn/prefer-top-level-await": "off",
|
|
144
|
+
// Nesting is pretty common in tests when you group tests
|
|
145
|
+
"max-nested-callbacks": "off",
|
|
146
|
+
// In case you want to test errors thrown by a constructor
|
|
147
|
+
"no-new": "off",
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
];
|
|
151
|
+
export default javascript;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import globals from "globals";
|
|
2
|
-
|
|
3
2
|
/** @type {import("eslint").Linter.Config[]} */
|
|
4
3
|
export const node = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
{
|
|
5
|
+
languageOptions: {
|
|
6
|
+
globals: { ...globals.node },
|
|
7
|
+
},
|
|
8
8
|
},
|
|
9
|
-
},
|
|
10
9
|
];
|
|
11
|
-
|
|
12
10
|
export default node;
|