discourse/lefthook.yml
Martin Brennan df6003aef5
DEV: Lint SCSS with prettier in pre-commit (#15033)
We are linting SCSS on the GitHub actions CI but not
on pre-commit, which can lead to lint failures in CI.
Better to warn developers about this locally like
our other lints.
2021-11-22 11:30:12 +10:00

73 lines
2.0 KiB
YAML

pre-commit:
parallel: true
commands:
rubocop:
glob: "*.rb"
run: bundle exec rubocop --parallel {staged_files}
prettier:
glob: "*.js"
include: "app/assets/javascripts|test/javascripts"
run: yarn pprettier --list-different {staged_files}
prettier-scss:
glob: "*.scss"
include: "app/assets/stylesheets"
run: yarn pprettier --list-different {staged_files}
eslint:
glob: "*.js"
include: "app/assets/javascripts|test/javascripts"
run: yarn eslint -f compact {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}
commands: &commands
bundle-install:
files: git diff --name-only HEAD main
glob: "{Gemfile,Gemfile.lock,*.gemspec}"
run: bundle install
yarn-install:
files: git diff --name-only HEAD main
glob: "{package.json,yarn.lock}"
run: yarn install
post-checkout:
commands: *commands
post-merge:
commands: *commands
post-rewrite:
commands: *commands
lints:
parallel: true
commands:
rubocop:
run: bundle exec rubocop --parallel
prettier:
glob: "*.js"
include: "app/assets/javascripts|test/javascripts"
run: yarn pprettier --list-different {all_files}
prettier-scss:
glob: "*.scss"
include: "app/assets/stylesheets"
run: yarn pprettier --list-different {all_files}
eslint-assets-js:
run: yarn eslint app/assets/javascripts
eslint-test-js:
run: yarn eslint test/javascripts
eslint-plugins-assets:
run: yarn eslint plugins/**/assets/javascripts
eslint-plugins-test:
run: yarn eslint plugins/**/test/javascripts
i18n-lint:
glob: "**/{client,server}.en.yml"
run: bundle exec ruby script/i18n_lint.rb {all_files}