mirror of
https://github.com/discourse/discourse.git
synced 2025-10-03 17:21:20 +08:00
- Align lefthook linting with linting CI does - Call lefthook from bin/lint to handle linting (centralizes implementation)
91 lines
2.7 KiB
YAML
91 lines
2.7 KiB
YAML
skip_output:
|
|
- meta
|
|
- success
|
|
|
|
pre-commit:
|
|
parallel: true
|
|
skip:
|
|
- merge
|
|
- rebase
|
|
commands:
|
|
rubocop:
|
|
glob: "*.{rb,rake,thor}"
|
|
run: bundle exec rubocop --force-exclusion {staged_files}
|
|
syntax_tree:
|
|
glob: "*.{rb,rake,thor}"
|
|
run: bundle exec stree check Gemfile {staged_files}
|
|
prettier:
|
|
glob: "*.{js,gjs,hbs,scss,css,cjs,mjs}"
|
|
include: "app/assets|plugins/.+?/assets|themes"
|
|
run: pnpm pprettier --list-different {staged_files}
|
|
eslint:
|
|
glob: "*.{js,gjs}"
|
|
include: "app/assets/javascripts|plugins/.+?/assets/javascripts"
|
|
run: pnpm eslint --quiet {staged_files}
|
|
ember-template-lint:
|
|
glob: "*.{hbs,gjs}"
|
|
include: "app/assets/javascripts|plugins/.+?/assets/javascripts"
|
|
run: pnpm ember-template-lint {staged_files}
|
|
yaml-syntax:
|
|
glob: "*.{yaml,yml}"
|
|
# database.yml is an erb file not a yaml file
|
|
exclude: "database.yml"
|
|
run: bundle exec yaml-lint {staged_files}
|
|
i18n-lint:
|
|
glob: "**/{client,server}.en.yml"
|
|
run: bundle exec ruby script/i18n_lint.rb {staged_files}
|
|
stylelint:
|
|
glob: "*.scss"
|
|
include: "app/assets/stylesheets|plugins/.+?/assets/stylesheets|themes"
|
|
run: pnpm stylelint {staged_files}
|
|
|
|
fix-staged:
|
|
parallel: false
|
|
commands:
|
|
prettier:
|
|
glob: "*.{js,gjs,hbs,scss,css,cjs,mjs}"
|
|
include: "app/assets|plugins/.+?/assets|themes"
|
|
run: pnpm pprettier --write {staged_files}
|
|
eslint:
|
|
glob: "*.{js,gjs}"
|
|
include: "app/assets/javascripts|plugins/.+?/assets/javascripts|themes"
|
|
run: pnpm eslint --fix {staged_files}
|
|
ember-template-lint:
|
|
glob: "*.{gjs,hbs}"
|
|
include: "app/assets/javascripts|plugins/.+?/assets/javascripts|themes"
|
|
run: pnpm ember-template-lint --fix {staged_files}
|
|
stylelint:
|
|
glob: "*.scss"
|
|
include: "app/assets/stylesheets|plugins/.+?/assets/stylesheets|themes"
|
|
run: pnpm stylelint --fix {staged_files}
|
|
rubocop:
|
|
glob: "*.{rb,rake,thor}"
|
|
run: bundle exec rubocop --force-exclusion -A {staged_files}
|
|
syntax_tree:
|
|
glob: "*.{rb,rake,thor}"
|
|
run: bundle exec stree write Gemfile {staged_files}
|
|
|
|
lints:
|
|
parallel: true
|
|
commands:
|
|
rubocop:
|
|
glob: "*.rb"
|
|
run: bundle exec rubocop
|
|
prettier:
|
|
run: pnpm lint:prettier
|
|
eslint:
|
|
run: pnpm lint:js
|
|
ember-template-lint:
|
|
run: pnpm lint:hbs
|
|
stylelint:
|
|
run: pnpm lint:css
|
|
yaml-syntax:
|
|
glob: "*.{yaml,yml}"
|
|
# database.yml is an erb file not a yaml file
|
|
exclude: "database.yml"
|
|
run: bundle exec yaml-lint {all_files}
|
|
i18n-lint:
|
|
glob: "**/{client,server}.en.yml"
|
|
run: bundle exec ruby script/i18n_lint.rb {all_files}
|
|
glint:
|
|
run: pnpm glint -p jsconfig.json --noEmit
|