eslint-config-fabulator 3.1.0 → 4.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 +12 -0
- package/index.js +51 -109
- package/jest.js +14 -11
- package/package.json +23 -23
- package/react.js +42 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
+
## v4.0.0 (2023-12-16)
|
|
5
|
+
### Fixed
|
|
6
|
+
- [3b2fa3f](https://github.com/fabulator/eslint-config-fabulator/commit/3b2fa3fe3b1f694d677c786dcec30b7369833a00) formatting
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
- [84e0c6f](https://github.com/fabulator/eslint-config-fabulator/commit/84e0c6fac7572bffda067eaae1e60d9ed32ce20d) Use recommended settings for plugins BREAKING
|
|
10
|
+
|
|
11
|
+
## v3.2.0 (2023-12-16)
|
|
12
|
+
### Changed
|
|
13
|
+
- [d54b311](https://github.com/fabulator/eslint-config-fabulator/commit/d54b311c2537244edd9b81d18193fda4ea1b2451) Bump dependencies
|
|
14
|
+
- [db40b4f](https://github.com/fabulator/eslint-config-fabulator/commit/db40b4ffe8643ba1b7e7e32696d5c93ff33cedf0) Bump dependencies
|
|
15
|
+
|
|
4
16
|
## v3.1.0 (2023-04-20)
|
|
5
17
|
### Changed
|
|
6
18
|
- [dff9d98](https://github.com/fabulator/eslint-config-fabulator/commit/dff9d984f7f07f9d06409c7a6f469befdfbb30f1) disable react/function-component-definition
|
package/index.js
CHANGED
|
@@ -1,116 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
1
|
+
// eslint-disable-next-line canonical/filename-no-index
|
|
2
|
+
const jestConfig = require("./jest");
|
|
3
|
+
const reactConfig = require("./react");
|
|
3
4
|
|
|
4
|
-
/* eslint-disable max-len */
|
|
5
5
|
module.exports = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
extends: [
|
|
7
|
+
"eslint:recommended",
|
|
8
|
+
"plugin:sonarjs/recommended",
|
|
9
|
+
"plugin:canonical/recommended",
|
|
10
|
+
"plugin:import/recommended",
|
|
11
|
+
"plugin:array-func/recommended",
|
|
12
|
+
"plugin:prettier/recommended",
|
|
13
|
+
],
|
|
14
|
+
overrides: [
|
|
15
|
+
{
|
|
16
|
+
files: ["*.test.*"],
|
|
17
|
+
...jestConfig,
|
|
14
18
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
'no-console': 'warn',
|
|
19
|
-
'complexity': [1, 6],
|
|
20
|
-
'curly': [2, 'all'],
|
|
21
|
-
'max-depth': [2, 5],
|
|
22
|
-
'max-lines': [1],
|
|
23
|
-
'max-params': [2, 5],
|
|
24
|
-
'max-nested-callbacks': [2, 5],
|
|
25
|
-
'max-statements': [1, 25],
|
|
26
|
-
'max-statements-per-line': [2, { max: 2 }],
|
|
27
|
-
'arrow-body-style': 0, // return statement sometimes needs to be surrounded by {}
|
|
28
|
-
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], // allow ++ syntax for for each cycle
|
|
29
|
-
'class-methods-use-this': 0, // Do not require this in class methods
|
|
30
|
-
'no-empty-function': 0, // you need this to implement some interfaces
|
|
31
|
-
'no-underscore-dangle': 0, // _ can be user for private methods
|
|
32
|
-
'no-useless-constructor': 0, // sometimes its handy
|
|
33
|
-
'no-param-reassign': 0, // for decorators it's handy
|
|
34
|
-
'promise/avoid-new': 0,
|
|
35
|
-
'promise/always-return': 1,
|
|
36
|
-
'promise/no-return-wrap': 1,
|
|
37
|
-
'promise/param-names': 1,
|
|
38
|
-
'promise/catch-or-return': 2,
|
|
39
|
-
'promise/no-promise-in-callback': 1,
|
|
40
|
-
'promise/no-callback-in-promise': 1,
|
|
41
|
-
'promise/prefer-await-to-callbacks': 2,
|
|
42
|
-
'promise/prefer-await-to-then': 2,
|
|
43
|
-
'filenames/match-exported': [2, null, '\\.config.js$'],
|
|
44
|
-
'array-func/no-unnecessary-this-arg': 2,
|
|
45
|
-
'array-func/prefer-array-from': 0, // I don't like it
|
|
46
|
-
'array-func/avoid-reverse': 2,
|
|
47
|
-
'import/prefer-default-export': 0, // In some cases it is not need
|
|
48
|
-
'import/extensions': [2, { ts: 'never', tsx: 'never' }],
|
|
49
|
-
'import/no-dynamic-require': 0, // we need dynamic import of chunks...
|
|
50
|
-
'import/no-extraneous-dependencies': [2, { devDependencies: ['**/*.test.*', '**/*.config.js', '**/*.config.*'] }],
|
|
51
|
-
'jsx-a11y/anchor-is-valid': 0, // rule does not exist
|
|
52
|
-
'prettier/prettier': ['error', { printWidth: 140, tabWidth: 4, singleQuote: true, quoteProps: 'consistent', trailingComma: 'all' }],
|
|
53
|
-
// TODO: :( extending airbnb with react
|
|
54
|
-
'react/function-component-definition': 0,
|
|
55
|
-
'array-func/from-map': 0,
|
|
56
|
-
'no-irregular-whitespace': 0,
|
|
57
|
-
'func-names': 0,
|
|
19
|
+
{
|
|
20
|
+
files: ["*.*sx"],
|
|
21
|
+
...reactConfig,
|
|
58
22
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
'typescript-sort-keys/string-enum': 2,
|
|
67
|
-
'@typescript-eslint/explicit-module-boundary-types': 0,
|
|
68
|
-
'consistent-return': 0, // types check by typescript
|
|
69
|
-
'camelcase': 0, // using @typescript-eslint/camelcase
|
|
70
|
-
'no-unused-expressions': 0, // conflict with typescript plugin
|
|
71
|
-
'no-undef': 0, // conflict with typescript plugin
|
|
72
|
-
'no-restricted-globals': 0, // conflict with typescript plugin
|
|
73
|
-
'global-require': 0, // conflict with typescript plugin
|
|
74
|
-
'no-unused-vars': 0, // conflict with typescript plugin
|
|
75
|
-
'no-dupe-class-members': 0, // dont work for typescript
|
|
76
|
-
'@typescript-eslint/explicit-function-return-type': 0,
|
|
77
|
-
'@typescript-eslint/no-namespace': 0,
|
|
78
|
-
'@typescript-eslint/no-parameter-properties': 0,
|
|
79
|
-
'@typescript-eslint/ban-ts-ignore': 0,
|
|
80
|
-
'no-shadow': 0, // conflict with typescript
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
files: ['*.config.*'],
|
|
85
|
-
rules: {
|
|
86
|
-
'filenames/match-exported': 0,
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
files: ['*.test.*'],
|
|
91
|
-
...jestConfig,
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
files: ['*.jsx', '*.tsx'],
|
|
95
|
-
...reactConfig,
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
files: ['*.json'],
|
|
99
|
-
rules: {
|
|
100
|
-
'json/sort-package-json': [2, 'standard'],
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
parserOptions: {
|
|
105
|
-
sourceType: 'module',
|
|
106
|
-
ecmaFeatures: {
|
|
107
|
-
jsx: true,
|
|
108
|
-
impliedStrict: true,
|
|
109
|
-
},
|
|
23
|
+
{
|
|
24
|
+
extends: ["plugin:react-hooks/recommended"],
|
|
25
|
+
files: ["use*.*sx", "use*.js", "use*.ts"],
|
|
26
|
+
rules: {
|
|
27
|
+
"react-hooks/exhaustive-deps": "error",
|
|
28
|
+
"react-hooks/rules-of-hooks": "error",
|
|
29
|
+
},
|
|
110
30
|
},
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
31
|
+
{
|
|
32
|
+
extends: [
|
|
33
|
+
"plugin:@typescript-eslint/strict-type-checked",
|
|
34
|
+
"plugin:typescript-sort-keys/recommended",
|
|
35
|
+
"plugin:import/typescript",
|
|
36
|
+
"plugin:prettier/recommended",
|
|
37
|
+
],
|
|
38
|
+
files: ["*.tsx", "*.ts"],
|
|
39
|
+
parser: "@typescript-eslint/parser",
|
|
114
40
|
},
|
|
115
|
-
|
|
41
|
+
{
|
|
42
|
+
files: ["*.json"],
|
|
43
|
+
plugins: ["json-format"],
|
|
44
|
+
rules: {
|
|
45
|
+
"json/sort-package-json": [2, "standard"],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
parserOptions: {
|
|
50
|
+
ecmaVersion: "latest",
|
|
51
|
+
},
|
|
52
|
+
plugins: ["filenames"],
|
|
53
|
+
reportUnusedDisableDirectives: true,
|
|
54
|
+
rules: {
|
|
55
|
+
"canonical/filename-no-index": "error",
|
|
56
|
+
"filenames/match-exported": [2, null, "\\.config.js$"],
|
|
57
|
+
},
|
|
116
58
|
};
|
package/jest.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
env: {
|
|
3
|
+
jest: true,
|
|
4
|
+
},
|
|
5
|
+
extends: ["plugin:jest/recommended"],
|
|
6
|
+
plugins: ["jest"],
|
|
7
|
+
rules: {
|
|
8
|
+
"compat/compat": 0,
|
|
9
|
+
// no need for testing env
|
|
10
|
+
"promise/catch-or-return": 0,
|
|
11
|
+
|
|
12
|
+
// do not check for browser support
|
|
13
|
+
"promise/no-callback-in-promise": 0,
|
|
14
|
+
"sonarjs/no-duplicate-string": 0, // no need for testing env
|
|
15
|
+
},
|
|
13
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-fabulator",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Shared ESLint config for fabulator projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -19,40 +19,40 @@
|
|
|
19
19
|
"author": "Michal Ozogán <michal@ozogan.eu>",
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"scripts": {
|
|
22
|
-
"lint": "eslint ./ --ext .js --ext .json --config index.js",
|
|
22
|
+
"lint": "eslint ./ --ext .js --ext .json --config index.js --env node",
|
|
23
23
|
"lint:fix": "npm run lint -- --fix",
|
|
24
24
|
"release": "semantic-release",
|
|
25
25
|
"test": "node node_modules/jest/bin/jest.js",
|
|
26
26
|
"test-and-lint": "npm run test && npm run lint"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@
|
|
30
|
-
"@typescript-eslint/
|
|
31
|
-
"eslint": "^
|
|
32
|
-
"eslint
|
|
33
|
-
"eslint-config-prettier": "^
|
|
34
|
-
"eslint-plugin-array-func": "^
|
|
29
|
+
"@babel/eslint-parser": "^7.23.3",
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
|
31
|
+
"@typescript-eslint/parser": "^6.14.0",
|
|
32
|
+
"eslint": "^8.56.0",
|
|
33
|
+
"eslint-config-prettier": "^9.1.0",
|
|
34
|
+
"eslint-plugin-array-func": "^4.0.0",
|
|
35
|
+
"eslint-plugin-canonical": "^4.18.0",
|
|
35
36
|
"eslint-plugin-filenames": "^1.3.2",
|
|
36
|
-
"eslint-plugin-import": "^2.
|
|
37
|
-
"eslint-plugin-jest": "^27.
|
|
37
|
+
"eslint-plugin-import": "^2.29.1",
|
|
38
|
+
"eslint-plugin-jest": "^27.6.0",
|
|
38
39
|
"eslint-plugin-json-format": "^2.0.1",
|
|
39
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
40
|
-
"eslint-plugin-prettier": "^
|
|
41
|
-
"eslint-plugin-
|
|
42
|
-
"eslint-plugin-react": "^7.32.2",
|
|
40
|
+
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
41
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
42
|
+
"eslint-plugin-react": "^7.33.2",
|
|
43
43
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
44
|
-
"eslint-plugin-sonarjs": "^0.
|
|
45
|
-
"eslint-plugin-typescript-sort-keys": "^
|
|
46
|
-
"prettier": "^
|
|
44
|
+
"eslint-plugin-sonarjs": "^0.23.0",
|
|
45
|
+
"eslint-plugin-typescript-sort-keys": "^3.1.0",
|
|
46
|
+
"prettier": "^3.1.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"commitlint-config-fabulator": "^
|
|
50
|
-
"enhanced-resolve": "^5.
|
|
51
|
-
"jest": "^29.
|
|
52
|
-
"semantic-release-config-fabulator": "^
|
|
53
|
-
"typescript": "^5.
|
|
49
|
+
"commitlint-config-fabulator": "^6.1.0",
|
|
50
|
+
"enhanced-resolve": "^5.15.0",
|
|
51
|
+
"jest": "^29.7.0",
|
|
52
|
+
"semantic-release-config-fabulator": "^7.0.0",
|
|
53
|
+
"typescript": "^5.3.3"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"typescript": "^
|
|
56
|
+
"typescript": "^5"
|
|
57
57
|
}
|
|
58
58
|
}
|
package/react.js
CHANGED
|
@@ -1,27 +1,44 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
2
|
+
extends: [
|
|
3
|
+
"plugin:react/recommended",
|
|
4
|
+
"plugin:prettier/recommended",
|
|
5
|
+
"plugin:jsx-a11y/recommended",
|
|
6
|
+
"plugin:react-hooks/recommended",
|
|
7
|
+
],
|
|
8
|
+
rules: {
|
|
9
|
+
"jsx-a11y/label-has-associated-control": [2, { assert: "htmlFor" }],
|
|
10
|
+
"react/button-has-type": "error",
|
|
11
|
+
"react/display-name": 0,
|
|
12
|
+
"react/function-component-definition": "off",
|
|
13
|
+
"react/jsx-filename-extension": [
|
|
14
|
+
"error",
|
|
15
|
+
{ extensions: [".js", ".jsx", ".ts", ".tsx"] },
|
|
16
|
+
],
|
|
17
|
+
"react/jsx-max-props-per-line": [
|
|
18
|
+
"error",
|
|
19
|
+
{ maximum: 1, when: "multiline" },
|
|
20
|
+
],
|
|
21
|
+
"react/jsx-no-constructed-context-values": 0,
|
|
22
|
+
"react/jsx-no-useless-fragment": "off",
|
|
23
|
+
"react/jsx-one-expression-per-line": "off",
|
|
24
|
+
"react/jsx-props-no-spreading": 0,
|
|
25
|
+
"react/jsx-sort-props": [
|
|
26
|
+
2,
|
|
27
|
+
{
|
|
28
|
+
callbacksLast: true,
|
|
29
|
+
shorthandFirst: true,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
"react/no-array-index-key": "error",
|
|
33
|
+
"react/no-danger": "error",
|
|
34
|
+
"react/no-typos": "error",
|
|
35
|
+
"react/no-unstable-nested-components": ["error", { allowAsProps: true }],
|
|
36
|
+
"react/no-unused-class-component-methods": "error",
|
|
37
|
+
"react/no-unused-prop-types": 0,
|
|
38
|
+
"react/prefer-stateless-function": "error",
|
|
39
|
+
"react/prop-types": "off",
|
|
40
|
+
"react/react-in-jsx-scope": 0,
|
|
41
|
+
"react/require-default-props": 0,
|
|
42
|
+
"react/state-in-constructor": "error",
|
|
43
|
+
},
|
|
27
44
|
};
|