@neolution-ch/eslint-config-neolution 1.1.0 → 1.2.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 +18 -1
- package/package.json +1 -1
- package/rules/eslint.js +18 -10
- package/rules/import.js +5 -2
- package/rules/react.js +4 -0
- package/rules/typescript.js +19 -6
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.0] - 2022-10-27
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Added typescript to the import/resolver
|
|
15
|
+
- Added deprecated React types to the "ban-types" rule
|
|
16
|
+
- Added "complexity" rule with a maximum of 20
|
|
17
|
+
- Added "max-lines" rule with a maximum of 300 lines
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Updated "no-empty-function" rule to not allow any empty function
|
|
22
|
+
- Updated "quotes" rule by using the typescript version
|
|
23
|
+
- Updated "react/no-unstable-nested-components" rule to allow component creation inside component props
|
|
24
|
+
|
|
10
25
|
## [1.1.0] - 2022-10-17
|
|
11
26
|
|
|
12
27
|
### Added
|
|
@@ -20,7 +35,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
20
35
|
|
|
21
36
|
- Initial release
|
|
22
37
|
|
|
23
|
-
[Unreleased]: https://github.com/neolution-ch/eslint-config-neolution/compare/1.
|
|
38
|
+
[Unreleased]: https://github.com/neolution-ch/eslint-config-neolution/compare/1.2.0...HEAD
|
|
39
|
+
|
|
40
|
+
[1.2.0]: https://github.com/neolution-ch/eslint-config-neolution/compare/1.1.0...1.2.0
|
|
24
41
|
|
|
25
42
|
[1.1.0]: https://github.com/neolution-ch/eslint-config-neolution/compare/1.0.0...1.1.0
|
|
26
43
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neolution-ch/eslint-config-neolution",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "This package provides Neolution's .eslintrc as an extensible shared config.",
|
|
5
5
|
"homepage": "https://github.com/neolution-ch/eslint-config-neolution",
|
|
6
6
|
"main": "index.js",
|
package/rules/eslint.js
CHANGED
|
@@ -4,18 +4,22 @@ module.exports = {
|
|
|
4
4
|
].map(require.resolve),
|
|
5
5
|
|
|
6
6
|
// View link below for eslint rules documentation
|
|
7
|
-
// https://eslint.org/docs/
|
|
7
|
+
// https://eslint.org/docs/rules/
|
|
8
8
|
rules: {
|
|
9
9
|
// The airbnb config enforce that class methods use "this", but requires changing how you call the method
|
|
10
|
-
// https://eslint.org/docs/
|
|
10
|
+
// https://eslint.org/docs/rules/class-methods-use-this
|
|
11
11
|
"class-methods-use-this": "off",
|
|
12
12
|
|
|
13
|
+
// The airbnb config disables the complexity, but we want to limit it
|
|
14
|
+
// https://eslint.org/docs/rules/complexity
|
|
15
|
+
complexity: ["error", 20],
|
|
16
|
+
|
|
13
17
|
// The airbnb config enforces consistent return, but we got problems with some external libraries, TypeScript enforces this anyway
|
|
14
|
-
// https://eslint.org/docs/
|
|
18
|
+
// https://eslint.org/docs/rules/consistent-return
|
|
15
19
|
"consistent-return": "off",
|
|
16
20
|
|
|
17
21
|
// The airbnb config forces unix style, but somebody also works on windows
|
|
18
|
-
// https://eslint.org/docs/
|
|
22
|
+
// https://eslint.org/docs/rules/linebreak-style
|
|
19
23
|
"linebreak-style": "off",
|
|
20
24
|
|
|
21
25
|
// The airbnb config limits to 100 ignoring some lines, instad we allow 160 but don't ignore lines
|
|
@@ -29,12 +33,20 @@ module.exports = {
|
|
|
29
33
|
ignoreRegExpLiterals: false,
|
|
30
34
|
}],
|
|
31
35
|
|
|
36
|
+
// The airbnb disables the max lines, but we want to limit it
|
|
37
|
+
// https://eslint.org/docs/rules/max-lines
|
|
38
|
+
"max-lines": ["error", {
|
|
39
|
+
max: 300,
|
|
40
|
+
skipBlankLines: true,
|
|
41
|
+
skipComments: true
|
|
42
|
+
}],
|
|
43
|
+
|
|
32
44
|
// The airbnb config disallow await inside of loops, but it cannot always be avoided
|
|
33
45
|
// https://eslint.org/docs/rules/no-await-in-loop
|
|
34
46
|
"no-await-in-loop": "off",
|
|
35
47
|
|
|
36
48
|
// The airbnb config disallow use of the continue statement, but it's ok to have it
|
|
37
|
-
// https://eslint.org/docs/
|
|
49
|
+
// https://eslint.org/docs/rules/no-continue
|
|
38
50
|
"no-continue": "off",
|
|
39
51
|
|
|
40
52
|
// The airbnb config disallow use of unary operators (++ and --), but it's ok to have them
|
|
@@ -42,7 +54,7 @@ module.exports = {
|
|
|
42
54
|
"no-plusplus": "off",
|
|
43
55
|
|
|
44
56
|
// The airbnb config also restrict ForOfStatement, but we want to use it
|
|
45
|
-
// https://eslint.org/docs/
|
|
57
|
+
// https://eslint.org/docs/rules/no-restricted-syntax
|
|
46
58
|
"no-restricted-syntax": [
|
|
47
59
|
"error",
|
|
48
60
|
{
|
|
@@ -59,9 +71,5 @@ module.exports = {
|
|
|
59
71
|
message: "`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
|
|
60
72
|
},
|
|
61
73
|
],
|
|
62
|
-
|
|
63
|
-
// The airbnb config forces single quote, but we prefer double quote
|
|
64
|
-
// https://eslint.org/docs/latest/rules/quotes
|
|
65
|
-
quotes: ["error", "double", { avoidEscape: true }],
|
|
66
74
|
},
|
|
67
75
|
};
|
package/rules/import.js
CHANGED
package/rules/react.js
CHANGED
|
@@ -21,6 +21,10 @@ module.exports = {
|
|
|
21
21
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-one-expression-per-line.md
|
|
22
22
|
"react/jsx-one-expression-per-line": "off",
|
|
23
23
|
|
|
24
|
+
// The airbnb config didn't allow component creation inside component props, but we want to allow it
|
|
25
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
|
|
26
|
+
"react/no-unstable-nested-components": ["error", { allowAsProps: true }],
|
|
27
|
+
|
|
24
28
|
// The airbnb config forces a defaultProps definition for every prop, but we don't want it
|
|
25
29
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-default-props.md
|
|
26
30
|
"react/require-default-props": "off",
|
package/rules/typescript.js
CHANGED
|
@@ -16,6 +16,18 @@ module.exports = {
|
|
|
16
16
|
// View link below for typescript rules documentation
|
|
17
17
|
// https://typescript-eslint.io/rules/
|
|
18
18
|
rules: {
|
|
19
|
+
// Disallow certain types
|
|
20
|
+
// https://typescript-eslint.io/rules/ban-types/
|
|
21
|
+
"@typescript-eslint/ban-types": ["error",{
|
|
22
|
+
types: {
|
|
23
|
+
"React.StatelessComponent": { message: "Deprecated: Do not use.", fixWith: "React.ReactElement" },
|
|
24
|
+
StatelessComponent: { message: "Deprecated: Do not use.", fixWith: "ReactElement" },
|
|
25
|
+
"React.FC": { message: "Please use ReactElement + PropsWithChildren", fixWith: "ReactElement" },
|
|
26
|
+
FC: { message: "Please use ReactElement + PropsWithChildren", fixWith: "ReactElement" },
|
|
27
|
+
},
|
|
28
|
+
extendDefaults: true,
|
|
29
|
+
}],
|
|
30
|
+
|
|
19
31
|
// Enforce one true brace style (same as eslint-config-airbnb-base)
|
|
20
32
|
// https://typescript-eslint.io/rules/brace-style
|
|
21
33
|
"@typescript-eslint/brace-style": ["error", "1tbs", { allowSingleLine: true }],
|
|
@@ -108,14 +120,10 @@ module.exports = {
|
|
|
108
120
|
format: ["PascalCase"],
|
|
109
121
|
}],
|
|
110
122
|
|
|
111
|
-
// Disallow empty functions
|
|
123
|
+
// Disallow empty functions
|
|
112
124
|
// https://typescript-eslint.io/rules/no-empty-function
|
|
113
125
|
"@typescript-eslint/no-empty-function": ["error", {
|
|
114
|
-
allow: [
|
|
115
|
-
"arrowFunctions",
|
|
116
|
-
"functions",
|
|
117
|
-
"methods",
|
|
118
|
-
]
|
|
126
|
+
allow: [],
|
|
119
127
|
}],
|
|
120
128
|
|
|
121
129
|
// Disallow unnecessary parentheses (same as eslint-config-airbnb-base)
|
|
@@ -172,6 +180,11 @@ module.exports = {
|
|
|
172
180
|
// https://typescript-eslint.io/rules/prefer-readonly-parameter-types
|
|
173
181
|
"@typescript-eslint/prefer-readonly-parameter-types": "off",
|
|
174
182
|
|
|
183
|
+
// Enforce the consistent use of double quotes, but allow single quotes so long as the
|
|
184
|
+
// string contains a quote that would have to be escaped otherwise
|
|
185
|
+
// https://typescript-eslint.io/rules/quotes
|
|
186
|
+
"@typescript-eslint/quotes": ["error", "double", { avoidEscape: true }],
|
|
187
|
+
|
|
175
188
|
// Require `await` in `async function` (note: this is a horrible rule that should never be used) (same as eslint-config-airbnb-base)
|
|
176
189
|
// https://typescript-eslint.io/rules/require-await
|
|
177
190
|
"@typescript-eslint/require-await": "off",
|