A platform for community discussion. Free, open, simple.
DEV: Update core lint commands to only affect bundled plugins (#29824)
David Taylora10dcffb731e
diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.ymlindex 36a945a8789..06709f26c0a 100644--- a/.github/workflows/linting.yml+++ b/.github/workflows/linting.yml@@ -63,14 +63,10 @@ jobs:set -Ebundle exec stree check Gemfile $(git ls-files '*.rb') $(git ls-files '*.rake') $(git ls-files '*.thor')- - name: ESLint (core)+ - name: ESLintif: ${{ !cancelled() }}run: pnpm lint:js- - name: ESLint (core plugins)- if: ${{ !cancelled() }}- run: pnpm lint:js-plugins-- name: Prettierif: ${{ !cancelled() }}run: |diff --git a/package.json b/package.jsonindex 1daedd5007a..a220a87affc 100644--- a/package.json+++ b/package.json@@ -43,14 +43,12 @@"dev": "concurrently \"bin/ember-cli server --environment=development\" \"RAILS_ENV=development bin/rails server\"","lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"","lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",- "lint:js": "eslint ./app/assets/javascripts --cache",- "lint:js-plugins": "eslint ./plugins --cache",- "lint:js:fix": "eslint --fix ./app/assets/javascripts",- "lint:js-plugins:fix": "eslint --fix ./plugins",- "lint:hbs": "ember-template-lint 'app/assets/javascripts/**/*.{gjs,hbs}' 'plugins/**/assets/javascripts/**/*.{gjs,hbs}' --no-error-on-unmatched-pattern",- "lint:hbs:fix": "ember-template-lint 'app/assets/javascripts/**/*.{gjs,hbs}' 'plugins/**/assets/javascripts/**/*.{gjs,hbs}' --no-error-on-unmatched-pattern --fix",- "lint:prettier": "pnpm pprettier --list-different 'app/assets/stylesheets/**/*.scss' 'app/assets/javascripts/**/*.{js,gjs,hbs}' 'plugins/**/assets/stylesheets/**/*.scss' 'plugins/**/assets/javascripts/**/*.{js,gjs,hbs}'",- "lint:prettier:fix": "pnpm prettier -w 'app/assets/stylesheets/**/*.scss' 'app/assets/javascripts/**/*.{js,gjs,hbs}' 'plugins/**/assets/stylesheets/**/*.scss' 'plugins/**/assets/javascripts/**/*.{js,gjs,hbs}'",+ "lint:js": "eslint ./app/assets/javascripts $(script/list_bundled_plugins) --cache --no-error-on-unmatched-pattern",+ "lint:js:fix": "eslint --fix ./app/assets/javascripts $(script/list_bundled_plugins) --no-error-on-unmatched-pattern",+ "lint:hbs": "ember-template-lint 'app/assets/javascripts/**/*.{gjs,hbs}' $(script/list_bundled_plugins '/assets/javascripts/**/*.{gjs,hbs}') --no-error-on-unmatched-pattern",+ "lint:hbs:fix": "ember-template-lint 'app/assets/javascripts/**/*.{gjs,hbs}' $(script/list_bundled_plugins '/assets/javascripts/**/*.{gjs,hbs}') --no-error-on-unmatched-pattern --fix",+ "lint:prettier": "pnpm pprettier --list-different 'app/assets/stylesheets/**/*.scss' 'app/assets/javascripts/**/*.{js,gjs,hbs}' $(script/list_bundled_plugins '/assets/stylesheets/**/*.scss') $(script/list_bundled_plugins '/assets/javascripts/**/*.{js,gjs,hbs}')",+ "lint:prettier:fix": "pnpm prettier -w 'app/assets/stylesheets/**/*.scss' 'app/assets/javascripts/**/*.{js,gjs,hbs}' $(script/list_bundled_plugins '/assets/stylesheets/**/*.scss') $(script/list_bundled_plugins '/assets/javascripts/**/*.{js,gjs,hbs}')","lttf:ignore": "lint-to-the-future ignore","lttf:output": "lint-to-the-future output -o ./lint-progress/","lint-progress": "pnpm lttf:output && npx html-pages ./lint-progress --no-cache",diff --git a/script/list_bundled_plugins b/script/list_bundled_pluginsnew file mode 100755index 00000000000..a129e18775e--- /dev/null+++ b/script/list_bundled_plugins@@ -0,0 +1,16 @@+#!/bin/bash++# This script lists all bundled plugins in the Discourse project.+# It accepts an optional suffix argument that will be appended to each plugin name.+#+# Usage:+# ./list_bundled_plugins [suffix]+#+# Arguments:+# suffix: An optional string to append to each plugin name.+#++set -e -u -o pipefail++suffix=${1:-}+git ls-tree --name-only -d HEAD plugins/* | sed "s|$|$suffix|"