build: add JS and CSS linters

This commit is contained in:
Ben Goldsworthy 2021-04-15 03:06:08 +01:00
parent b14a2d80bb
commit a661d36752
8 changed files with 6792 additions and 0 deletions

6
.eslintignore Normal file
View file

@ -0,0 +1,6 @@
dist/
docs/
vendor/
node_modules/
*.min.js
jquery.tools.js

12
.eslintrc.js Normal file
View file

@ -0,0 +1,12 @@
module.exports = {
env: {
browser: true,
jquery: true,
es6: true
},
extends: [
'wordpress',
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
rules: {},
};

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
.phpdoc/ .phpdoc/
vendor/ vendor/
node_modules/
dist/ dist/
tmp/ tmp/

7
.prettierrc Normal file
View file

@ -0,0 +1,7 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 120,
"tabWidth": 2
}

4
.stylelintignore Normal file
View file

@ -0,0 +1,4 @@
dist/
docs/
vendor/
node_modules/

3
.stylelintrc.json Normal file
View file

@ -0,0 +1,3 @@
{
"extends": "stylelint-config-wordpress",
}

6740
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

19
package.json Normal file
View file

@ -0,0 +1,19 @@
{
"scripts": {
"lint": "npm run lint:js && npm run lint:css",
"lint:fix": "npm run lint:js:fix && npm run lint:css:fix",
"lint:js": "eslint \"./js/*.js\"",
"lint:js:fix": "npm run lint:js -- --fix",
"lint:css": "stylelint \"./css/*.css\"",
"lint:css:fix": "npm run lint:css -- --fix"
},
"devDependencies": {
"eslint": "^7.24.0",
"eslint-config-prettier": "^8.2.0",
"eslint-config-wordpress": "^2.0.0",
"eslint-plugin-prettier": "^3.4.0",
"prettier": "^2.2.1",
"stylelint": "^13.12.0",
"stylelint-config-wordpress": "^17.0.0"
}
}