kopia lustrzana https://github.com/wagtail/bakerydemo
Add ESLint, Prettier, and Stylelint config files
rodzic
abde110d62
commit
41918f6a2c
|
@ -0,0 +1,3 @@
|
|||
node_modules
|
||||
venv
|
||||
.venv
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"extends": [
|
||||
"eslint:recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 9
|
||||
},
|
||||
"env": {
|
||||
"browser": true
|
||||
},
|
||||
"rules": {
|
||||
// allow no lines between single line members (e.g. static declarations)
|
||||
"lines-between-class-members": [
|
||||
"error",
|
||||
"always",
|
||||
{
|
||||
"exceptAfterSingleLine": true
|
||||
}
|
||||
],
|
||||
// note you must disable the base rule as it can report incorrect errors
|
||||
"no-use-before-define": "off",
|
||||
"no-underscore-dangle": "error"
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@ repos:
|
|||
hooks:
|
||||
- id: black
|
||||
language_version: python3
|
||||
args: ["--target-version", "py37"]
|
||||
args: ['--target-version', 'py37']
|
||||
- repo: https://github.com/timothycrosley/isort
|
||||
# isort config is in setup.cfg
|
||||
rev: 5.6.4
|
||||
|
@ -25,3 +25,26 @@ repos:
|
|||
rev: v1.4.13
|
||||
hooks:
|
||||
- id: djhtml
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: v2.5.1
|
||||
hooks:
|
||||
- id: prettier
|
||||
types_or: [css, javascript, json, yaml]
|
||||
- repo: https://github.com/pre-commit/mirrors-eslint
|
||||
rev: v8.8.0
|
||||
hooks:
|
||||
- id: eslint
|
||||
types: [file]
|
||||
files: \.(js)$
|
||||
args: [--report-unused-disable-directives]
|
||||
additional_dependencies:
|
||||
- eslint@8.8.0
|
||||
- repo: https://github.com/thibaudcolas/pre-commit-stylelint
|
||||
rev: v14.2.0
|
||||
hooks:
|
||||
- id: stylelint
|
||||
files: \.css$
|
||||
additional_dependencies:
|
||||
- stylelint@14.9.1
|
||||
- stylelint-config-standard@26.0.0
|
||||
- stylelint-config-prettier@9.0.3
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# Irrelevant files ignored for performance reasons.
|
||||
node_modules
|
||||
venv
|
||||
.venv
|
||||
*.min.css
|
||||
# File types which Prettier supports but we don’t want auto-formatting.
|
||||
*.md
|
||||
# Files which contain incompatible syntax.
|
||||
*.html
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"arrowParens": "always",
|
||||
"bracketSameLine": false,
|
||||
"bracketSpacing": true,
|
||||
"embeddedLanguageFormatting": "auto",
|
||||
"endOfLine": "lf",
|
||||
"htmlWhitespaceSensitivity": "css",
|
||||
"printWidth": 80,
|
||||
"proseWrap": "preserve",
|
||||
"quoteProps": "consistent",
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
node_modules
|
||||
venv
|
||||
.venv
|
||||
*.min.css
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"extends": ["stylelint-config-standard", "stylelint-config-prettier"],
|
||||
"rules": {
|
||||
"no-descending-specificity": null,
|
||||
"custom-property-pattern": "^([a-z][a-z0-9]*)(-{1,2}[a-z0-9]+)*$",
|
||||
"selector-class-pattern": [
|
||||
"^[a-z]+[0-9]{0,2}(-[a-z0-9]+)*(__[a-z0-9]+(-[a-z0-9]+)*)?(--[a-z0-9]+(-[a-z0-9]+)*)?$",
|
||||
{ "resolveNestedSelectors": true }
|
||||
]
|
||||
}
|
||||
}
|
17
Makefile
17
Makefile
|
@ -4,14 +4,27 @@ help:
|
|||
@echo "lint - check style with black, flake8, sort python with isort, and indent html"
|
||||
@echo "format - enforce a consistent code style across the codebase and sort python files with isort"
|
||||
|
||||
lint:
|
||||
lint-server:
|
||||
black --target-version py37 --check --diff .
|
||||
flake8
|
||||
isort --check-only --diff .
|
||||
curlylint --parse-only bakerydemo
|
||||
git ls-files '*.html' | xargs djhtml --check
|
||||
|
||||
format:
|
||||
lint-client:
|
||||
npm run lint:css --silent
|
||||
npm run lint:js --silent
|
||||
npm run lint:format --silent
|
||||
|
||||
lint: lint-server lint-client
|
||||
|
||||
format-server:
|
||||
black --target-version py37 .
|
||||
isort .
|
||||
git ls-files '*.html' | xargs djhtml -i
|
||||
|
||||
format-client:
|
||||
npm run format
|
||||
npm run fix:js
|
||||
|
||||
format: format-server format-client
|
||||
|
|
Ładowanie…
Reference in New Issue