diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04a646d9d6e..1febe5632a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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' diff --git a/.prettierignore b/.prettierignore index 94cb5743869..019b7b87a0b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -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 diff --git a/lefthook.yml b/lefthook.yml index 65fe913ccaa..2e622162eeb 100644 --- a/lefthook.yml +++ b/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: diff --git a/lib/tasks/docker.rake b/lib/tasks/docker.rake index d4da7628591..cdcce4f3533 100644 --- a/lib/tasks/docker.rake +++ b/lib/tasks/docker.rake @@ -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"]