Skip to content

Commit b322d67

Browse files
author
Hood Chatham
authored
Update prettier precommit and ci rules (pyodide#1747)
1 parent 0143c5e commit b322d67

File tree

4 files changed

+23
-26
lines changed

4 files changed

+23
-26
lines changed

.pre-commit-config.yaml

+18-13
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,38 @@
11
exclude: '^.*patches|.*\.cgi$'
22
default_language_version:
3-
python : "3.9"
3+
python: "3.9"
44
repos:
5-
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
66
rev: v2.3.0
77
hooks:
8-
- id: check-yaml
9-
- id: end-of-file-fixer
10-
- id: trailing-whitespace
11-
- repo: https://github.com/psf/black
8+
- id: check-yaml
9+
- id: end-of-file-fixer
10+
- id: trailing-whitespace
11+
- repo: https://github.com/psf/black
1212
rev: 20.8b1
1313
hooks:
14-
- id: black
15-
- repo: https://gitlab.com/pycqa/flake8
14+
- id: black
15+
- repo: https://gitlab.com/pycqa/flake8
1616
rev: 3.7.8
1717
hooks:
18-
- id: flake8
18+
- id: flake8
1919
types: [file, python]
2020
# only check for unused imports, as the rest is done by black
2121
args: [--select=F401]
22-
- repo: https://github.com/pre-commit/mirrors-mypy
22+
- repo: https://github.com/pre-commit/mirrors-mypy
2323
rev: v0.812
2424
hooks:
25-
- id: mypy
25+
- id: mypy
2626
args:
2727
- --ignore-missing-imports
28-
- repo: local
28+
- repo: local
2929
hooks:
30-
- id: clang-format
30+
- id: clang-format
3131
name: clang-format-6.0
3232
language: system
3333
entry: ./tools/clang-format-precommit.sh
34+
35+
- repo: https://github.com/pre-commit/mirrors-prettier
36+
rev: "v2.3.2" # Use the sha / tag you want to point at
37+
hooks:
38+
- id: prettier

Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ lint: node_modules/.installed
151151
find src -type f -regex '.*\.\(c\|h\)' \
152152
| xargs clang-format-6.0 -output-replacements-xml \
153153
| (! grep '<replacement ')
154-
npx prettier --check `find src -type f -name '*.js' -not -name '*.gen.js'`
155-
npx prettier --check `find src -type f -name '*.html'`
154+
npx prettier --check src --ignore-path '*.gen.*'
156155
black --check .
157156
mypy --ignore-missing-imports \
158157
pyodide-build/pyodide_build/ \

src/js/index.test-d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ async function main() {
7676
expectType<void>(px.destroy());
7777
expectType<any>(px.toJs());
7878
expectType<any>(px.toJs({}));
79-
expectType<any>(px.toJs({depth : 10}));
80-
expectType<any>(px.toJs({create_pyproxies : false}));
81-
expectType<any>(px.toJs({create_pyproxies : true}));
82-
expectType<any>(px.toJs({pyproxies : []}));
79+
expectType<any>(px.toJs({ depth: 10 }));
80+
expectType<any>(px.toJs({ create_pyproxies: false }));
81+
expectType<any>(px.toJs({ create_pyproxies: true }));
82+
expectType<any>(px.toJs({ pyproxies: [] }));
8383
expectType<string>(px.toString());
8484
expectType<string>(px.type);
8585

tools/clang-format-precommit.sh

-7
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,3 @@ if [ -n "$FILES" ]; then
55
clang-format-6.0 -verbose -i $FILES
66
git add $FILES
77
fi
8-
9-
FILES=$(git diff --cached --name-only *.js '*.html')
10-
if [ -n "$FILES" ]; then
11-
# Change files, stage changes
12-
./node_modules/.bin/prettier --write $FILES
13-
git add $FILES
14-
fi

0 commit comments

Comments
 (0)