mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Up to now `eslint-plugin-brace-rules` was used to enforce a common brace style for JavaScript code. This plugin was however updated the last time over 9 years ago and will be incompatible with ESLint v10, as that [removes `context.getSourceCode()`][1], the plugin relies on. To keep the eslint config working with ESLint v10, this replaces `eslint-plugin-brace-rules` with the [`@stylistic/brace-style`][2] rule from `@stylistic/eslint-plugin`, a package we already use. While `@stylistic/brace-style` doesn't offer an option to format braces in exactly the same way as before, the "allman" style seems to be the one closest to the existing code. [1]: https://eslint.org/blog/2025/11/eslint-v10.0.0-alpha.0-released/#removed-deprecated-rule-context-members [2]: https://eslint.style/rules/brace-style
94 lines
2.7 KiB
YAML
94 lines
2.7 KiB
YAML
---
|
|
repos:
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: v6.0.0
|
|
hooks:
|
|
- id: check-added-large-files
|
|
args:
|
|
- --maxkb=1024
|
|
- --enforce-all
|
|
exclude: (^binaries/data/mods/public/maps/.*\.xml$)
|
|
- id: check-case-conflict
|
|
- id: check-executables-have-shebangs
|
|
- id: check-json
|
|
- id: check-merge-conflict
|
|
- id: check-shebang-scripts-are-executable
|
|
- id: check-symlinks
|
|
- id: check-toml
|
|
- id: check-xml
|
|
exclude: |
|
|
(?x)(
|
|
^binaries/data/mods/_test.xero/a/b/test1.xml|
|
|
^binaries/data/mods/_test.xero/test1.xml|
|
|
^binaries/data/mods/_test.sim/simulation/templates.illformed.xml|
|
|
^binaries/data/mods/public/maps/.*\.xml
|
|
)
|
|
- id: trailing-whitespace
|
|
exclude: |
|
|
(?x)(
|
|
^libraries/|
|
|
^source/third_party/glad/src|
|
|
^source/tools/replayprofile/jquery|
|
|
^source/tools/templatesanalyzer/tablefilter|
|
|
\.dae|
|
|
\.patch$
|
|
)
|
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
rev: v0.12.9
|
|
hooks:
|
|
- id: ruff-check
|
|
args:
|
|
- --output-format=full
|
|
exclude: ^source/tools/webservices/
|
|
- id: ruff-format
|
|
args:
|
|
- --diff
|
|
exclude: ^source/tools/webservices/
|
|
- repo: local
|
|
hooks:
|
|
- id: non-breaking-space-in-0ad
|
|
name: check for non-breaking space in "0 A.D."
|
|
description: |
|
|
Verify a non-breaking spaces is used in the project name ("0 A.D").
|
|
entry: '0(?!(\xc2\xa0|\\xa0)A\.D\.)\s?(?<!\\xa0)(A|a)\.(D|d)\.?'
|
|
language: pygrep
|
|
types: [text]
|
|
files: ^binaries/
|
|
exclude: (^binaries/data/mods/(mod|public)/art/.*\.xml|\.dae$)
|
|
- repo: https://github.com/scop/pre-commit-shfmt
|
|
rev: v3.12.0-2
|
|
hooks:
|
|
- id: shfmt
|
|
args:
|
|
- --diff
|
|
stages: [pre-commit]
|
|
- repo: https://github.com/shellcheck-py/shellcheck-py
|
|
rev: v0.11.0.1
|
|
hooks:
|
|
- id: shellcheck
|
|
- repo: https://github.com/igorshubovych/markdownlint-cli
|
|
rev: v0.45.0
|
|
hooks:
|
|
- id: markdownlint
|
|
language_version: 22.14.0
|
|
exclude: |
|
|
(?x)(
|
|
^.gitea/ISSUE_TEMPLATE/|
|
|
^source/third_party/
|
|
)
|
|
- repo: https://github.com/adrienverge/yamllint
|
|
rev: v1.37.1
|
|
hooks:
|
|
- id: yamllint
|
|
args:
|
|
- --strict
|
|
- repo: https://github.com/eslint/eslint
|
|
rev: v9.39.2
|
|
hooks:
|
|
- id: eslint
|
|
language_version: 22.14.0
|
|
additional_dependencies:
|
|
- "@stylistic/eslint-plugin@5.6.1"
|
|
args:
|
|
- --max-warnings=0
|
|
- --no-warn-ignored
|