@open-turo/eslint-config-react 1.1.1 → 1.3.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 +11 -20
- package/index.js +38 -1
- package/pack/open-turo-eslint-config-react-1.3.0.tgz +0 -0
- package/package.json +32 -10
- package/extended.js +0 -43
- package/pack/open-turo-eslint-config-react-1.1.1.tgz +0 -0
package/README.md
CHANGED
|
@@ -30,14 +30,8 @@ Install the package and all of its peer dependencies:
|
|
|
30
30
|
npx install-peerdeps --dev @open-turo/eslint-config-react
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Then in your `.eslintrc` file extend from
|
|
34
|
-
|
|
35
|
-
1. The default, based on our existing front-end repositories
|
|
36
|
-
2. The "extended", which adds more react-related plugins. We intend to transition to this one as default over time
|
|
37
|
-
|
|
38
|
-
### Default config
|
|
39
|
-
|
|
40
|
-
The default config of this repo is the recommended version for nour existing front-end projects.
|
|
33
|
+
Then in your `.eslintrc` file, extend from the default configuration of this package, which is the recommended eslint
|
|
34
|
+
configuration for our existing front-end projects.
|
|
41
35
|
|
|
42
36
|
To use this config, just add to your `.eslintrc` the following:
|
|
43
37
|
|
|
@@ -45,21 +39,13 @@ To use this config, just add to your `.eslintrc` the following:
|
|
|
45
39
|
"extends": "@open-turo/eslint-config-typescript"
|
|
46
40
|
```
|
|
47
41
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
We also provide an alternative `extended` preset, which adds more react-related plugins.
|
|
51
|
-
We intend to transition to this one as default over time; and we encourage you to use it for new projects.
|
|
52
|
-
|
|
53
|
-
If you want to use this `extended` configuration, you can import it by instead adding the following to your `.eslintrc`:
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
"extends": "@open-turo/eslint-config-typescript/extended"
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Simply notice the `/extended` suffix, which points to the `extended.js` file in this repository.
|
|
42
|
+
We used to have an alternative `extended` preset, which added more react-related plugins, but after some testing, it
|
|
43
|
+
has been integrated into the default preset.
|
|
60
44
|
|
|
61
45
|
## Development
|
|
62
46
|
|
|
47
|
+
### Pre-commit
|
|
48
|
+
|
|
63
49
|
Install [pre-commit](https://pre-commit.com/) and the commit hooks:
|
|
64
50
|
|
|
65
51
|
```shell
|
|
@@ -67,6 +53,11 @@ pre-commit install
|
|
|
67
53
|
pre-commit install --hook-type commit-msg
|
|
68
54
|
```
|
|
69
55
|
|
|
56
|
+
### Keeping peerDependencies up-to-date
|
|
57
|
+
|
|
58
|
+
Transitive `peerDependencies` should be added, and kept up to date. A useful tool for that task is
|
|
59
|
+
`npx check-peer-dependencies`, which shows us our missing (or outdated) peerDependencies.
|
|
60
|
+
|
|
70
61
|
## Get Help
|
|
71
62
|
|
|
72
63
|
Please review Issues, post new Issues against this repository as needed.
|
package/index.js
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
root: true,
|
|
3
|
+
plugins: ["react", "react-hooks", "jsx-a11y"],
|
|
3
4
|
env: {
|
|
4
5
|
browser: true,
|
|
5
6
|
},
|
|
6
7
|
ignorePatterns: ["babel.config.js"],
|
|
7
|
-
extends: [
|
|
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
|
+
},
|
|
8
19
|
rules: {
|
|
20
|
+
"jsx-a11y/anchor-is-valid": [
|
|
21
|
+
"warn",
|
|
22
|
+
{
|
|
23
|
+
specialLink: ["to"],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
9
26
|
"node/no-unpublished-import": [
|
|
10
27
|
"error",
|
|
11
28
|
{
|
|
@@ -18,5 +35,25 @@ module.exports = {
|
|
|
18
35
|
],
|
|
19
36
|
},
|
|
20
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
|
+
},
|
|
21
58
|
},
|
|
22
59
|
};
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -4,14 +4,25 @@
|
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@commitlint/cli": "^17.0.0",
|
|
6
6
|
"@open-turo/commitlint-config-conventional": "^1.0.2",
|
|
7
|
-
"@open-turo/eslint-config-typescript": "2.
|
|
7
|
+
"@open-turo/eslint-config-typescript": "^2.1.0",
|
|
8
8
|
"@semantic-release/git": "^10.0.1",
|
|
9
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
10
|
-
"@typescript-eslint/parser": "^5.
|
|
11
|
-
"eslint": "
|
|
9
|
+
"@typescript-eslint/eslint-plugin": "^5.46.0",
|
|
10
|
+
"@typescript-eslint/parser": "^5.46.0",
|
|
11
|
+
"eslint": ">=8.18.0",
|
|
12
|
+
"eslint-config-prettier": "^8.5.0",
|
|
13
|
+
"eslint-import-resolver-typescript": "^3.5.2",
|
|
14
|
+
"eslint-plugin-import": "^2.26.0",
|
|
15
|
+
"eslint-plugin-jest": "^27.1.6",
|
|
12
16
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
17
|
+
"eslint-plugin-node": "^11.1.0",
|
|
18
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
13
19
|
"eslint-plugin-react": "^7.29.4",
|
|
14
20
|
"eslint-plugin-react-hooks": "^4.4.0",
|
|
21
|
+
"eslint-plugin-simple-import-sort": "^8.0.0",
|
|
22
|
+
"eslint-plugin-sonarjs": "^0.16.0",
|
|
23
|
+
"eslint-plugin-sort-destructure-keys": "^1.4.0",
|
|
24
|
+
"eslint-plugin-typescript-sort-keys": "^2.1.0",
|
|
25
|
+
"prettier": "^2.5.1",
|
|
15
26
|
"semantic-release": "^19.0.2",
|
|
16
27
|
"semantic-release-github-pullrequest": "^1.3.0"
|
|
17
28
|
},
|
|
@@ -23,17 +34,28 @@
|
|
|
23
34
|
"main": "index.js",
|
|
24
35
|
"name": "@open-turo/eslint-config-react",
|
|
25
36
|
"peerDependencies": {
|
|
26
|
-
"@open-turo/eslint-config-typescript": "2.
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
28
|
-
"@typescript-eslint/parser": "^5.
|
|
29
|
-
"eslint": ">=8.
|
|
37
|
+
"@open-turo/eslint-config-typescript": "^2.1.0",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^5.46.0",
|
|
39
|
+
"@typescript-eslint/parser": "^5.46.0",
|
|
40
|
+
"eslint": ">=8.18.0",
|
|
41
|
+
"eslint-config-prettier": "^8.5.0",
|
|
42
|
+
"eslint-import-resolver-typescript": "^3.5.2",
|
|
43
|
+
"eslint-plugin-import": "^2.26.0",
|
|
44
|
+
"eslint-plugin-jest": "^27.1.6",
|
|
30
45
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
46
|
+
"eslint-plugin-node": "^11.1.0",
|
|
47
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
48
|
+
"eslint-plugin-simple-import-sort": "^8.0.0",
|
|
49
|
+
"eslint-plugin-sonarjs": "^0.16.0",
|
|
50
|
+
"eslint-plugin-sort-destructure-keys": "^1.4.0",
|
|
51
|
+
"eslint-plugin-typescript-sort-keys": "^2.1.0",
|
|
31
52
|
"eslint-plugin-react": "^7.29.4",
|
|
32
|
-
"eslint-plugin-react-hooks": "^4.4.0"
|
|
53
|
+
"eslint-plugin-react-hooks": "^4.4.0",
|
|
54
|
+
"prettier": "^2.5.1"
|
|
33
55
|
},
|
|
34
56
|
"publishConfig": {
|
|
35
57
|
"access": "public"
|
|
36
58
|
},
|
|
37
59
|
"repository": "https://github.com/open-turo/eslint-config-react",
|
|
38
|
-
"version": "1.
|
|
60
|
+
"version": "1.3.0"
|
|
39
61
|
}
|
package/extended.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
plugins: ["react", "react-hooks", "jsx-a11y"],
|
|
4
|
-
extends: [
|
|
5
|
-
"./index.js",
|
|
6
|
-
"plugin:react/recommended",
|
|
7
|
-
"plugin:react-hooks/recommended",
|
|
8
|
-
"plugin:jsx-a11y/recommended",
|
|
9
|
-
],
|
|
10
|
-
parserOptions: {
|
|
11
|
-
ecmaFeatures: {
|
|
12
|
-
jsx: true,
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
rules: {
|
|
16
|
-
"jsx-a11y/anchor-is-valid": [
|
|
17
|
-
"warn",
|
|
18
|
-
{
|
|
19
|
-
specialLink: ["to"],
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
// don't force .jsx extension
|
|
23
|
-
"react/jsx-filename-extension": "off",
|
|
24
|
-
// In TS you must use the Fragment syntax instead of the shorthand
|
|
25
|
-
"react/jsx-fragments": "off",
|
|
26
|
-
// This allows props to be spread in JSX
|
|
27
|
-
"react/jsx-props-no-spreading": "off",
|
|
28
|
-
// ensure props are alphabetical
|
|
29
|
-
"react/jsx-sort-props": "error",
|
|
30
|
-
// We don't need default props on TS components
|
|
31
|
-
"react/require-default-props": "off",
|
|
32
|
-
"react/sort-prop-types": "error",
|
|
33
|
-
// State initialization can be in the constructor or via class fields
|
|
34
|
-
"react/state-in-constructor": "off",
|
|
35
|
-
// This allows static properties to be placed within the class declaration
|
|
36
|
-
"react/static-property-placement": "off",
|
|
37
|
-
},
|
|
38
|
-
settings: {
|
|
39
|
-
react: {
|
|
40
|
-
version: "detect",
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
};
|
|
Binary file
|