mistercrunch commented on code in PR #32596:
URL: https://github.com/apache/superset/pull/32596#discussion_r1991917493


##########
.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:
+          - [email protected]
+        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'

Review Comment:
   Yes, unless I'm missing something I think it's fair to assume that 
pre-commit tries and fix things. If I remember well there's something in the 
pre-commit GHA that checks if the code's been altered and fails if/when that's 
the case. I think the return code is negative regardless, but we're still 
checking to see if anything changed and fail if that's the case. Here: 
https://github.com/apache/superset/blob/master/.github/workflows/pre-commit.yml#L69-L72



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to