Skip to content

Commit 5a52020

Browse files
authored
Consistent linting and formatting across CI and local environment (#2368)
1 parent 8951bff commit 5a52020

7 files changed

Lines changed: 1426 additions & 67 deletions

File tree

.pre-commit-config.yaml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,11 @@ ci:
55
autofix_prs: true
66
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate hooks"
77
autoupdate_schedule: monthly
8-
9-
# Fix the node version to avoid a GLIBC error
10-
# ref: https://stackoverflow.com/questions/71939099/bitbucket-pipeline-error-installing-pre-commit-ts-lint/71940852#71940852
11-
default_language_version:
12-
node: 22.9.0
8+
skip:
9+
- prettier
10+
- stylelint
1311

1412
repos:
15-
- repo: "https://github.com/pycontribs/mirrors-prettier"
16-
rev: v3.6.2
17-
hooks:
18-
- id: prettier
19-
# Exclude the HTML, since it doesn't understand Jinja2
20-
# exclude also the webpack.config.js file has it embed complete url dificult to prettify
21-
# exclude the pytest-regressions folder tests/test_ally
22-
exclude: .+\.html|webpack\.config\.js|tests/test_a11y/
23-
2413
- repo: "https://github.com/astral-sh/ruff-pre-commit"
2514
rev: "v0.15.4"
2615
hooks:
@@ -55,16 +44,20 @@ repos:
5544
hooks:
5645
- id: remove-metadata
5746

58-
- repo: "https://github.com/thibaudcolas/pre-commit-stylelint"
59-
rev: v17.4.0
47+
- repo: local
6048
hooks:
49+
- id: prettier
50+
name: prettier
51+
entry: 'npm run prettier:files'
52+
language: node
53+
types_or: [json, ts, tsx, javascript, jsx, css, scss]
54+
exclude: .+\.html|webpack\.config\.js|tests/test_a11y/
55+
6156
- id: stylelint
62-
# automatically fix .scss files where possible
63-
args: [--fix]
64-
additional_dependencies:
65-
# stylelint itself needs to be here when using additional_dependencies.
66-
- stylelint@16.26.1
67-
- stylelint-config-standard-scss@16.0.0
57+
name: stylelint
58+
entry: 'npm run stylelint:files'
59+
language: node
60+
types: [scss]
6861

6962
- repo: "https://github.com/pre-commit/pre-commit-hooks"
7063
rev: v6.0.0

.prettierignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Exclude the HTML, since it doesn't understand Jinja2
2+
**/*.html
3+
4+
# webpack.config.js embeds complete url dificult to prettify
5+
webpack.config.js
6+
7+
# exclude the pytest-regressions folder
8+
tests/test_a11y/

.stylelintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
docs/_build/
2+
docs/examples/generated/

.stylelintrc.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

.stylelintrc.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
$schema: https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/stylelintrc.json
2+
3+
extends:
4+
- stylelint-config-standard-scss
5+
- stylelint-prettier/recommended
6+
7+
rules:
8+
no-descending-specificity: null
9+
# this fixer is incompatible with the copyright headers
10+
comment-whitespace-inside: null
11+
# these fixers assume use of `autoprefixer`
12+
property-no-vendor-prefix: null
13+
selector-no-vendor-prefix: null
14+
value-no-vendor-prefix: null
15+
# these fixers don't work well with variables
16+
alpha-value-notation: null
17+
color-function-notation: null
18+
# rejects rgba
19+
color-function-alias-notation: null
20+
# enforce #ffffff instead of #fff
21+
color-hex-length: null
22+
# disable enforce kebab case
23+
selector-class-pattern: null

0 commit comments

Comments
 (0)