You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2025/03/11 17:35:12 UTC

(superset) branch fix_eslint_precommit created (now 320b9089ba)

This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a change to branch fix_eslint_precommit
in repository https://gitbox.apache.org/repos/asf/superset.git


      at 320b9089ba chore: fix precommit for eslint

This branch includes the following new commits:

     new 320b9089ba chore: fix precommit for eslint

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(superset) 01/01: chore: fix precommit for eslint

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch fix_eslint_precommit
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 320b9089badcd78c636f12e5e03618bc47164a70
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Tue Mar 11 09:59:42 2025 -0700

    chore: fix precommit for eslint
---
 .github/workflows/pre-commit.yml |  3 +-
 .pre-commit-config.yaml          | 59 ++++++++++++++++++----------------------
 2 files changed, 28 insertions(+), 34 deletions(-)

diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index 3f3492e80c..b65401ce7c 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -56,8 +56,7 @@ jobs:
       - name: pre-commit
         run: |
           set +e  # Don't exit immediately on failure
-          # Skip auto-fixing in CI to ensure changes are committed locally
-          export SKIP_FIX=1
+          export SKIP=eslint-frontend,type-checking-frontend
           pre-commit run --all-files
           PRE_COMMIT_EXIT_CODE=$?
           git diff --quiet --exit-code
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index dad54d471f..0753ea77e6 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -52,40 +52,35 @@ repos:
       - id: trailing-whitespace
         exclude: ^.*\.(snap)
         args: ["--markdown-linebreak-ext=md"]
-  - repo: local
+  - repo: https://github.com/pre-commit/mirrors-prettier
+    rev: v4.0.0-alpha.8 # Use the sha or tag you want to point at
     hooks:
       - id: prettier
-        name: prettier
-        entry: bash -c 'cd superset-frontend && if [ -z "$SKIP_FIX" ]; then npm run format -- --log-level error; else npm run prettier-check; fi'
-        language: system
-        files: '^superset-frontend/(src|spec|cypress-base|plugins|packages|.storybook)/.+\.(js|jsx|ts|tsx|css|less|scss|sass)$|^superset-frontend/package\.json$'
-        pass_filenames: true
-      - id: eslint-frontend
-        name: eslint (frontend)
-        entry: bash -c 'cd superset-frontend && if [ -z "$SKIP_FIX" ]; then npm run lint-fix; else npm run eslint; fi'
-        language: system
-        pass_filenames: true
-        files: ^superset-frontend/.*\.(js|jsx|ts|tsx)$
-# TODO - re-assess using this script-based linting rather than the npm command. Both approaches have their merits
-#       - id: eslint
-#         name: eslint
-#         entry: ./scripts/eslint.sh
-#         language: script
-#         pass_filenames: true
-#         files: ^superset-frontend\/.*\.(js|jsx|ts|tsx)$
-      - id: eslint-docs
-        name: eslint (docs)
-        entry: bash -c 'cd docs && FILES=$(echo "$@" | sed "s|docs/||g") && yarn eslint --ext .js,.jsx,.ts,.tsx --quiet $([ -z "$SKIP_FIX" ] && echo "--fix") $FILES'
-        language: system
-        pass_filenames: true
-        files: ^docs/.*\.(js|jsx|ts|tsx)$
-      - id: type-checking-frontend
-        name: Type-Checking (Frontend)
-        entry: bash -c './scripts/check-type.js package=superset-frontend excludeDeclarationDir=cypress-base'
-        language: system
-        files: ^superset-frontend\/.*\.(js|jsx|ts|tsx)$
-        exclude: ^superset-frontend/cypress-base\/
-        require_serial: true
+        additional_dependencies:
+          - prettier@3.3.3
+        args: ["--ignore-path=./superset-frontend/.prettierignore"]
+        files: "superset-frontend"
+  - repo: local
+    hooks:
+    - id: eslint-frontend
+      name: eslint (frontend)
+      entry: ./scripts/eslint.sh
+      language: system
+      pass_filenames: true
+      files: ^superset-frontend/.*\.(js|jsx|ts|tsx)$
+    - id: eslint-docs
+      name: eslint (docs)
+      entry: bash -c 'cd docs && FILES=$(echo "$@" | sed "s|docs/||g") && yarn eslint --ext .js,.jsx,.ts,.tsx --quiet $([ -z "$SKIP_FIX" ] && echo "--fix") $FILES'
+      language: system
+      pass_filenames: true
+      files: ^docs/.*\.(js|jsx|ts|tsx)$
+    - id: type-checking-frontend
+      name: Type-Checking (Frontend)
+      entry: bash -c './scripts/check-type.js package=superset-frontend excludeDeclarationDir=cypress-base'
+      language: system
+      files: ^superset-frontend\/.*\.(js|jsx|ts|tsx)$
+      exclude: ^superset-frontend/cypress-base\/
+      require_serial: true
   # blacklist unsafe functions like make_url (see #19526)
   - repo: https://github.com/skorokithakis/blacklist-pre-commit-hook
     rev: e2f070289d8eddcaec0b580d3bde29437e7c8221