@aliexme/eslint-config 0.2.7 → 0.3.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.md +19 -0
- package/package.json +7 -1
- package/rules/react-native.js +23 -0
- package/rules/react.js +29 -29
package/README.md
CHANGED
|
@@ -58,6 +58,25 @@ And add the following lines to your ESLint config file:
|
|
|
58
58
|
}
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
## React Native
|
|
62
|
+
|
|
63
|
+
Install additional packages:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
npm i --save-dev eslint-plugin-react-native
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
And add the following lines to your ESLint config file:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
{
|
|
73
|
+
"extends": [
|
|
74
|
+
"@aliexme/eslint-config",
|
|
75
|
+
"@aliexme/eslint-config/react-native",
|
|
76
|
+
],
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
61
80
|
## Prettier
|
|
62
81
|
|
|
63
82
|
Install additional packages:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aliexme/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Rule set for ESLint",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Alexander Smirnov <al.smirnov996@gmail.com>",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"./import": "./rules/import.js",
|
|
25
25
|
"./typescript": "./rules/typescript.js",
|
|
26
26
|
"./react": "./rules/react.js",
|
|
27
|
+
"./react-native": "./rules/react-native.js",
|
|
27
28
|
"./prettier": "./rules/prettier.js"
|
|
28
29
|
},
|
|
29
30
|
"publishConfig": {
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
"eslint-plugin-prettier": "4.2.1",
|
|
44
45
|
"eslint-plugin-react": "7.32.2",
|
|
45
46
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
47
|
+
"eslint-plugin-react-native": "4.0.0",
|
|
46
48
|
"husky": "8.0.3",
|
|
47
49
|
"lint-staged": "13.1.2",
|
|
48
50
|
"prettier": "2.8.4",
|
|
@@ -57,6 +59,7 @@
|
|
|
57
59
|
"eslint-plugin-prettier": "^4.2.1",
|
|
58
60
|
"eslint-plugin-react": "^7.32.2",
|
|
59
61
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
62
|
+
"eslint-plugin-react-native": "^4.0.0",
|
|
60
63
|
"prettier": "^2.8.4"
|
|
61
64
|
},
|
|
62
65
|
"peerDependenciesMeta": {
|
|
@@ -78,6 +81,9 @@
|
|
|
78
81
|
"eslint-plugin-react-hooks": {
|
|
79
82
|
"optional": true
|
|
80
83
|
},
|
|
84
|
+
"eslint-plugin-react-native": {
|
|
85
|
+
"optional": true
|
|
86
|
+
},
|
|
81
87
|
"prettier": {
|
|
82
88
|
"optional": true
|
|
83
89
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"env": {
|
|
3
|
+
"react-native/react-native": true,
|
|
4
|
+
},
|
|
5
|
+
"plugins": ["react-native"],
|
|
6
|
+
"extends": ["plugin:import/react-native"],
|
|
7
|
+
"rules": {
|
|
8
|
+
"react-native/no-unused-styles": "error",
|
|
9
|
+
"react-native/no-inline-styles": "error",
|
|
10
|
+
"react-native/no-raw-text": ["error", { "skip": ["Text", "Button"] }],
|
|
11
|
+
"react-native/no-single-element-style-arrays": "error",
|
|
12
|
+
},
|
|
13
|
+
"overrides": [
|
|
14
|
+
{
|
|
15
|
+
"files": ["**/*.{jsx,tsx}"],
|
|
16
|
+
"parserOptions": {
|
|
17
|
+
"ecmaFeatures": {
|
|
18
|
+
"jsx": true,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
}
|
package/rules/react.js
CHANGED
|
@@ -1,4 +1,33 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
"plugins": ["react", "react-hooks"],
|
|
3
|
+
"extends": [
|
|
4
|
+
"plugin:import/react",
|
|
5
|
+
"plugin:react/recommended",
|
|
6
|
+
"plugin:react/jsx-runtime",
|
|
7
|
+
"plugin:react-hooks/recommended",
|
|
8
|
+
],
|
|
9
|
+
"settings": {
|
|
10
|
+
"react": {
|
|
11
|
+
"version": "detect",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
"rules": {
|
|
15
|
+
"react/jsx-tag-spacing": [
|
|
16
|
+
"error",
|
|
17
|
+
{
|
|
18
|
+
"closingSlash": "never",
|
|
19
|
+
"beforeSelfClosing": "proportional-always",
|
|
20
|
+
"afterOpening": "never",
|
|
21
|
+
"beforeClosing": "never",
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
"react/jsx-max-props-per-line": ["error", { "when": "multiline" }],
|
|
25
|
+
"react/jsx-curly-spacing": ["error", { "when": "never", "children": true }],
|
|
26
|
+
"react/jsx-curly-brace-presence": ["error", "never"],
|
|
27
|
+
"react/jsx-closing-bracket-location": "error",
|
|
28
|
+
"react/self-closing-comp": "error",
|
|
29
|
+
"react/no-unused-prop-types": "error",
|
|
30
|
+
},
|
|
2
31
|
"overrides": [
|
|
3
32
|
{
|
|
4
33
|
"files": ["**/*.{jsx,tsx}"],
|
|
@@ -7,35 +36,6 @@ module.exports = {
|
|
|
7
36
|
"jsx": true,
|
|
8
37
|
},
|
|
9
38
|
},
|
|
10
|
-
"plugins": ["react", "react-hooks"],
|
|
11
|
-
"extends": [
|
|
12
|
-
"plugin:import/react",
|
|
13
|
-
"plugin:react/recommended",
|
|
14
|
-
"plugin:react/jsx-runtime",
|
|
15
|
-
"plugin:react-hooks/recommended",
|
|
16
|
-
],
|
|
17
|
-
"settings": {
|
|
18
|
-
"react": {
|
|
19
|
-
"version": "detect",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
"rules": {
|
|
23
|
-
"react/jsx-tag-spacing": [
|
|
24
|
-
"error",
|
|
25
|
-
{
|
|
26
|
-
"closingSlash": "never",
|
|
27
|
-
"beforeSelfClosing": "proportional-always",
|
|
28
|
-
"afterOpening": "never",
|
|
29
|
-
"beforeClosing": "never",
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
"react/jsx-max-props-per-line": ["error", { "when": "multiline" }],
|
|
33
|
-
"react/jsx-curly-spacing": ["error", { "when": "never", "children": true }],
|
|
34
|
-
"react/jsx-curly-brace-presence": ["error", "never"],
|
|
35
|
-
"react/jsx-closing-bracket-location": "error",
|
|
36
|
-
"react/self-closing-comp": "error",
|
|
37
|
-
"react/no-unused-prop-types": "error",
|
|
38
|
-
},
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
"files": ["**/*.tsx"],
|