mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 12:57:29 +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 app/assets/javascripts test/javascripts
|
||||||
yarn eslint --global I18n --ext .es6 plugins
|
yarn eslint --global I18n --ext .es6 plugins
|
||||||
|
|
||||||
- name: Prettier
|
- name: Core Prettier
|
||||||
if: env.BUILD_TYPE == 'LINT'
|
if: env.BUILD_TYPE == 'LINT' && env.TARGET == 'CORE'
|
||||||
run: |
|
run: |
|
||||||
yarn prettier -v
|
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
|
- name: Core English locale
|
||||||
if: env.BUILD_TYPE == 'LINT' && env.TARGET == 'CORE'
|
if: env.BUILD_TYPE == 'LINT' && env.TARGET == 'CORE'
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
app/assets/stylesheets/vendor/
|
app/assets/stylesheets/vendor/
|
||||||
plugins/**/assets/stylesheets/vendor/
|
plugins/**/assets/stylesheets/vendor/
|
||||||
|
plugins/**/assets/javascripts/vendor/
|
||||||
package.json
|
package.json
|
||||||
config/locales/**/*.yml
|
config/locales/**/*.yml
|
||||||
!config/locales/**/*.en*.yml
|
!config/locales/**/*.en*.yml
|
||||||
|
|
13
lefthook.yml
13
lefthook.yml
|
@ -6,15 +6,15 @@ pre-commit:
|
||||||
run: bundle exec rubocop --parallel {staged_files}
|
run: bundle exec rubocop --parallel {staged_files}
|
||||||
prettier:
|
prettier:
|
||||||
glob: "*.{js,es6}"
|
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}
|
run: yarn prettier --list-different {staged_files}
|
||||||
eslint-es6:
|
eslint-es6:
|
||||||
glob: "*.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}
|
run: yarn eslint --ext .es6 -f compact {staged_files}
|
||||||
eslint-js:
|
eslint-js:
|
||||||
glob: "*.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}
|
run: yarn eslint -f compact {staged_files}
|
||||||
ember-template-lint:
|
ember-template-lint:
|
||||||
run: yarn run ember-template-lint {staged_files}
|
run: yarn run ember-template-lint {staged_files}
|
||||||
|
@ -52,14 +52,17 @@ lints:
|
||||||
rubocop:
|
rubocop:
|
||||||
run: bundle exec rubocop --parallel
|
run: bundle exec rubocop --parallel
|
||||||
prettier:
|
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}
|
run: yarn prettier --list-different {all_files}
|
||||||
eslint-assets-es6:
|
eslint-assets-es6:
|
||||||
run: yarn eslint --ext .es6 app/assets/javascripts
|
run: yarn eslint --ext .es6 app/assets/javascripts
|
||||||
eslint-assets-js:
|
eslint-assets-js:
|
||||||
run: yarn eslint app/assets/javascripts
|
run: yarn eslint app/assets/javascripts
|
||||||
eslint-test:
|
eslint-test-es6:
|
||||||
run: yarn eslint --ext .es6 test/javascripts
|
run: yarn eslint --ext .es6 test/javascripts
|
||||||
|
eslint-test-js:
|
||||||
|
run: yarn eslint test/javascripts
|
||||||
eslint-plugins-assets:
|
eslint-plugins-assets:
|
||||||
run: yarn eslint --global I18n --ext .es6 plugins/**/assets/javascripts
|
run: yarn eslint --global I18n --ext .es6 plugins/**/assets/javascripts
|
||||||
eslint-plugins-test:
|
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']}")
|
@good &&= run_or_fail("yarn eslint --global I18n --ext .es6 plugins/#{ENV['SINGLE_PLUGIN']}")
|
||||||
|
|
||||||
puts "Listing prettier offenses in #{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
|
else
|
||||||
@good &&= run_or_fail("bundle exec rake plugin:update_all") unless ENV["SKIP_PLUGINS"]
|
@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"]
|
@good &&= run_or_fail("bundle exec rubocop --parallel") unless ENV["SKIP_CORE"]
|
||||||
|
@ -85,12 +85,12 @@ task 'docker:test' do
|
||||||
|
|
||||||
unless ENV["SKIP_CORE"]
|
unless ENV["SKIP_CORE"]
|
||||||
puts "Listing prettier offenses in 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
|
end
|
||||||
|
|
||||||
unless ENV["SKIP_PLUGINS"]
|
unless ENV["SKIP_PLUGINS"]
|
||||||
puts "Listing prettier offenses in 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
|
||||||
end
|
end
|
||||||
puts "travis_fold:end:lint" if ENV["TRAVIS"]
|
puts "travis_fold:end:lint" if ENV["TRAVIS"]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user