diff --git a/.github/workflows/superset-frontend.yml b/.github/workflows/superset-frontend.yml index f48a65bd2959d..a27ab6a0fd8cd 100644 --- a/.github/workflows/superset-frontend.yml +++ b/.github/workflows/superset-frontend.yml @@ -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' diff --git a/.github/workflows/superset-websocket.yml b/.github/workflows/superset-websocket.yml index 345aa4ddf92bb..e62e728cfad7f 100644 --- a/.github/workflows/superset-websocket.yml +++ b/.github/workflows/superset-websocket.yml @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index de40865edc7da..e95a766dc716b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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: diff --git a/docs/docs/contributing/hooks-and-linting.mdx b/docs/docs/contributing/hooks-and-linting.mdx index 509a12ac11127..68c9d28ca00b8 100644 --- a/docs/docs/contributing/hooks-and-linting.mdx +++ b/docs/docs/contributing/hooks-and-linting.mdx @@ -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: diff --git a/superset-frontend/js_build.sh b/superset-frontend/js_build.sh index f664ffd59b371..b140589da71ea 100755 --- a/superset-frontend/js_build.sh +++ b/superset-frontend/js_build.sh @@ -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 diff --git a/superset-frontend/package.json b/superset-frontend/package.json index 1eee0459791ba..7323a1d0a6562 100644 --- a/superset-frontend/package.json +++ b/superset-frontend/package.json @@ -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", diff --git a/superset-frontend/scripts/build.js b/superset-frontend/scripts/build.js index 0c327e8c50a3b..dcdce26b83683 100644 --- a/superset-frontend/scripts/build.js +++ b/superset-frontend/scripts/build.js @@ -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) {