mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 05:05:15 +08:00
DEV: Update core lint commands to only affect bundled plugins (#29824)
Non-bundled plugins have their own linting configs/commands, and should not be linted by these package.json commands
This commit is contained in:
parent
7776773a11
commit
a10dcffb73
6
.github/workflows/linting.yml
vendored
6
.github/workflows/linting.yml
vendored
|
@ -63,14 +63,10 @@ jobs:
|
|||
set -E
|
||||
bundle exec stree check Gemfile $(git ls-files '*.rb') $(git ls-files '*.rake') $(git ls-files '*.thor')
|
||||
|
||||
- name: ESLint (core)
|
||||
- name: ESLint
|
||||
if: ${{ !cancelled() }}
|
||||
run: pnpm lint:js
|
||||
|
||||
- name: ESLint (core plugins)
|
||||
if: ${{ !cancelled() }}
|
||||
run: pnpm lint:js-plugins
|
||||
|
||||
- name: Prettier
|
||||
if: ${{ !cancelled() }}
|
||||
run: |
|
||||
|
|
14
package.json
14
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",
|
||||
|
|
16
script/list_bundled_plugins
Executable file
16
script/list_bundled_plugins
Executable file
|
@ -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|"
|
Loading…
Reference in New Issue
Block a user