Skip to content

Commit 4cbbc72

Browse files
committed
chore: move out eslint stylelint commitlint config
1 parent 5737848 commit 4cbbc72

File tree

4 files changed

+135
-171
lines changed

4 files changed

+135
-171
lines changed

.eslintrc.json

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"extends": [
3+
"o2team",
4+
"plugin:react/recommended",
5+
"plugin:prettier/recommended"
6+
],
7+
"parser": "babel-eslint",
8+
"plugins": [
9+
"react"
10+
],
11+
"env": {
12+
"jest": true
13+
},
14+
"rules": {
15+
"class-methods-use-this": "off",
16+
"prefer-rest-params": "off",
17+
"arrow-body-style": "warn",
18+
"taro/custom-component-children": "off",
19+
"no-unused-vars": [
20+
"error",
21+
{
22+
"varsIgnorePattern": "React"
23+
}
24+
],
25+
"no-console": [
26+
"error",
27+
{
28+
"allow": [
29+
"warn",
30+
"error"
31+
]
32+
}
33+
]
34+
},
35+
"overrides": [
36+
{
37+
"files": [
38+
"build/*.js"
39+
],
40+
"rules": {
41+
"import/no-commonjs": "off"
42+
}
43+
},
44+
{
45+
"files": [
46+
"test/**/*.test.js",
47+
"test/**/test.js"
48+
],
49+
"rules": {
50+
"taro/no-stateless-component": "off",
51+
"react/react-in-jsx-scope": "off",
52+
"react/no-find-dom-node": "off",
53+
"no-unused-vars": [
54+
"error",
55+
{
56+
"varsIgnorePattern": "Nerv"
57+
}
58+
]
59+
}
60+
},
61+
{
62+
"files": [
63+
"**/*.ts",
64+
"**/*.tsx"
65+
],
66+
"parser": "@typescript-eslint/parser",
67+
"plugins": [
68+
"react",
69+
"@typescript-eslint"
70+
],
71+
"extends": [
72+
"eslint:recommended",
73+
"plugin:@typescript-eslint/eslint-recommended",
74+
"plugin:@typescript-eslint/recommended",
75+
"plugin:react/recommended",
76+
"plugin:prettier/recommended"
77+
],
78+
"env": {
79+
"jest": true
80+
},
81+
"rules": {
82+
"@typescript-eslint/no-explicit-any": [
83+
"off"
84+
],
85+
"@typescript-eslint/member-delimiter-style": [
86+
"off"
87+
],
88+
"class-methods-use-this": "off",
89+
"prefer-rest-params": "off",
90+
"arrow-body-style": "warn",
91+
"react/jsx-filename-extension": [
92+
2,
93+
{
94+
"extensions": [
95+
".js",
96+
".jsx",
97+
".ts",
98+
".tsx"
99+
]
100+
}
101+
]
102+
}
103+
}
104+
]
105+
}

.stylelintrc.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "stylelint-config-standard",
3+
"plugins": [
4+
"stylelint-scss"
5+
],
6+
"rules": {
7+
"declaration-colon-newline-after": null,
8+
"at-rule-no-unknown": null,
9+
"color-hex-case": null,
10+
"block-closing-brace-newline-after": null,
11+
"at-rule-empty-line-before": null,
12+
"number-no-trailing-zeros": null,
13+
"no-empty-source": null,
14+
"unit-case": null,
15+
"scss/at-rule-no-unknown": true
16+
}
17+
}

commitlint.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
rules: {
4+
'type-empty': [2, 'never'],
5+
'type-case': [2, 'always', 'lower-case'],
6+
'subject-empty': [2, 'never'],
7+
'type-enum': [
8+
2,
9+
'always',
10+
['feat', 'fix', 'docs', 'style', 'refactor', 'test', 'chore']
11+
]
12+
}
13+
}

packages/taro-ui/package.json

Lines changed: 0 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -28,177 +28,6 @@
2828
"url": "[email protected]:nervjs/taro-ui.git"
2929
},
3030
"license": "MIT",
31-
"eslintConfig": {
32-
"extends": [
33-
"o2team",
34-
"plugin:react/recommended",
35-
"plugin:prettier/recommended"
36-
],
37-
"parser": "babel-eslint",
38-
"plugins": [
39-
"react"
40-
],
41-
"env": {
42-
"jest": true
43-
},
44-
"rules": {
45-
"class-methods-use-this": "off",
46-
"prefer-rest-params": "off",
47-
"arrow-body-style": "warn",
48-
"taro/custom-component-children": "off",
49-
"no-unused-vars": [
50-
"error",
51-
{
52-
"varsIgnorePattern": "React"
53-
}
54-
],
55-
"no-console": [
56-
"error",
57-
{
58-
"allow": [
59-
"warn",
60-
"error"
61-
]
62-
}
63-
]
64-
},
65-
"overrides": [
66-
{
67-
"files": [
68-
"build/*.js"
69-
],
70-
"rules": {
71-
"import/no-commonjs": "off"
72-
}
73-
},
74-
{
75-
"files": [
76-
"test/**/*.test.js",
77-
"test/**/test.js"
78-
],
79-
"rules": {
80-
"taro/no-stateless-component": "off",
81-
"react/react-in-jsx-scope": "off",
82-
"react/no-find-dom-node": "off",
83-
"no-unused-vars": [
84-
"error",
85-
{
86-
"varsIgnorePattern": "Nerv"
87-
}
88-
]
89-
}
90-
},
91-
{
92-
"files": [
93-
"**/*.ts",
94-
"**/*.tsx"
95-
],
96-
"parser": "@typescript-eslint/parser",
97-
"plugins": [
98-
"react",
99-
"@typescript-eslint"
100-
],
101-
"extends": [
102-
"eslint:recommended",
103-
"plugin:@typescript-eslint/eslint-recommended",
104-
"plugin:@typescript-eslint/recommended",
105-
"plugin:react/recommended",
106-
"plugin:prettier/recommended"
107-
],
108-
"env": {
109-
"jest": true
110-
},
111-
"rules": {
112-
"@typescript-eslint/no-explicit-any": [
113-
"off"
114-
],
115-
"@typescript-eslint/member-delimiter-style": [
116-
"off"
117-
],
118-
"class-methods-use-this": "off",
119-
"prefer-rest-params": "off",
120-
"arrow-body-style": "warn",
121-
"react/jsx-filename-extension": [
122-
2,
123-
{
124-
"extensions": [
125-
".js",
126-
".jsx",
127-
".ts",
128-
".tsx"
129-
]
130-
}
131-
]
132-
}
133-
}
134-
]
135-
},
136-
"stylelint": {
137-
"extends": "stylelint-config-standard",
138-
"plugins": [
139-
"stylelint-scss"
140-
],
141-
"rules": {
142-
"declaration-colon-newline-after": null,
143-
"at-rule-no-unknown": null,
144-
"color-hex-case": null,
145-
"block-closing-brace-newline-after": null,
146-
"at-rule-empty-line-before": null,
147-
"number-no-trailing-zeros": null,
148-
"no-empty-source": null,
149-
"unit-case": null,
150-
"scss/at-rule-no-unknown": true
151-
}
152-
},
153-
"commitlint": {
154-
"extends": [
155-
"@commitlint/config-conventional"
156-
],
157-
"rules": {
158-
"type-empty": [
159-
2,
160-
"never"
161-
],
162-
"type-case": [
163-
2,
164-
"always",
165-
"lower-case"
166-
],
167-
"subject-empty": [
168-
2,
169-
"never"
170-
],
171-
"type-enum": [
172-
2,
173-
"always",
174-
[
175-
"feat",
176-
"fix",
177-
"docs",
178-
"style",
179-
"refactor",
180-
"test",
181-
"chore"
182-
]
183-
]
184-
}
185-
},
186-
"husky": {
187-
"hooks": {
188-
"pre-commit": "lint-staged",
189-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
190-
}
191-
},
192-
"lint-staged": {
193-
"*.{js,jsx,ts,tsx}": [
194-
"eslint --quiet --cache --fix",
195-
"git add"
196-
],
197-
"src/**/*.scss": [
198-
"stylelint --syntax scss --fix",
199-
"git add"
200-
]
201-
},
20231
"scripts": {
20332
"dev:weapp": "yarn run build:weapp -- --watch",
20433
"dev:qq": "yarn run build:qq -- --watch",

0 commit comments

Comments
 (0)