Skip to content

Commit

Permalink
chore: refactor lint and prettier commands (#1888)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed May 16, 2019
1 parent 2f56b18 commit df6a020
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 63 deletions.
5 changes: 4 additions & 1 deletion .eslintignore
@@ -1 +1,4 @@
web_modules
client
coverage
client-src/live/web_modules/
node_modules
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -9,4 +9,6 @@ client
coverage
ssl/*.pem
node_modules
.vscode
.vscode

.eslintcache
3 changes: 2 additions & 1 deletion .prettierignore
@@ -1,4 +1,5 @@
client
coverage
client-src/live/web_modules/
node_modules
CHANGELOG.md
*.bundle.js
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Expand Up @@ -39,16 +39,16 @@ Pull requests often need some real-world testing.

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

```json
"webpack-dev-server": "<PATH>"
```
```json
"webpack-dev-server": "<PATH>"
```

`<PATH>`:
`<PATH>`:

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

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

2. Run `npm install`.

Expand Down
8 changes: 8 additions & 0 deletions husky.config.js
@@ -0,0 +1,8 @@
'use strict';

module.exports = {
hooks: {
'pre-commit': 'lint-staged',
'commit-msg': 'commitlint -E HUSKY_GIT_PARAMS',
},
};
9 changes: 9 additions & 0 deletions lint-staged.config.js
@@ -0,0 +1,9 @@
'use strict';

module.exports = {
ignore: ['package-lock.json', 'CHANGELOG.md'],
linters: {
'*.js': ['prettier --write', 'eslint --fix', 'git add'],
'*.{json,md,yml,css}': ['prettier --write', 'git add'],
},
};
118 changes: 85 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 5 additions & 21 deletions package.json
Expand Up @@ -14,8 +14,9 @@
"node": ">= 6.11.5"
},
"scripts": {
"lint": "eslint bin lib test examples client-src",
"pretty": "prettier --loglevel warn --write \"**/*.{js,css,md,json,yml}\"",
"lint:prettier": "prettier '{**/*,*}.{js,json,md,yml,css}' --list-different",
"lint:js": "eslint . --cache",
"lint": "npm-run-all -l -p 'lint:**'",
"commitlint": "commitlint --from=master",
"security": "npm audit",
"test:only": "jest --runInBand",
Expand Down Expand Up @@ -74,10 +75,9 @@
"copy-webpack-plugin": "5.0.3",
"css-loader": "2.1.1",
"eslint": "5.16.0",
"eslint-config-prettier": "4.3.0",
"eslint-config-prettier": "^4.3.0",
"eslint-config-webpack": "1.2.5",
"eslint-plugin-import": "2.17.2",
"eslint-plugin-prettier": "3.1.0",
"execa": "1.0.0",
"file-loader": "3.0.1",
"html-loader": "0.5.5",
Expand All @@ -91,6 +91,7 @@
"lint-staged": "8.1.7",
"marked": "0.6.2",
"memfs": "2.15.2",
"npm-run-all": "4.1.5",
"nyc": "14.1.1",
"prettier": "1.17.1",
"puppeteer": "1.16.0",
Expand All @@ -106,23 +107,6 @@
"peerDependencies": {
"webpack": "^4.0.0"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"*.js": [
"eslint --fix",
"prettier --write",
"git add"
],
"*.{css,md,json,yml}": [
"prettier --write",
"git add"
]
},
"author": "Tobias Koppers @sokra",
"bugs": "https://github.com/webpack/webpack-dev-server/issues",
"homepage": "https://github.com/webpack/webpack-dev-server#readme",
Expand Down

0 comments on commit df6a020

Please sign in to comment.