Skip to content

Commit df6a020

Browse files
chore: refactor lint and prettier commands (#1888)
1 parent 2f56b18 commit df6a020

File tree

8 files changed

+122
-63
lines changed

8 files changed

+122
-63
lines changed

.eslintignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
web_modules
1+
client
2+
coverage
3+
client-src/live/web_modules/
4+
node_modules

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ client
99
coverage
1010
ssl/*.pem
1111
node_modules
12-
.vscode
12+
.vscode
13+
14+
.eslintcache

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
client
2+
coverage
13
client-src/live/web_modules/
24
node_modules
35
CHANGELOG.md
4-
*.bundle.js

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ Pull requests often need some real-world testing.
3939

4040
1. In your `package.json`, change the line with `webpack-dev-server` to:
4141

42-
```json
43-
"webpack-dev-server": "<PATH>"
44-
```
42+
```json
43+
"webpack-dev-server": "<PATH>"
44+
```
4545

46-
`<PATH>`:
46+
`<PATH>`:
4747

48-
- `github:webpack/webpack-dev-server#pull/<ID>/head`
48+
- `github:webpack/webpack-dev-server#pull/<ID>/head`
4949
where `<ID>` is the ID of the pull request.
5050

51-
- `file:../path/to/local/webapck-dev-server/fork` is the path to your local repo, just make sure you hit the correct path
51+
- `file:../path/to/local/webapck-dev-server/fork` is the path to your local repo, just make sure you hit the correct path
5252

5353
2. Run `npm install`.
5454

husky.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
module.exports = {
4+
hooks: {
5+
'pre-commit': 'lint-staged',
6+
'commit-msg': 'commitlint -E HUSKY_GIT_PARAMS',
7+
},
8+
};

lint-staged.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict';
2+
3+
module.exports = {
4+
ignore: ['package-lock.json', 'CHANGELOG.md'],
5+
linters: {
6+
'*.js': ['prettier --write', 'eslint --fix', 'git add'],
7+
'*.{json,md,yml,css}': ['prettier --write', 'git add'],
8+
},
9+
};

package-lock.json

Lines changed: 85 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
"node": ">= 6.11.5"
1515
},
1616
"scripts": {
17-
"lint": "eslint bin lib test examples client-src",
18-
"pretty": "prettier --loglevel warn --write \"**/*.{js,css,md,json,yml}\"",
17+
"lint:prettier": "prettier '{**/*,*}.{js,json,md,yml,css}' --list-different",
18+
"lint:js": "eslint . --cache",
19+
"lint": "npm-run-all -l -p 'lint:**'",
1920
"commitlint": "commitlint --from=master",
2021
"security": "npm audit",
2122
"test:only": "jest --runInBand",
@@ -74,10 +75,9 @@
7475
"copy-webpack-plugin": "5.0.3",
7576
"css-loader": "2.1.1",
7677
"eslint": "5.16.0",
77-
"eslint-config-prettier": "4.3.0",
78+
"eslint-config-prettier": "^4.3.0",
7879
"eslint-config-webpack": "1.2.5",
7980
"eslint-plugin-import": "2.17.2",
80-
"eslint-plugin-prettier": "3.1.0",
8181
"execa": "1.0.0",
8282
"file-loader": "3.0.1",
8383
"html-loader": "0.5.5",
@@ -91,6 +91,7 @@
9191
"lint-staged": "8.1.7",
9292
"marked": "0.6.2",
9393
"memfs": "2.15.2",
94+
"npm-run-all": "4.1.5",
9495
"nyc": "14.1.1",
9596
"prettier": "1.17.1",
9697
"puppeteer": "1.16.0",
@@ -106,23 +107,6 @@
106107
"peerDependencies": {
107108
"webpack": "^4.0.0"
108109
},
109-
"husky": {
110-
"hooks": {
111-
"pre-commit": "lint-staged",
112-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
113-
}
114-
},
115-
"lint-staged": {
116-
"*.js": [
117-
"eslint --fix",
118-
"prettier --write",
119-
"git add"
120-
],
121-
"*.{css,md,json,yml}": [
122-
"prettier --write",
123-
"git add"
124-
]
125-
},
126110
"author": "Tobias Koppers @sokra",
127111
"bugs": "https://github.com/webpack/webpack-dev-server/issues",
128112
"homepage": "https://github.com/webpack/webpack-dev-server#readme",

0 commit comments

Comments
 (0)