discourse/lefthook.yml
Gerhard Schlager 2d143ec2fb
DEV: Improve lefthook config and remove some slow hooks (#16626)
They were slowing down checkout, merge and rewrite.
This also cleans up the "lints" section which was running into problems with `{all_files}` being too much for some tools to handle. And it makes sure that eslint and prettier runs for core plugins as well.
2022-05-04 17:37:01 +02:00

56 lines
1.7 KiB
YAML

skip_output:
- meta
- success
pre-commit:
parallel: true
commands:
rubocop:
glob: "*.rb"
run: bundle exec rubocop --parallel --force-exclusion {staged_files}
prettier:
glob: "*.js"
include: "app/assets/javascripts|plugins/.+?/assets/javascripts"
run: yarn pprettier --list-different {staged_files}
prettier-scss:
glob: "*.scss"
include: "app/assets/stylesheets|plugins/.+?/assets/stylesheets"
run: yarn pprettier --list-different {staged_files}
eslint:
glob: "*.js"
include: "app/assets/javascripts|plugins/.+?/assets/javascripts"
run: yarn eslint -f compact --quiet {staged_files}
ember-template-lint:
run: yarn run 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}
lints:
parallel: true
commands:
rubocop:
glob: "*.rb"
run: bundle exec rubocop --parallel
prettier:
run: yarn pprettier --list-different **/*.js
prettier-scss:
run: yarn pprettier --list-different **/*.scss
eslint:
run: yarn eslint -f compact --quiet --ext .js .
ember-template-lint:
run: yarn run ember-template-lint .
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}