chore: improve/decouple eslint and tsc 'npm run' commands (#26704)

This commit is contained in:
Maxime Beauchemin 2024-01-24 08:51:08 -08:00 committed by GitHub
parent 7c2093c495
commit 0f590799b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 30 additions and 11 deletions

View File

@ -39,11 +39,20 @@ jobs:
uses: ./.github/actions/cached-dependencies
with:
run: npm-install
- name: lint
- name: eslint
if: steps.check.outcome == 'failure'
working-directory: ./superset-frontend
run: |
npm run eslint -- . --quiet
- name: tsc
if: steps.check.outcome == 'failure'
working-directory: ./superset-frontend
run: |
npm run type
- name: prettier
if: steps.check.outcome == 'failure'
working-directory: ./superset-frontend
run: |
npm run lint -- --quiet
npm run prettier-check
- name: Build plugins packages
if: steps.check.outcome == 'failure'

View File

@ -21,9 +21,12 @@ jobs:
- name: Install dependencies
working-directory: ./superset-websocket
run: npm ci
- name: lint
- name: eslint
working-directory: ./superset-websocket
run: npm run lint
run: npm run eslint -- .
- name: typescript checks
working-directory: ./superset-websocket
run: npm run type
- name: prettier
working-directory: ./superset-websocket
run: npm run prettier-check

View File

@ -788,7 +788,10 @@ is configured as a pre-commit hook. There are also numerous [editor integrations
```bash
cd superset-frontend
npm ci
npm run lint
# run eslint checks
npm run eslint -- .
# run tsc (typescript) checks
npm run type
```
If using the eslint extension with vscode, put the following in your workspace `settings.json` file:

View File

@ -49,7 +49,10 @@ is configured as a pre-commit hook. There are also numerous [editor integrations
```bash
cd superset-frontend
npm ci
npm run lint
# run eslint checks
npm run eslint -- .
# run tsc (typescript) checks
npm run type
```
If using the eslint extension with vscode, put the following in your workspace `settings.json` file:

View File

@ -20,6 +20,7 @@ cd "$(dirname "$0")"
npm --version
node --version
time npm ci
time npm run lint
time npm run eslint -- .
time npm run check
time npm run cover # this also runs the tests, so no need to 'npm run test'
time npm run build

View File

@ -37,7 +37,6 @@
"src/setup/*"
],
"scripts": {
"_lint": "eslint --ignore-path=.eslintignore --ext .js,.jsx,.ts,tsx .",
"_prettier": "prettier './({src,spec,cypress-base,plugins,packages,.storybook}/**/*{.js,.jsx,.ts,.tsx,.css,.less,.scss,.sass}|package.json)'",
"build": "cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=production BABEL_ENV=\"${BABEL_ENV:=production}\" webpack --mode=production --color",
"build-dev": "cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=development webpack --mode=development --color",
@ -50,9 +49,10 @@
"cover": "cross-env NODE_ENV=test jest --coverage",
"dev": "webpack --mode=development --color --watch",
"dev-server": "cross-env NODE_ENV=development BABEL_ENV=development node --max_old_space_size=4096 ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --mode=development",
"eslint": "eslint --ignore-path=.eslintignore --ext .js,.jsx,.ts,tsx",
"format": "npm run _prettier -- --write",
"lint": "npm run _lint && npm run type",
"lint-fix": "npm run _lint -- --fix && npm run type",
"lint": "npm run eslint -- . && npm run type",
"lint-fix": "npm run eslint -- . --fix",
"plugins:build": "node ./scripts/build.js",
"plugins:build-assets": "node ./scripts/copyAssets.js",
"plugins:build-storybook": "cd packages/superset-ui-demo && npm run build-storybook",

View File

@ -106,7 +106,7 @@ function getPackages(packagePattern, tsOnly = false) {
let scope = getPackages(glob);
if (shouldLint) {
run(`npm run lint --fix {packages,plugins}/${scope}/{src,test}`);
run(`npm run eslint -- . --fix {packages,plugins}/${scope}/{src,test}`);
}
if (shouldCleanup) {