Skip to content

Commit

Permalink
chore: add eslint to pre-commit hooks (#31845)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored Jan 14, 2025
1 parent ffb6913 commit 4bad1a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
- name: pre-commit
run: |
set +e # Don't exit immediately on failure
# Skip eslint as it requires `npm ci` and is executed in another job
export SKIP=eslint
pre-commit run --all-files
if [ $? -ne 0 ] || ! git diff --quiet --exit-code; then
echo "❌ Pre-commit check failed."
Expand Down
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ repos:
- id: trailing-whitespace
exclude: ^.*\.(snap)
args: ["--markdown-linebreak-ext=md"]
- repo: local
hooks:
- id: eslint
name: eslint
entry: bash -c 'cd superset-frontend && npm run eslint -- $(echo "$@" | sed "s|superset-frontend/||g")'
language: system
pass_filenames: true
files: \.(js|jsx|ts|tsx)$
- 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:
Expand Down

1 comment on commit 4bad1a2

@Vam-tech-star
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-commit configuration file

  • repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v5.0.0
    hooks:

    • id: check-docstring-first
    • id: check-added-large-files

      Excluding .geojson and .log files from this hook

      exclude: ^..(geojson|log)$|^docs/static/img/screenshots/.|^superset-frontend/CHANGELOG.md$
    • id: check-yaml
      exclude: ^helm/superset/templates/
    • id: debug-statements
    • id: end-of-file-fixer
      exclude: .*/lerna.json$
    • id: trailing-whitespace
      exclude: ^.*.(snap)
      args: ["--markdown-linebreak-ext=md"]
  • repo: local
    hooks:

    • id: eslint
      name: eslint
      entry: bash -c 'cd superset-frontend && npm run eslint -- $(echo "$@" | sed "s|superset-frontend/||g")'
      language: system
      pass_filenames: true
      files: .(js|jsx|ts|tsx)$
  • 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:](url)

Please sign in to comment.