Skip to content

Commit 6667a7a

Browse files
committed
chore: update eslint config
1 parent 50a15dd commit 6667a7a

File tree

4 files changed

+94
-41
lines changed

4 files changed

+94
-41
lines changed

.eslintrc.json

Lines changed: 82 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,13 @@
33
"extends": [
44
"o2team",
55
"eslint:recommended",
6-
"plugin:import/errors",
7-
"plugin:import/warnings",
8-
"plugin:react/recommended",
9-
"plugin:react-hooks/recommended",
106
"plugin:prettier/recommended"
117
],
12-
"rules": {
13-
"class-methods-use-this": "off",
14-
"prefer-rest-params": "off",
15-
"arrow-body-style": "warn",
16-
"taro/custom-component-children": "off",
17-
"no-unused-vars": [
18-
"error",
19-
{
20-
"varsIgnorePattern": "React"
21-
}
22-
],
23-
"no-console": [
24-
"error",
25-
{
26-
"allow": [
27-
"warn",
28-
"error"
29-
]
30-
}
31-
]
32-
},
338
"overrides": [
349
{
3510
"files": [
36-
"packages/taro-ui-docs/build/*.js"
37-
],
38-
"rules": {
39-
"import/no-commonjs": "off",
40-
"no-console": "off",
41-
"no-undefined": "off"
42-
}
43-
},
44-
{
45-
"files": [
46-
"test/**/*.test.js",
47-
"test/**/test.js"
11+
"packages/**/test/**/*.test.js",
12+
"packages/**/test/**/test.js"
4813
],
4914
"rules": {
5015
"taro/no-stateless-component": "off",
@@ -60,8 +25,8 @@
6025
},
6126
{
6227
"files": [
63-
"**/*.ts",
64-
"**/*.tsx"
28+
"packages/**/*.ts",
29+
"packages/**/*.tsx"
6530
],
6631
"parser": "@typescript-eslint/parser",
6732
"plugins": [
@@ -100,6 +65,84 @@
10065
}
10166
]
10267
}
68+
},
69+
{
70+
"files": [
71+
"packages/taro-ui-docs/**/*.js",
72+
"packages/taro-ui-docs/**/*.jsx"
73+
],
74+
"parser": "babel-eslint",
75+
"parserOptions": {
76+
"babelOptions": {
77+
"configFile": "./babel.config.json",
78+
"rootMode": "upward"
79+
}
80+
},
81+
"extends": [
82+
"eslint:recommended",
83+
"plugin:import/errors",
84+
"plugin:import/warnings",
85+
"plugin:react/recommended",
86+
"plugin:react-hooks/recommended",
87+
"plugin:prettier/recommended"
88+
],
89+
"rules": {
90+
"class-methods-use-this": "off",
91+
"prefer-rest-params": "off",
92+
"arrow-body-style": "warn",
93+
"taro/custom-component-children": "off",
94+
"no-unused-vars": [
95+
"error",
96+
{
97+
"varsIgnorePattern": "React"
98+
}
99+
],
100+
"no-console": [
101+
"error",
102+
{
103+
"allow": [
104+
"warn",
105+
"error"
106+
]
107+
}
108+
],
109+
"camelcase": [
110+
"error",
111+
{
112+
"allow": [
113+
"^UNSAFE_"
114+
]
115+
}
116+
]
117+
},
118+
"settings": {
119+
"import/resolver": {
120+
"node": {
121+
"extensions": [
122+
".js",
123+
".jsx"
124+
]
125+
},
126+
"eslint-import-resolver-custom-alias": {
127+
"alias": {
128+
"@md": "./markdown"
129+
},
130+
"packages": [
131+
"packages/taro-ui-docs"
132+
]
133+
}
134+
}
135+
}
136+
},
137+
{
138+
"files": [
139+
"packages/taro-ui-docs/build/*.js"
140+
],
141+
"rules": {
142+
"import/no-commonjs": "off",
143+
"no-console": "off",
144+
"no-undefined": "off"
145+
}
103146
}
104147
]
105148
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"eslint": "^6.8.0",
2828
"eslint-config-o2team": "^0.1.7",
2929
"eslint-config-prettier": "^6.10.1",
30+
"eslint-import-resolver-custom-alias": "^1.2.0",
3031
"eslint-plugin-import": "^2.20.2",
3132
"eslint-plugin-prettier": "^3.1.2",
3233
"eslint-plugin-react": "^7.19.0",

packages/taro-ui-docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"@types/react-dom": "^16.9.6",
3333
"@types/webpack-env": "^1.15.1",
3434
"at-ui-style": "^1.5.1",
35+
"babel-eslint": "^10.1.0",
3536
"babel-loader": "^8.1.0",
3637
"chalk": "^4.0.0",
3738
"classnames": "^2.2.6",

yarn.lock

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4000,7 +4000,7 @@ babel-core@^6.26.0, babel-core@^6.26.3:
40004000
slash "^1.0.0"
40014001
source-map "^0.5.7"
40024002

4003-
babel-eslint@^10.0.0:
4003+
babel-eslint@^10.0.0, babel-eslint@^10.1.0:
40044004
version "10.1.0"
40054005
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.1.0.tgz#6968e568a910b78fb3779cdd8b6ac2f479943232"
40064006
integrity sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg==
@@ -7069,6 +7069,14 @@ [email protected]:
70697069
"@typescript-eslint/parser" "^2.x"
70707070
babel-eslint "^10.0.0"
70717071

7072+
eslint-import-resolver-custom-alias@^1.2.0:
7073+
version "1.2.0"
7074+
resolved "https://registry.yarnpkg.com/eslint-import-resolver-custom-alias/-/eslint-import-resolver-custom-alias-1.2.0.tgz#b1e596c3c5c818ae4fc75478ec25dbef5d70e96d"
7075+
integrity sha512-UF5+nNKZOKqQStYHKJYii2cK3HegH6ZgBZdSGXFX3+S0iqoLl/0Ln7eHZZR3kSI3Qb3CAzQyE+Zsjmhp91jipw==
7076+
dependencies:
7077+
glob-parent "^5.1.0"
7078+
resolve "^1.3.0"
7079+
70727080
eslint-import-resolver-node@^0.3.2:
70737081
version "0.3.3"
70747082
resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.3.tgz#dbaa52b6b2816b50bc6711af75422de808e98404"
@@ -14451,7 +14459,7 @@ resolve-url@^0.2.1:
1445114459
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
1445214460
integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=
1445314461

14454-
[email protected], resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.14.2, resolve@^1.15.1, resolve@^1.3.2, resolve@^1.6.0, resolve@^1.8.1:
14462+
[email protected], resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.14.2, resolve@^1.15.1, resolve@^1.3.0, resolve@^1.3.2, resolve@^1.6.0, resolve@^1.8.1:
1445514463
version "1.15.1"
1445614464
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8"
1445714465
integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==

0 commit comments

Comments
 (0)