Merge pull request #21976 from woocommerce/update/pre-commit
New pre-commit hook for PHP, JS and SCSS
This commit is contained in:
commit
4c04e1a22f
59
.stylelintrc
59
.stylelintrc
|
@ -1,60 +1,3 @@
|
|||
{
|
||||
"rules": {
|
||||
"indentation": "tab",
|
||||
"color-hex-case": "lower",
|
||||
"color-no-invalid-hex": true,
|
||||
|
||||
"function-calc-no-unspaced-operator": true,
|
||||
"function-comma-space-after": "always-single-line",
|
||||
"function-comma-space-before": "never",
|
||||
"function-name-case": "lower",
|
||||
"function-url-quotes": "always",
|
||||
"function-whitespace-after": "always",
|
||||
|
||||
"number-leading-zero": "always",
|
||||
"number-no-trailing-zeros": true,
|
||||
"length-zero-no-unit": true,
|
||||
|
||||
"string-no-newline": true,
|
||||
"string-quotes": "single",
|
||||
|
||||
"unit-case": "lower",
|
||||
"unit-no-unknown": true,
|
||||
"unit-whitelist": ["px", "%", "deg", "ms", "em", "vh", "vw", "rem", "s", "ex", "pt", "cm"],
|
||||
|
||||
"value-list-comma-space-after": "always-single-line",
|
||||
"value-list-comma-space-before": "never",
|
||||
|
||||
"shorthand-property-no-redundant-values": true,
|
||||
|
||||
"property-case": "lower",
|
||||
|
||||
"declaration-block-no-duplicate-properties": [true, { "severity": "warning" } ],
|
||||
"declaration-block-no-ignored-properties": [true, { "severity": "warning" } ],
|
||||
"declaration-block-trailing-semicolon": "always",
|
||||
"declaration-block-single-line-max-declarations": 0,
|
||||
"declaration-block-semicolon-space-before": "never",
|
||||
"declaration-block-semicolon-space-after": "always-single-line",
|
||||
"declaration-block-semicolon-newline-before": "never-multi-line",
|
||||
"declaration-block-semicolon-newline-after": "always-multi-line",
|
||||
|
||||
"block-closing-brace-newline-after": "always",
|
||||
"block-closing-brace-newline-before": "always-multi-line",
|
||||
"block-no-empty": true,
|
||||
"block-opening-brace-newline-after": "always-multi-line",
|
||||
"block-opening-brace-space-before": "always",
|
||||
|
||||
"selector-attribute-brackets-space-inside": "never",
|
||||
"selector-attribute-operator-space-after": "never",
|
||||
"selector-attribute-operator-space-before": "never",
|
||||
"selector-combinator-space-after": "always",
|
||||
"selector-combinator-space-before": "always",
|
||||
"selector-pseudo-class-case": "lower",
|
||||
"selector-pseudo-class-parentheses-space-inside": "always",
|
||||
"selector-pseudo-element-case": "lower",
|
||||
"selector-pseudo-element-colon-notation": "double",
|
||||
"selector-pseudo-element-no-unknown": true,
|
||||
"selector-type-case": "lower",
|
||||
"selector-no-id": [true, { "severity": "warning" } ]
|
||||
}
|
||||
"extends": "stylelint-config-wordpress",
|
||||
}
|
||||
|
|
|
@ -13,28 +13,18 @@
|
|||
"apigen/apigen": "4.1.2",
|
||||
"nette/utils": "2.5.3",
|
||||
"phpunit/phpunit": "6.5.13",
|
||||
"woocommerce/woocommerce-git-hooks": "*",
|
||||
"woocommerce/woocommerce-sniffs": "0.0.5"
|
||||
},
|
||||
"scripts": {
|
||||
"pre-update-cmd": [
|
||||
"WooCommerce\\GitHooks\\Hooks::preHooks"
|
||||
],
|
||||
"pre-install-cmd": [
|
||||
"WooCommerce\\GitHooks\\Hooks::preHooks"
|
||||
],
|
||||
"post-install-cmd": [
|
||||
"WooCommerce\\GitHooks\\Hooks::postHooks"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"WooCommerce\\GitHooks\\Hooks::postHooks"
|
||||
],
|
||||
"test": [
|
||||
"phpunit"
|
||||
],
|
||||
"phpcs": [
|
||||
"phpcs -s -p"
|
||||
],
|
||||
"phpcs-pre-commit": [
|
||||
"phpcs -s -p -n"
|
||||
],
|
||||
"phpcbf": [
|
||||
"phpcbf -p"
|
||||
]
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
31
package.json
31
package.json
|
@ -15,7 +15,8 @@
|
|||
"lint:js": "eslint assets/js --ext=js",
|
||||
"test": "cross-env NODE_CONFIG_DIR='./tests/e2e-tests/config' BABEL_ENV=commonjs mocha \"tests/e2e-tests\" --require babel-register --recursive",
|
||||
"test:grep": "cross-env NODE_CONFIG_DIR='./tests/e2e-tests/config' BABEL_ENV=commonjs mocha \"tests/e2e-tests\" --require babel-register --grep ",
|
||||
"test:single": "cross-env NODE_CONFIG_DIR='./tests/e2e-tests/config' BABEL_ENV=commonjs mocha --require babel-register"
|
||||
"test:single": "cross-env NODE_CONFIG_DIR='./tests/e2e-tests/config' BABEL_ENV=commonjs mocha --require babel-register",
|
||||
"git:update-hooks": "rm -r .git/hooks && mkdir -p .git/hooks && node ./node_modules/husky/husky.js install"
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "9.4.5",
|
||||
|
@ -49,10 +50,13 @@
|
|||
"grunt-shell": "3.0.1",
|
||||
"grunt-stylelint": "0.10.1",
|
||||
"grunt-wp-i18n": "1.0.3",
|
||||
"husky": "^1.1.4",
|
||||
"istanbul": "1.0.0-alpha.2",
|
||||
"lint-staged": "^8.0.5",
|
||||
"mocha": "5.2.0",
|
||||
"prettier": "github:automattic/calypso-prettier#c56b4251",
|
||||
"stylelint": "9.10.0",
|
||||
"stylelint-config-wordpress": "^13.1.0",
|
||||
"wc-e2e-page-objects": "0.10.0"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -61,5 +65,30 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"github-contributors-list": "https://github.com/woocommerce/github-contributors-list/tarball/master"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"linters": {
|
||||
"*.php": [
|
||||
"php -d display_errors=1 -l",
|
||||
"composer run-script phpcs-pre-commit"
|
||||
],
|
||||
"*.scss": [
|
||||
"stylelint --syntax=scss --fix",
|
||||
"git add"
|
||||
],
|
||||
"*.js": [
|
||||
"eslint --fix",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"ignore": [
|
||||
"*.min.js",
|
||||
"*.css"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue