Skip to content

Commit

Permalink
chore: use lint-staged for JS pre-commit linting (#436)
Browse files Browse the repository at this point in the history
xwd-dev-lib lints in a tmp dir with changed files only, which makes
import/no-unresolved rule fail at times, as not all files are present
  • Loading branch information
adekbadek committed Feb 21, 2020
1 parent ef076c0 commit d6c0647
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -28,7 +28,7 @@
},
"extra": {
"hooks": {
"pre-commit": "./vendor/xwp/wp-dev-lib/scripts/pre-commit && ./node_modules/.bin/lint-staged",
"pre-commit": "DEV_LIB_SKIP=eslint ./vendor/xwp/wp-dev-lib/scripts/pre-commit && ./node_modules/.bin/lint-staged",
"commit-msg": [
"cat $1 | ./node_modules/.bin/commitlint"
]
Expand Down
7 changes: 4 additions & 3 deletions package.json
Expand Up @@ -77,6 +77,9 @@
"browserslist": [
"extends @wordpress/browserslist-config"
],
"lint-staged": {
"*.scss": "npm run lint:scss:staged"
},
"jest": {
"setupFilesAfterEnv": [
"<rootDir>/assets/setupTests.js"
Expand Down Expand Up @@ -109,16 +112,14 @@
"test": "jest",
"lint": "npm-run-all --parallel lint:*",
"lint:js": "eslint --ext .js,.jsx assets",
"lint:js:staged": "eslint --ext .js,.jsx",
"format:js": "prettier 'assets/**/*.{js,jsx}' --write",
"lint:scss": "stylelint '**/*.scss' --syntax scss",
"format:scss": "prettier --write '**/*.scss'",
"lint:scss:staged": "stylelint --syntax scss",
"release:archive": "mkdir -p assets/release && zip -r assets/release/newspack-plugin.zip . -x node_modules/\\* .git/\\* .github/\\* .gitignore .DS_Store tests/\\* assets/\\* vendor/\\*",
"release": "run-p \"build\" && run-p \"release:archive\""
},
"lint-staged": {
"*.scss": "npm run lint:scss:staged"
},
"dependencies": {
"@material-ui/core": "^4.8.2",
"@material-ui/icons": "^4.5.1",
Expand Down

0 comments on commit d6c0647

Please sign in to comment.