Skip to content

Commit 1b886ee

Browse files
committed
improve prettier and lint config and performance
1 parent 6e01fd5 commit 1b886ee

14 files changed

+89
-199
lines changed

.editorconfig

-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ trim_trailing_whitespace = true
88
insert_final_newline = true
99
max_line_length = 80
1010

11-
[.prettierrc]
12-
indent_style = space
13-
indent_size = 2
14-
1511
[*.{yml,yaml,json}]
1612
indent_style = space
1713
indent_size = 2

.eslintrc.js

+26-19
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
module.exports = {
22
root: true,
33
plugins: ["prettier", "node", "jest"],
4-
extends: ["eslint:recommended", "plugin:node/recommended", "plugin:prettier/recommended"],
4+
extends: [
5+
"eslint:recommended",
6+
"plugin:node/recommended",
7+
"plugin:prettier/recommended"
8+
],
59
env: {
610
node: true,
711
es6: true
@@ -16,8 +20,8 @@ module.exports = {
1620
"no-template-curly-in-string": "error",
1721
"no-caller": "error",
1822
"no-control-regex": "off",
19-
"yoda": "error",
20-
"eqeqeq": "error",
23+
yoda: "error",
24+
eqeqeq: "error",
2125
"global-require": "off",
2226
"brace-style": "error",
2327
"eol-last": "error",
@@ -27,23 +31,26 @@ module.exports = {
2731
"no-unused-vars": ["error", { args: "none" }],
2832
"no-unsafe-negation": "error",
2933
"no-loop-func": "warn",
30-
"indent": "off",
34+
indent: "off",
3135
"no-console": "off",
32-
"valid-jsdoc": ["error", {
33-
"prefer": {
34-
"return": "returns",
35-
"prop": "property",
36-
"memberof": "DONTUSE",
37-
"class": "DONTUSE",
38-
"inheritdoc": "DONTUSE",
39-
"description": "DONTUSE",
40-
"readonly": "DONTUSE"
41-
},
42-
"preferType": {
43-
"*": "any"
44-
},
45-
"requireReturnType": true
46-
}],
36+
"valid-jsdoc": [
37+
"error",
38+
{
39+
prefer: {
40+
return: "returns",
41+
prop: "property",
42+
memberof: "DONTUSE",
43+
class: "DONTUSE",
44+
inheritdoc: "DONTUSE",
45+
description: "DONTUSE",
46+
readonly: "DONTUSE"
47+
},
48+
preferType: {
49+
"*": "any"
50+
},
51+
requireReturnType: true
52+
}
53+
],
4754
"node/no-unsupported-features": "error",
4855
"node/no-deprecated-api": "error",
4956
"node/no-missing-import": "error",

.prettierignore

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
# Ignore all paths.
2-
**/*.*
3-
4-
# Enable prettier for the following paths.
5-
!*.{ts,js,json}
6-
!setup/**/*.js
7-
!lib/**/*.js
8-
!bin/*.js
9-
!hot/*.js
10-
!buildin/*.js
11-
!benchmark/**/*.js
1+
# Ignore test fixtures
2+
test
123
!test/*.js
13-
!tooling/*.js
144
!test/**/webpack.config.js
5+
6+
# Ignore example fixtures
7+
examples
158
!examples/**/webpack.config.js
16-
!schemas/**/*.js

.prettierrc.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
module.exports = {
22
printWidth: 80,
33
useTabs: true,
4-
tabWidth: 2
4+
tabWidth: 2,
5+
overrides: [
6+
{
7+
files: "*.json",
8+
options: {
9+
useTabs: false
10+
}
11+
}
12+
]
513
};

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@
120120
"pretest": "yarn lint",
121121
"prelint": "yarn setup",
122122
"lint": "yarn code-lint && yarn schema-lint && yarn type-lint",
123-
"code-lint": "eslint --cache setup lib bin hot buildin benchmark tooling \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\"",
123+
"code-lint": "eslint --cache \"{setup,lib,bin,hot,buildin,benchmark,tooling,schemas}/**/*.js\" \"test/*.js\" \"test/{configCases,watchCases,statsCases,hotCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"",
124124
"type-lint": "tsc --pretty",
125125
"fix": "yarn code-lint --fix",
126-
"pretty": "prettier --write \"*.{ts,js,json}\" \"setup/**/*.js\" \"lib/**/*.js\" \"bin/*.js\" \"hot/*.js\" \"buildin/*.js\" \"benchmark/**/*.js\" \"tooling/*.js\" \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\"",
126+
"pretty": "prettier --loglevel warn --write \"*.{ts,js,json}\" \"{setup,lib,bin,hot,buildin,benchmark,tooling,schemas}/**/*.{js,json}\" \"test/*.js\" \"test/{configCases,watchCases,statsCases,hotCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"",
127127
"schema-lint": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.lint.js\" --no-verbose",
128128
"benchmark": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.benchmark.js\" --runInBand",
129129
"cover": "yarn cover:init && yarn cover:all && yarn cover:report",

0 commit comments

Comments
 (0)