@anolilab/eslint-config 2.2.0 → 3.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/CHANGELOG.md +19 -0
- package/README.md +2 -2
- package/config.cjs +43 -43
- package/index.cjs +4 -4
- package/package.json +18 -18
- package/rules/plugins/babel.cjs +22 -22
- package/rules/plugins/react.cjs +7 -4
- package/rules/plugins/simple-import-sort.cjs +1 -1
- package/rules/plugins/testing-library.cjs +2 -2
- package/rules/plugins/unicorn.cjs +10 -25
- package/rules/variables.cjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## @anolilab/eslint-config [3.0.0](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/eslint-config@2.2.0...@anolilab/eslint-config@3.0.0) (2022-02-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### ⚠ BREAKING CHANGES
|
|
5
|
+
|
|
6
|
+
* remove old node version from our supported versions
|
|
7
|
+
|
|
8
|
+
Signed-off-by: prisis <d.bannert@anolilab.de>
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* fixed wrong version on peer dependencies ([fc28d8b](https://github.com/anolilab/javascript-style-guide/commit/fc28d8b990bea3004283dfb37a249d0ffe3e476f))
|
|
13
|
+
* markdown lint ([24059d4](https://github.com/anolilab/javascript-style-guide/commit/24059d41ca682ca21b39ad7f6dff594be734329d))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Performance Improvements
|
|
17
|
+
|
|
18
|
+
* support for v12, v14 was removed from our supported versions of node ([83d6a80](https://github.com/anolilab/javascript-style-guide/commit/83d6a8058ed7791135aff03d4cd734327bb1b694))
|
|
19
|
+
|
|
1
20
|
## @anolilab/eslint-config [2.2.0](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/eslint-config@2.1.8...@anolilab/eslint-config@2.2.0) (2021-10-26)
|
|
2
21
|
|
|
3
22
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ESLint config
|
|
2
2
|
|
|
3
|
-
This package provides Anolilab’s .eslintrc.cjs as an extensible shared config, with a range of useful plugins that are often too time-consuming to setup and provides an
|
|
3
|
+
This package provides Anolilab’s .eslintrc.cjs as an extensible shared config, with a range of useful plugins that are often too time-consuming to setup and provides an install the plugins you need, based on your project’s dependencies.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -297,7 +297,7 @@ Therefore, `@anolilab/eslint-config` also inherits the philosophy of ESLint. It
|
|
|
297
297
|
## Supported Node.js Versions
|
|
298
298
|
|
|
299
299
|
Libraries in this ecosystem make the best effort to track
|
|
300
|
-
[Node.js
|
|
300
|
+
[Node.js’ release schedule](https://nodejs.org/en/about/releases/). Here’s [a
|
|
301
301
|
post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
|
|
302
302
|
|
|
303
303
|
Contributing
|
package/config.cjs
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
const { hasAnyDep, hasTypescript } = require(
|
|
2
|
-
const isModuleAvailable = require(
|
|
1
|
+
const { hasAnyDep, hasTypescript } = require("./lib/utils.cjs");
|
|
2
|
+
const isModuleAvailable = require("./lib/is-module-available.cjs");
|
|
3
3
|
|
|
4
4
|
// Base rules
|
|
5
|
-
const rules = [
|
|
5
|
+
const rules = ["best-practices", "errors", "style", "es6", "variables"];
|
|
6
6
|
|
|
7
7
|
// Base plugin rules
|
|
8
8
|
const pRules = [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
"compat",
|
|
10
|
+
"eslint-comments",
|
|
11
|
+
"import",
|
|
12
|
+
"json",
|
|
13
|
+
"markdown",
|
|
14
|
+
"optimize-regex",
|
|
15
|
+
"promise",
|
|
16
|
+
"simple-import-sort",
|
|
17
|
+
"unicorn",
|
|
18
|
+
"you-dont-need-lodash-underscore",
|
|
19
|
+
"you-dont-need-momentjs",
|
|
20
20
|
|
|
21
21
|
// Security Rules
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
"no-secrets",
|
|
23
|
+
"radar",
|
|
24
24
|
];
|
|
25
25
|
|
|
26
26
|
// Optionals rules based on project dependencies
|
|
27
27
|
const depRules = [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
[
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
[
|
|
38
|
-
[
|
|
39
|
-
[
|
|
28
|
+
"array-func",
|
|
29
|
+
"html",
|
|
30
|
+
"mdx",
|
|
31
|
+
"react-redux",
|
|
32
|
+
"no-unsanitized",
|
|
33
|
+
"lodash",
|
|
34
|
+
["lodash", "lodash-fp"],
|
|
35
|
+
"jsdoc",
|
|
36
|
+
"react",
|
|
37
|
+
["mdx", "eslint-plugin-react"],
|
|
38
|
+
["react-a11y", "react"],
|
|
39
|
+
["react-hooks", "react"],
|
|
40
40
|
];
|
|
41
41
|
|
|
42
42
|
const testRules = [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
[
|
|
46
|
-
|
|
47
|
-
[
|
|
48
|
-
[
|
|
49
|
-
[
|
|
43
|
+
"cypress",
|
|
44
|
+
"jest",
|
|
45
|
+
["jest", "jest-async", "jest-dom"],
|
|
46
|
+
"jest-dom",
|
|
47
|
+
["jest-formatting", "jest"],
|
|
48
|
+
["@testing-library/jest-dom", "jest-dom"],
|
|
49
|
+
["@testing-library/dom", "testing-library"],
|
|
50
50
|
];
|
|
51
51
|
|
|
52
52
|
// Extra required optional packages
|
|
53
53
|
const extraInstalled = [];
|
|
54
54
|
|
|
55
55
|
depRules.forEach((depRule) => {
|
|
56
|
-
const rule = typeof depRule ===
|
|
56
|
+
const rule = typeof depRule === "string" ? [depRule, depRule] : depRule;
|
|
57
57
|
|
|
58
58
|
if (hasAnyDep(rule[0])) {
|
|
59
59
|
pRules.push(rule[1]);
|
|
@@ -61,7 +61,7 @@ depRules.forEach((depRule) => {
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
testRules.forEach((depRule) => {
|
|
64
|
-
const rule = typeof depRule ===
|
|
64
|
+
const rule = typeof depRule === "string" ? [depRule, depRule] : depRule;
|
|
65
65
|
|
|
66
66
|
if (isModuleAvailable(rule[0])) {
|
|
67
67
|
pRules.push(rule[1]);
|
|
@@ -69,16 +69,16 @@ testRules.forEach((depRule) => {
|
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
if (hasTypescript) {
|
|
72
|
-
pRules.push(
|
|
73
|
-
extraInstalled.push([
|
|
72
|
+
pRules.push("typescript");
|
|
73
|
+
extraInstalled.push(["@typescript-eslint/parser", "@typescript-eslint/eslint-plugin"]);
|
|
74
74
|
|
|
75
|
-
if (hasAnyDep(
|
|
76
|
-
pRules.push(
|
|
75
|
+
if (hasAnyDep("eslint-plugin-typescript-sort-keys")) {
|
|
76
|
+
pRules.push("typescript-sort-keys");
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
module.exports = {
|
|
81
81
|
rules,
|
|
82
82
|
pluginRules: pRules,
|
|
83
|
-
extraInstallPackage: extraInstalled
|
|
84
|
-
}
|
|
83
|
+
extraInstallPackage: extraInstalled,
|
|
84
|
+
};
|
package/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const path = require(
|
|
2
|
-
const checkMissing = require(
|
|
3
|
-
const showLoaded = require(
|
|
4
|
-
const { rules, pluginRules, extraInstallPackage } = require(
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const checkMissing = require("./lib/check-missing.cjs");
|
|
3
|
+
const showLoaded = require("./lib/show-loaded.cjs");
|
|
4
|
+
const { rules, pluginRules, extraInstallPackage } = require("./config.cjs");
|
|
5
5
|
|
|
6
6
|
// Workaround VS Code trying to run this file twice!
|
|
7
7
|
if (!global.hasAnolilabEsLintConfigLoaded) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anolilab/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "ESLint shareable config for the Anolilab JavaScript style guide.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -77,34 +77,34 @@
|
|
|
77
77
|
"semver": "^7.3.5"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@testing-library/dom": "8.
|
|
80
|
+
"@testing-library/dom": "8.11.2",
|
|
81
81
|
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
82
|
-
"@typescript-eslint/parser": "5.
|
|
83
|
-
"eslint": "8.
|
|
84
|
-
"eslint-find-rules": "
|
|
82
|
+
"@typescript-eslint/parser": "5.10.0",
|
|
83
|
+
"eslint": "8.7.0",
|
|
84
|
+
"eslint-find-rules": "4.1.0",
|
|
85
85
|
"eslint-plugin-babel": "5.3.1",
|
|
86
86
|
"eslint-plugin-cypress": "2.12.1",
|
|
87
|
-
"eslint-plugin-jest": "25.
|
|
87
|
+
"eslint-plugin-jest": "25.7.0",
|
|
88
88
|
"eslint-plugin-jest-async": "1.0.3",
|
|
89
|
-
"eslint-plugin-jest-dom": "
|
|
90
|
-
"eslint-plugin-jest-formatting": "3.
|
|
91
|
-
"eslint-plugin-jsdoc": "37.
|
|
89
|
+
"eslint-plugin-jest-dom": "4.0.1",
|
|
90
|
+
"eslint-plugin-jest-formatting": "3.1.0",
|
|
91
|
+
"eslint-plugin-jsdoc": "37.6.3",
|
|
92
92
|
"eslint-plugin-json": "3.1.0",
|
|
93
|
-
"eslint-plugin-jsx-a11y": "6.
|
|
93
|
+
"eslint-plugin-jsx-a11y": "6.5.1",
|
|
94
94
|
"eslint-plugin-mdx": "1.16.0",
|
|
95
95
|
"eslint-plugin-node": "11.1.0",
|
|
96
96
|
"eslint-plugin-prefer-object-spread": "1.2.1",
|
|
97
|
-
"eslint-plugin-react": "7.
|
|
98
|
-
"eslint-plugin-react-hooks": "4.
|
|
99
|
-
"eslint-plugin-react-redux": "3.3.
|
|
100
|
-
"eslint-plugin-testing-library": "5.0.
|
|
101
|
-
"eslint-plugin-typescript-sort-keys": "2.
|
|
102
|
-
"jest": "27.
|
|
97
|
+
"eslint-plugin-react": "7.28.0",
|
|
98
|
+
"eslint-plugin-react-hooks": "4.3.0",
|
|
99
|
+
"eslint-plugin-react-redux": "3.3.4",
|
|
100
|
+
"eslint-plugin-testing-library": "5.0.4",
|
|
101
|
+
"eslint-plugin-typescript-sort-keys": "2.1.0",
|
|
102
|
+
"jest": "27.4.7",
|
|
103
103
|
"react": "17.0.2",
|
|
104
104
|
"typescript": "^4.4.4"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
|
-
"eslint": "^
|
|
107
|
+
"eslint": "^7.32.0"
|
|
108
108
|
},
|
|
109
109
|
"optionalDependencies": {
|
|
110
110
|
"@typescript-eslint/eslint-plugin": "^5.2.0",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"eslint-plugin-typescript-sort-keys": "^2.0.0"
|
|
129
129
|
},
|
|
130
130
|
"engines": {
|
|
131
|
-
"node": ">=
|
|
131
|
+
"node": ">=16"
|
|
132
132
|
},
|
|
133
133
|
"publishConfig": {
|
|
134
134
|
"access": "public"
|
package/rules/plugins/babel.cjs
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
const { rules: baseBestPracticesRules } = require(
|
|
2
|
-
const { rules: errorsRules } = require(
|
|
3
|
-
const { rules: styleRules } = require(
|
|
1
|
+
const { rules: baseBestPracticesRules } = require("../best-practices.cjs");
|
|
2
|
+
const { rules: errorsRules } = require("../errorsRules.cjs");
|
|
3
|
+
const { rules: styleRules } = require("../styleRules.cjs");
|
|
4
4
|
|
|
5
5
|
module.exports = {
|
|
6
|
-
plugins: [
|
|
6
|
+
plugins: ["babel"],
|
|
7
7
|
rules: {
|
|
8
|
-
camelcase:
|
|
9
|
-
|
|
8
|
+
camelcase: "off",
|
|
9
|
+
"babel/camelcase": [
|
|
10
10
|
// Deep clone to avoid object mutation wierdness
|
|
11
11
|
styleRules.camelcase[0],
|
|
12
12
|
{ ...styleRules.camelcase[1] },
|
|
13
13
|
],
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
"new-cap": "off",
|
|
16
|
+
"babel/new-cap": styleRules["new-cap"],
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
"no-invalid-this": "off",
|
|
19
|
+
"babel/no-invalid-this": baseBestPracticesRules["no-invalid-this"],
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
"object-curly-spacing": "off",
|
|
22
|
+
"babel/object-curly-spacing": styleRules["object-curly-spacing"],
|
|
23
23
|
|
|
24
|
-
quotes:
|
|
25
|
-
|
|
24
|
+
quotes: "off",
|
|
25
|
+
"babel/quotes": styleRules.quotes,
|
|
26
26
|
|
|
27
|
-
semi:
|
|
28
|
-
|
|
27
|
+
semi: "off",
|
|
28
|
+
"babel/semi": styleRules.semi,
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
"no-unused-expressions": "off",
|
|
31
|
+
"babel/no-unused-expressions": baseBestPracticesRules["no-unused-expressions"],
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
}
|
|
33
|
+
"valid-typeof": "off",
|
|
34
|
+
"babel/valid-typeof": errorsRules["valid-typeof"],
|
|
35
|
+
},
|
|
36
|
+
};
|
package/rules/plugins/react.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @see https://github.com/yannickcr/eslint-plugin-react
|
|
2
|
-
const assign = require(
|
|
3
|
-
const { hasAnyDep } = require(
|
|
4
|
-
const { rules: baseStyleRules } = require(
|
|
2
|
+
const assign = require("object.assign");
|
|
3
|
+
const { hasAnyDep } = require("../../lib/utils.cjs");
|
|
4
|
+
const { rules: baseStyleRules } = require("../style.cjs");
|
|
5
5
|
|
|
6
6
|
const dangleRules = baseStyleRules["no-underscore-dangle"];
|
|
7
7
|
|
|
@@ -387,7 +387,10 @@ module.exports = {
|
|
|
387
387
|
|
|
388
388
|
// only .jsx files may have JSX
|
|
389
389
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
|
|
390
|
-
"react/jsx-filename-extension": [
|
|
390
|
+
"react/jsx-filename-extension": [
|
|
391
|
+
"error",
|
|
392
|
+
{ extensions: [".jsx"].concat(hasAnyDep("typescript") ? [".tsx"] : []) },
|
|
393
|
+
],
|
|
391
394
|
|
|
392
395
|
// prevent accidental JS comments from being injected into JSX as text
|
|
393
396
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const isModuleAvailable = require(
|
|
2
|
-
const { consoleLog } = require(
|
|
1
|
+
const isModuleAvailable = require("../../lib/is-module-available.cjs");
|
|
2
|
+
const { consoleLog } = require("../../lib/loggers.cjs");
|
|
3
3
|
|
|
4
4
|
let ruleset;
|
|
5
5
|
|
|
@@ -1,33 +1,18 @@
|
|
|
1
|
-
const semver = require(
|
|
1
|
+
const semver = require("semver");
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
-
plugins: [
|
|
5
|
-
"unicorn"
|
|
6
|
-
],
|
|
4
|
+
plugins: ["unicorn"],
|
|
7
5
|
extends: ["plugin:unicorn/recommended"],
|
|
8
6
|
rules: {
|
|
9
|
-
"unicorn/prefer-node-protocol": semver.gte(process.version,
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
"unicorn/prefer-node-protocol": semver.gte(process.version, "v16.0.0") ? "error" : "off",
|
|
8
|
+
"unicorn/template-indent": [
|
|
9
|
+
"warn",
|
|
12
10
|
{
|
|
13
|
-
tags: [
|
|
14
|
-
|
|
15
|
-
'dedent',
|
|
16
|
-
'gql',
|
|
17
|
-
'sql',
|
|
18
|
-
'html',
|
|
19
|
-
'styled'
|
|
20
|
-
],
|
|
21
|
-
functions: [
|
|
22
|
-
'dedent',
|
|
23
|
-
'stripIndent'
|
|
24
|
-
],
|
|
11
|
+
tags: ["outdent", "dedent", "gql", "sql", "html", "styled"],
|
|
12
|
+
functions: ["dedent", "stripIndent"],
|
|
25
13
|
selectors: [],
|
|
26
|
-
comments: [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
]
|
|
14
|
+
comments: ["HTML", "indent"],
|
|
15
|
+
},
|
|
16
|
+
],
|
|
32
17
|
},
|
|
33
18
|
};
|
package/rules/variables.cjs
CHANGED