mirror of
https://github.com/plausible/analytics.git
synced 2024-11-23 03:04:43 +03:00
Add eslint, stylelint, prettier, and pre-commit (#484)
- When you try to commit, Pre-commit will run checks for all three, if installed, _only_ on staged files, and prevent committing if the linters are unhappy. - Several eslint rules that generate a lot of errors are disabled for now. That's to allow a more gradual transition, so you won't change 1 line and be told to fix 100 other lines (but maybe like 20 because there are still a lot of rules enabled). - Prettier is set to require pragma. That's also to allow a more gradual transition. As each file is tidied up, run Prettier on it, and it'll add a special comment that tells it that it's now responsible for keeping that one tidy.
This commit is contained in:
parent
55ecbbe04f
commit
e95ff80c3d
28
.pre-commit-config.yaml
Normal file
28
.pre-commit-config.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: "v2.2.1"
|
||||
hooks:
|
||||
- id: prettier
|
||||
files: "assets/js|assets/css"
|
||||
args: [--config, assets/.prettierrc.json]
|
||||
- repo: https://github.com/awebdeveloper/pre-commit-stylelint
|
||||
rev: 'f792d6b'
|
||||
hooks:
|
||||
- id: stylelint
|
||||
additional_dependencies:
|
||||
- stylelint@13.2.1
|
||||
- stylelint-config-standard@20.0.0
|
||||
- repo: https://github.com/pre-commit/mirrors-eslint
|
||||
rev: 'v7.15.0'
|
||||
hooks:
|
||||
- id: eslint
|
||||
files: "assets/js"
|
||||
additional_dependencies:
|
||||
- eslint@7.2.0
|
||||
- eslint-config-airbnb@18.2.0
|
||||
- eslint-plugin-import@2.22.1
|
||||
- eslint-plugin-jsx-a11y@6.4.1
|
||||
- eslint-plugin-react@7.21.5
|
||||
- eslint-plugin-react-hooks@4.2.0
|
14
assets/.eslintrc.json
Normal file
14
assets/.eslintrc.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"extends": ["airbnb", "prettier"],
|
||||
"plugins": ["prettier"],
|
||||
"rules": {
|
||||
"max-len": [2, {"code": 100}],
|
||||
"prettier/prettier": [2],
|
||||
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
|
||||
"react/destructuring-assignment": [0],
|
||||
"react/prop-types": [0],
|
||||
"max-classes-per-file": [0],
|
||||
"react/jsx-one-expression-per-line": [0],
|
||||
"react/self-closing-comp": [0]
|
||||
}
|
||||
}
|
5
assets/.prettierrc.json
Normal file
5
assets/.prettierrc.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"requirePragma": true,
|
||||
"insertPragma": true
|
||||
}
|
22
assets/.stylelintrc.json
Normal file
22
assets/.stylelintrc.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"extends": [
|
||||
"stylelint-config-standard",
|
||||
"stylelint-config-prettier"
|
||||
],
|
||||
"rules": {
|
||||
"at-rule-no-unknown": [
|
||||
true,
|
||||
{
|
||||
"ignoreAtRules": [
|
||||
"tailwind",
|
||||
"apply",
|
||||
"variants",
|
||||
"responsive",
|
||||
"screen"
|
||||
]
|
||||
}
|
||||
],
|
||||
"declaration-block-trailing-semicolon": null,
|
||||
"no-descending-specificity": null
|
||||
}
|
||||
}
|
17919
assets/package-lock.json
generated
17919
assets/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -37,5 +37,18 @@
|
||||
"url-search-params-polyfill": "^8.0.0",
|
||||
"webpack": "4.39.2",
|
||||
"webpack-cli": "^3.3.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^7.2.0",
|
||||
"eslint-config-airbnb": "^18.2.0",
|
||||
"eslint-config-prettier": "^7.0.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||
"eslint-plugin-prettier": "^3.3.0",
|
||||
"eslint-plugin-react": "^7.21.5",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"stylelint": "^13.8.0",
|
||||
"stylelint-config-prettier": "^8.0.2",
|
||||
"stylelint-config-standard": "^20.0.0"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user