Skip to content

Commit 631667a

Browse files
authored
Fix up pre-commit config to be useful, add djhtml (#217)
* Fix up pre-commit config to be useful This ports some of the changes from the addons/etc repo here to match: - Check assets are current using a script - Run prettier via pre-commit - Run black via pre-commit - Run djhtml linter on templates to correct spacing - Drops common submodule for now * Whitespace corrections * Prettier formatting * Run djhtml on all template files to correct spacing
1 parent 226aa48 commit 631667a

File tree

108 files changed

+2855
-2817
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+2855
-2817
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "common"]
2-
path = common
3-
url = https://github.com/readthedocs/common

.pre-commit-config-local.yaml

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

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.pre-commit-config.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/mirrors-prettier
3+
rev: "v3.0.3"
4+
hooks:
5+
- id: prettier
6+
args: ["--write", "."]
7+
types_or: [css, javascript, json]
8+
9+
- repo: https://github.com/ambv/black
10+
rev: "23.9.1"
11+
hooks:
12+
- id: black
13+
language_version: python3
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v4.4.0
16+
hooks:
17+
- id: trailing-whitespace
18+
- id: check-added-large-files
19+
- id: check-case-conflict
20+
- id: check-executables-have-shebangs
21+
- id: check-merge-conflict
22+
- id: check-shebang-scripts-are-executable
23+
- id: check-symlinks
24+
- id: check-vcs-permalinks
25+
- id: check-yaml
26+
- id: destroyed-symlinks
27+
- id: end-of-file-fixer
28+
exclude: "^dist/.*$"
29+
- repo: https://github.com/rtts/djhtml
30+
rev: "3.0.6"
31+
hooks:
32+
- id: djhtml
33+
files: '^readthedocsext/theme/templates/.*\.html'
34+
- repo: local
35+
hooks:
36+
- id: check-build-assets
37+
name: Ensure compiled assets are current
38+
description: Ensure that `npm run build` was run before commiting.
39+
language: script
40+
types_or: [css, javascript, svg, json]
41+
entry: .pre-commit/check-build-assets.sh

.pre-commit/check-build-assets.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
npm run build
4+
5+
if [[ `git diff readthedocsext/` ]]
6+
then
7+
echo "ERROR: assets are out of date. Make sure to run 'npm run build' on your branch."
8+
exit 1
9+
fi

common

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/api/js/views.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Base
1010
.. js:autoclass:: ResponsiveView
1111
:members:
1212

13-
.. js:autoclass:: HeaderView
13+
.. js:autoclass:: HeaderView
1414
:members:
1515

1616
.. js:autoclass:: CollapsingHeaderView

docs/stylesheets.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ How do I use icons?
9999
.. [1] https://fomantic-ui.com/elements/segment.html#padded
100100
.. [2] https://fomantic-ui.com/elements/segment.html#fitted
101101
.. [3] https://fomantic-ui.com/elements/segment.html#basic
102-
.. [4] https://fomantic-ui.com/collections/grid.html
102+
.. [4] https://fomantic-ui.com/collections/grid.html
103103
104104
105105
Working with CSS

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"matchdep": "~1.0.1",
5050
"mini-css-extract-plugin": "^0.6.0",
5151
"optimize-css-assets-webpack-plugin": "^5.0.3",
52-
"prettier": "^2.0.5",
52+
"prettier": "^3.0.3",
5353
"resolve-url-loader": "^2.2.1",
5454
"rollup-plugin-lit-css": "^4.0.1",
5555
"sanitize-html": "^1.23.0",

0 commit comments

Comments
 (0)