@r2d2bzh/eslint-config 1.0.5 → 2.0.1
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/README.adoc +13 -8
- package/index.js +32 -23
- package/package.json +18 -13
package/README.adoc
CHANGED
|
@@ -11,27 +11,32 @@ The current set of rules provided by this shared configuration follows:
|
|
|
11
11
|
|
|
12
12
|
[source,js]
|
|
13
13
|
----
|
|
14
|
-
include
|
|
14
|
+
include::./index.js[tag=rules]
|
|
15
15
|
----
|
|
16
16
|
|
|
17
17
|
== Install
|
|
18
18
|
|
|
19
19
|
You need to add the following NPM development dependency to the project that needs to be checked:
|
|
20
20
|
|
|
21
|
-
`npm install --save-dev @r2d2bzh/eslint-config#<VERSION>`
|
|
21
|
+
`npm install --save-dev eslint @r2d2bzh/eslint-config#<VERSION>`
|
|
22
22
|
|
|
23
23
|
NOTE: Replace `<VERSION>` with a git tag of the https://github.com/r2d2bzh/eslint-config/releases[`eslint-config` repository].
|
|
24
24
|
|
|
25
25
|
This will add the package `eslint-config` in your repo.
|
|
26
26
|
|
|
27
|
-
In order to instruct eslint to apply these rules, you need to create an `eslintrc.
|
|
27
|
+
In order to instruct eslint to apply these rules, you need to create an `eslintrc.js` file close to the `package.json` file:
|
|
28
28
|
|
|
29
|
-
.eslintrc.
|
|
30
|
-
[source,
|
|
29
|
+
.eslintrc.js
|
|
30
|
+
[source,js]
|
|
31
31
|
----
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
import { defineConfig } from 'eslint/config';
|
|
33
|
+
import r2d2bzhEslintConfig from '@r2d2bzh/eslint-config';
|
|
34
|
+
|
|
35
|
+
export default defineConfig([
|
|
36
|
+
{
|
|
37
|
+
extends: [r2d2bzhEslintConfig],
|
|
38
|
+
},
|
|
39
|
+
]);
|
|
35
40
|
----
|
|
36
41
|
|
|
37
42
|
WARNING: This package has peer dependencies that you need to install manually.
|
package/index.js
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'plugin:promise/recommended',
|
|
15
|
-
'plugin:security/recommended-legacy',
|
|
16
|
-
'plugin:unicorn/recommended',
|
|
17
|
-
],
|
|
18
|
-
rules:
|
|
1
|
+
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
2
|
+
|
|
3
|
+
import eslintPluginPrettier from 'eslint-plugin-prettier/recommended';
|
|
4
|
+
import eslintPluginAva from 'eslint-plugin-ava';
|
|
5
|
+
import eslintPluginImport from 'eslint-plugin-import';
|
|
6
|
+
import eslintPluginPromise from 'eslint-plugin-promise';
|
|
7
|
+
import eslintPluginSecurity from 'eslint-plugin-security';
|
|
8
|
+
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
|
|
9
|
+
|
|
10
|
+
export default defineConfig([
|
|
11
|
+
globalIgnores(['**/node_modules', '**/coverage', '/__tests__']),
|
|
12
|
+
{
|
|
13
|
+
files: ['**/*.js'],
|
|
19
14
|
// tag::rules[]
|
|
20
|
-
{
|
|
15
|
+
rules: {
|
|
21
16
|
// https://prettier.io/docs/en/integrating-with-linters.html#use-eslint-to-run-prettier
|
|
22
17
|
// https://github.com/prettier/eslint-plugin-prettier#options
|
|
23
18
|
'prettier/prettier': [
|
|
@@ -49,11 +44,11 @@ module.exports = {
|
|
|
49
44
|
// https://eslint.org/docs/rules/complexity
|
|
50
45
|
complexity: ['error', { max: 5 }],
|
|
51
46
|
// https://eslint.org/docs/rules/max-statements
|
|
52
|
-
'max-statements': ['error', { max:
|
|
47
|
+
'max-statements': ['error', { max: 15 }],
|
|
53
48
|
// https://eslint.org/docs/rules/max-statements-per-line
|
|
54
49
|
'max-statements-per-line': ['error', { max: 1 }],
|
|
55
50
|
// https://eslint.org/docs/rules/max-nested-callbacks
|
|
56
|
-
'max-nested-callbacks': ['error', { max:
|
|
51
|
+
'max-nested-callbacks': ['error', { max: 3 }],
|
|
57
52
|
// https://eslint.org/docs/rules/max-depth
|
|
58
53
|
'max-depth': ['error', { max: 2 }],
|
|
59
54
|
// https://eslint.org/docs/rules/max-params
|
|
@@ -68,6 +63,20 @@ module.exports = {
|
|
|
68
63
|
'ava/prefer-power-assert': 'warn',
|
|
69
64
|
// https://github.com/import-js/eslint-plugin-import/issues/2703
|
|
70
65
|
'import/no-unresolved': 'off',
|
|
66
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v52.0.0/docs/rules/no-anonymous-default-export.md
|
|
67
|
+
'unicorn/no-anonymous-default-export': 'off',
|
|
68
|
+
},
|
|
69
|
+
// end::rules[]
|
|
70
|
+
plugins: {
|
|
71
|
+
ava: eslintPluginAva,
|
|
72
|
+
import: eslintPluginImport,
|
|
73
|
+
promise: eslintPluginPromise,
|
|
74
|
+
security: eslintPluginSecurity,
|
|
75
|
+
unicorn: eslintPluginUnicorn,
|
|
71
76
|
},
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
settings: {
|
|
78
|
+
'import/core-modules': ['ava'],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
eslintPluginPrettier,
|
|
82
|
+
]);
|
package/package.json
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@r2d2bzh/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "r2d2bzh eslint configuration",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"
|
|
7
|
-
"test": "eslint ."
|
|
8
|
-
},
|
|
6
|
+
"type": "module",
|
|
9
7
|
"repository": {
|
|
10
8
|
"type": "git",
|
|
11
9
|
"url": "git+https://github.com/r2d2bzh/eslint-config.git"
|
|
@@ -24,15 +22,22 @@
|
|
|
24
22
|
"publishConfig": {
|
|
25
23
|
"access": "public"
|
|
26
24
|
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
27
|
+
"@eslint/js": "^9.34.0",
|
|
28
|
+
"eslint-config-prettier": "^10.1.8",
|
|
29
|
+
"eslint-plugin-ava": "^15.1.0",
|
|
30
|
+
"eslint-plugin-import": "^2.32.0",
|
|
31
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
32
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
33
|
+
"eslint-plugin-security": "^3.0.1",
|
|
34
|
+
"eslint-plugin-unicorn": "^60.0.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"release-it": "^19.0.4",
|
|
38
|
+
"@release-it/conventional-changelog": "10.0.1"
|
|
39
|
+
},
|
|
27
40
|
"peerDependencies": {
|
|
28
|
-
"eslint": ">=
|
|
29
|
-
"eslint-config-prettier": ">=9.1.0",
|
|
30
|
-
"eslint-plugin-ava": ">=14.0.0",
|
|
31
|
-
"eslint-plugin-import": ">=2.29.1",
|
|
32
|
-
"eslint-plugin-prettier": ">=5.1.3",
|
|
33
|
-
"eslint-plugin-promise": ">=6.1.1",
|
|
34
|
-
"eslint-plugin-security": ">=3.0.0",
|
|
35
|
-
"eslint-plugin-unicorn": ">=52.0.0",
|
|
36
|
-
"prettier": ">=3.2.5"
|
|
41
|
+
"eslint": ">=9"
|
|
37
42
|
}
|
|
38
43
|
}
|