Skip to content

Commit 5163301

Browse files
committed
chore: run eslint as pre-commit.ci hook
- pre-commit.ci hook config (can use GHA app or local) - enable eslint GHA output support that produce GHA annotations - upgraded unsupported .eslintignore file
1 parent 32a0124 commit 5163301

File tree

5 files changed

+48
-2
lines changed

5 files changed

+48
-2
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ out/
22
node_modules/
33
.npmrc
44
tests/test-project/coverage/
5+
.eslintcache

.pre-commit-config.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
ci:
3+
# format compatible with commitlint
4+
autoupdate_commit_msg: "chore: pre-commit autoupdate"
5+
autoupdate_schedule: monthly
6+
autofix_commit_msg: |
7+
chore: auto fixes from pre-commit.com hooks
8+
9+
for more information, see https://pre-commit.ci
10+
skip:
11+
- codecov
12+
- depcheck
13+
- eslint
14+
- compare-devfile
15+
- compare-devcontainer
16+
minimum_pre_commit_version: 4.0.0 # Related to https://github.com/ekalinin/nodeenv/issues/369
17+
repos:
18+
- repo: local
19+
hooks:
20+
- id: eslint
21+
name: eslint
22+
entry: npm
23+
language: system
24+
args:
25+
- exec
26+
- --
27+
- eslint
28+
- --no-warn-ignored
29+
- --color
30+
- --format=gha
31+
- --fix
32+
- -v
33+
- --cache
34+
- --max-warnings
35+
- "0"
36+
pass_filenames: false
37+
files: \.m?[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
38+
types: [file]
39+
40+
- id: git-dirty
41+
name: Check if git reports dirty
42+
entry: git diff --exit-code
43+
language: system
44+
pass_filenames: false
45+
always_run: true

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
88

99
export default defineConfig([
1010
{
11-
ignores: ['**/*.test.js'],
11+
ignores: ['**/*.test.js', '.eslintrc.json', '.eslintcache', './**/out', 'tests/test-project/resources'],
1212
},
1313
eslintPluginPrettierRecommended,
1414
{

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"eslint": "^9.27.0",
3939
"eslint-config-prettier": "^10.1.5",
4040
"eslint-define-config": "^2.1.0",
41+
"eslint-formatter-gha": "^1.5.2",
4142
"eslint-plugin-prettier": "^5.4.0",
4243
"lerna": "^8.2.2",
4344
"prettier": "3.5.3",

0 commit comments

Comments
 (0)