@open-turo/eslint-config-react 6.0.3 → 7.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/README.md
CHANGED
|
@@ -12,16 +12,6 @@ Turo eslint configuration for react. The config expects that Typescript is being
|
|
|
12
12
|
[](https://conventionalcommits.org)
|
|
13
13
|
[](https://turo.com/jobs)
|
|
14
14
|
|
|
15
|
-
## Relevant notes
|
|
16
|
-
|
|
17
|
-
The `eslint` configurations in this repo extend `@open-turo/eslint-config-typescript/legacy`; as it is the base TS
|
|
18
|
-
eslint config that supports our existing front-end codebase.
|
|
19
|
-
|
|
20
|
-
However, if you are creating a new React project and you think you would benefit from having the configurations in this
|
|
21
|
-
repository extend the default `@open-turo/eslint-config-typescript` config instead, please raise an issue and/or feel
|
|
22
|
-
free to create a PR to add a new default that extends it, and rename the current configurations to `legacy` and
|
|
23
|
-
`legacy-extended` respectively. We are not doing that for now to reduce maintenance burden, as it would be unused.
|
|
24
|
-
|
|
25
15
|
## Usage
|
|
26
16
|
|
|
27
17
|
Install the package and all of its peer dependencies:
|
|
@@ -39,8 +29,18 @@ To use this config, just add to your `.eslintrc` the following:
|
|
|
39
29
|
"extends": "@open-turo/eslint-config-typescript"
|
|
40
30
|
```
|
|
41
31
|
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
### Legacy preset
|
|
33
|
+
|
|
34
|
+
There is a `legacy` preset that extends `@open-turo/eslint-config-typescript/legacy`. This only exists for backwards
|
|
35
|
+
compatibility with existing projects. It is strongly recommended to use the standard preset.
|
|
36
|
+
|
|
37
|
+
To use the `legacy` preset, update your `.eslintrc` file to be:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"extends": "@open-turo/eslint-config-react/legacy"
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
44
|
|
|
45
45
|
## Development
|
|
46
46
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Breaking changes in v6
|
|
2
|
+
|
|
3
|
+
This preset now uses the standard config from `@open-turo/eslint-config-typescript`. There is now a `legacy` preset that
|
|
4
|
+
extends `@open-turo/eslint-config-typescript/legacy`.
|
|
5
|
+
|
|
6
|
+
## Upgrade instructions
|
|
7
|
+
|
|
8
|
+
It is strongly recommended to use the standard preset. If you want to still use the previous configuration,
|
|
9
|
+
you can switch to the `legacy` preset by updating your `.eslintrc` file to be:
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"extends": "@open-turo/eslint-config-react/legacy"
|
|
14
|
+
}
|
|
15
|
+
```
|
package/index.js
CHANGED
|
@@ -6,8 +6,9 @@ module.exports = {
|
|
|
6
6
|
},
|
|
7
7
|
ignorePatterns: ["babel.config.js"],
|
|
8
8
|
extends: [
|
|
9
|
-
"@open-turo/eslint-config-typescript
|
|
9
|
+
"@open-turo/eslint-config-typescript",
|
|
10
10
|
"plugin:react/recommended",
|
|
11
|
+
"plugin:react/jsx-runtime",
|
|
11
12
|
"plugin:react-hooks/recommended",
|
|
12
13
|
"plugin:jsx-a11y/recommended",
|
|
13
14
|
],
|
|
@@ -43,6 +44,8 @@ module.exports = {
|
|
|
43
44
|
"react/jsx-props-no-spreading": "off",
|
|
44
45
|
// ensure props are alphabetical
|
|
45
46
|
"react/jsx-sort-props": "error",
|
|
47
|
+
// Allow emotion css prop
|
|
48
|
+
"react/no-unknown-property": ["error", { ignore: ["css"] }],
|
|
46
49
|
// We don't need default props on TS components
|
|
47
50
|
"react/require-default-props": "off",
|
|
48
51
|
"react/sort-prop-types": "error",
|
|
@@ -50,6 +53,8 @@ module.exports = {
|
|
|
50
53
|
"react/state-in-constructor": "off",
|
|
51
54
|
// This allows static properties to be placed within the class declaration
|
|
52
55
|
"react/static-property-placement": "off",
|
|
56
|
+
// Allow file names to match a component name
|
|
57
|
+
"unicorn/filename-case": "off",
|
|
53
58
|
},
|
|
54
59
|
settings: {
|
|
55
60
|
react: {
|
package/legacy.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
plugins: ["react", "react-hooks", "jsx-a11y"],
|
|
4
|
+
env: {
|
|
5
|
+
browser: true,
|
|
6
|
+
},
|
|
7
|
+
ignorePatterns: ["babel.config.js"],
|
|
8
|
+
extends: [
|
|
9
|
+
"@open-turo/eslint-config-typescript/legacy",
|
|
10
|
+
"plugin:react/recommended",
|
|
11
|
+
"plugin:react-hooks/recommended",
|
|
12
|
+
"plugin:jsx-a11y/recommended",
|
|
13
|
+
],
|
|
14
|
+
parserOptions: {
|
|
15
|
+
ecmaFeatures: {
|
|
16
|
+
jsx: true,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
rules: {
|
|
20
|
+
"jsx-a11y/anchor-is-valid": [
|
|
21
|
+
"warn",
|
|
22
|
+
{
|
|
23
|
+
specialLink: ["to"],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
"node/no-unpublished-import": [
|
|
27
|
+
"error",
|
|
28
|
+
{
|
|
29
|
+
allowModules: [
|
|
30
|
+
"@jest/globals",
|
|
31
|
+
"@testing-library/dom",
|
|
32
|
+
"@testing-library/react",
|
|
33
|
+
"@testing-library/user-event",
|
|
34
|
+
"nock",
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
// don't force .jsx extension
|
|
39
|
+
"react/jsx-filename-extension": "off",
|
|
40
|
+
// In TS you must use the Fragment syntax instead of the shorthand
|
|
41
|
+
"react/jsx-fragments": "off",
|
|
42
|
+
// This allows props to be spread in JSX
|
|
43
|
+
"react/jsx-props-no-spreading": "off",
|
|
44
|
+
// ensure props are alphabetical
|
|
45
|
+
"react/jsx-sort-props": "error",
|
|
46
|
+
// We don't need default props on TS components
|
|
47
|
+
"react/require-default-props": "off",
|
|
48
|
+
"react/sort-prop-types": "error",
|
|
49
|
+
// State initialization can be in the constructor or via class fields
|
|
50
|
+
"react/state-in-constructor": "off",
|
|
51
|
+
// This allows static properties to be placed within the class declaration
|
|
52
|
+
"react/static-property-placement": "off",
|
|
53
|
+
},
|
|
54
|
+
settings: {
|
|
55
|
+
react: {
|
|
56
|
+
version: "detect",
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|