mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 06:28:57 +08:00
DEV: Ensure prettier uses the same patterns everywhere
This commit is contained in:
parent
0bd27cd10b
commit
208d85aaff
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
|
@ -146,11 +146,17 @@ jobs:
|
|||
yarn eslint app/assets/javascripts test/javascripts
|
||||
yarn eslint --global I18n --ext .es6 plugins
|
||||
|
||||
- name: Prettier
|
||||
if: env.BUILD_TYPE == 'LINT'
|
||||
- name: Core Prettier
|
||||
if: env.BUILD_TYPE == 'LINT' && env.TARGET == 'CORE'
|
||||
run: |
|
||||
yarn prettier -v
|
||||
yarn prettier --list-different "app/assets/stylesheets/**/*.scss" "app/assets/javascripts/**/*.js" "app/assets/javascripts/**/*.es6" "test/javascripts/**/*.es6" "plugins/**/*.scss" "plugins/**/*.es6"
|
||||
yarn prettier --list-different "app/assets/stylesheets/**/*.scss" "app/assets/javascripts/**/*.{js,es6}" "test/javascripts/**/*.{js,es6}"
|
||||
|
||||
- name: Plugin Prettier
|
||||
if: env.BUILD_TYPE == 'LINT' && env.TARGET == 'PLUGINS'
|
||||
run: |
|
||||
yarn prettier -v
|
||||
yarn prettier --list-different "plugins/**/assets/stylesheets/**/*.scss" "plugins/**/assets/javascripts/**/*.{js,es6}"
|
||||
|
||||
- name: Core English locale
|
||||
if: env.BUILD_TYPE == 'LINT' && env.TARGET == 'CORE'
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
app/assets/stylesheets/vendor/
|
||||
plugins/**/assets/stylesheets/vendor/
|
||||
plugins/**/assets/javascripts/vendor/
|
||||
package.json
|
||||
config/locales/**/*.yml
|
||||
!config/locales/**/*.en*.yml
|
||||
|
|
13
lefthook.yml
13
lefthook.yml
|
@ -6,15 +6,15 @@ pre-commit:
|
|||
run: bundle exec rubocop --parallel {staged_files}
|
||||
prettier:
|
||||
glob: "*.{js,es6}"
|
||||
exclude: "vendor/*|fixtures|public/javascripts|shims.js|ember-addons|template-lintrc|locale/*|test_helper|run-qunit"
|
||||
include: "app/assets/javascripts|test/javascripts"
|
||||
run: yarn prettier --list-different {staged_files}
|
||||
eslint-es6:
|
||||
glob: "*.es6"
|
||||
exclude: "vendor/*|fixtures|public/javascripts|shims.js|ember-addons|template-lintrc|locale/*|test_helper|run-qunit"
|
||||
include: "app/assets/javascripts|test/javascripts"
|
||||
run: yarn eslint --ext .es6 -f compact {staged_files}
|
||||
eslint-js:
|
||||
glob: "*.js"
|
||||
exclude: "vendor/*|fixtures|public/javascripts|shims.js|ember-addons|template-lintrc|locale/*|test_helper|run-qunit"
|
||||
include: "app/assets/javascripts|test/javascripts"
|
||||
run: yarn eslint -f compact {staged_files}
|
||||
ember-template-lint:
|
||||
run: yarn run ember-template-lint {staged_files}
|
||||
|
@ -52,14 +52,17 @@ lints:
|
|||
rubocop:
|
||||
run: bundle exec rubocop --parallel
|
||||
prettier:
|
||||
glob: "{app/assets/stylesheets/**/*.scss,app/assets/javascripts/**/*.es6,test/javascripts/**/*.es6}"
|
||||
glob: "*.{js,es6}"
|
||||
include: "app/assets/javascripts|test/javascripts"
|
||||
run: yarn prettier --list-different {all_files}
|
||||
eslint-assets-es6:
|
||||
run: yarn eslint --ext .es6 app/assets/javascripts
|
||||
eslint-assets-js:
|
||||
run: yarn eslint app/assets/javascripts
|
||||
eslint-test:
|
||||
eslint-test-es6:
|
||||
run: yarn eslint --ext .es6 test/javascripts
|
||||
eslint-test-js:
|
||||
run: yarn eslint test/javascripts
|
||||
eslint-plugins-assets:
|
||||
run: yarn eslint --global I18n --ext .es6 plugins/**/assets/javascripts
|
||||
eslint-plugins-test:
|
||||
|
|
|
@ -71,7 +71,7 @@ task 'docker:test' do
|
|||
@good &&= run_or_fail("yarn eslint --global I18n --ext .es6 plugins/#{ENV['SINGLE_PLUGIN']}")
|
||||
|
||||
puts "Listing prettier offenses in #{ENV['SINGLE_PLUGIN']}:"
|
||||
@good &&= run_or_fail_prettier("plugins/#{ENV['SINGLE_PLUGIN']}/**/*.scss", "plugins/#{ENV['SINGLE_PLUGIN']}/**/*.es6")
|
||||
@good &&= run_or_fail_prettier("plugins/#{ENV['SINGLE_PLUGIN']}/**/*.scss", "plugins/#{ENV['SINGLE_PLUGIN']}/**/*.{js,es6}")
|
||||
else
|
||||
@good &&= run_or_fail("bundle exec rake plugin:update_all") unless ENV["SKIP_PLUGINS"]
|
||||
@good &&= run_or_fail("bundle exec rubocop --parallel") unless ENV["SKIP_CORE"]
|
||||
|
@ -85,12 +85,12 @@ task 'docker:test' do
|
|||
|
||||
unless ENV["SKIP_CORE"]
|
||||
puts "Listing prettier offenses in core:"
|
||||
@good &&= run_or_fail('yarn prettier --list-different "app/assets/stylesheets/**/*.scss" "app/assets/javascripts/**/*.es6" "test/javascripts/**/*.es6"')
|
||||
@good &&= run_or_fail('yarn prettier --list-different "app/assets/stylesheets/**/*.scss" "app/assets/javascripts/**/*.{js,es6}" "test/javascripts/**/*.{js,es6}"')
|
||||
end
|
||||
|
||||
unless ENV["SKIP_PLUGINS"]
|
||||
puts "Listing prettier offenses in plugins:"
|
||||
@good &&= run_or_fail('yarn prettier --list-different "plugins/**/*.scss" "plugins/**/*.es6"')
|
||||
@good &&= run_or_fail('yarn prettier --list-different "plugins/**/assets/stylesheets/**/*.scss" "plugins/**/assets/javascripts/**/*.{js,es6}"')
|
||||
end
|
||||
end
|
||||
puts "travis_fold:end:lint" if ENV["TRAVIS"]
|
||||
|
|
Loading…
Reference in New Issue
Block a user