diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 2db2e5dcd..000000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -.eslintrc.json \ No newline at end of file diff --git a/.gitignore b/.gitignore index 59be38e3f..c68ce16be 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ out/ node_modules/ .npmrc tests/test-project/coverage/ +.eslintcache diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..ed1b57f96 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,45 @@ +--- +ci: + # format compatible with commitlint + autoupdate_commit_msg: "chore: pre-commit autoupdate" + autoupdate_schedule: monthly + autofix_commit_msg: | + chore: auto fixes from pre-commit.com hooks + + for more information, see https://pre-commit.ci + skip: + - codecov + - depcheck + - eslint + - compare-devfile + - compare-devcontainer +minimum_pre_commit_version: 4.0.0 # Related to https://github.com/ekalinin/nodeenv/issues/369 +repos: + - repo: local + hooks: + - id: eslint + name: eslint + entry: npm + language: system + args: + - exec + - -- + - eslint + - --no-warn-ignored + - --color + - --format=gha + - --fix + - -v + - --cache + - --max-warnings + - "0" + pass_filenames: false + files: \.m?[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx + types: [file] + + - id: git-dirty + name: Check if git reports dirty + entry: git diff --exit-code + language: system + pass_filenames: false + always_run: true diff --git a/eslint.config.js b/eslint.config.js index bec574804..ed322c9c1 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -8,7 +8,7 @@ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' export default defineConfig([ { - ignores: ['**/*.test.js'], + ignores: ['**/*.test.js', '.eslintrc.json', '.eslintcache', './**/out', 'tests/test-project/resources'], }, eslintPluginPrettierRecommended, { diff --git a/package-lock.json b/package-lock.json index 8b7c92255..b792717a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,7 @@ "eslint": "^9.27.0", "eslint-config-prettier": "^10.1.5", "eslint-define-config": "^2.1.0", + "eslint-formatter-gha": "^1.5.2", "eslint-plugin-prettier": "^5.4.0", "lerna": "^8.2.2", "prettier": "3.5.3", @@ -5375,6 +5376,65 @@ "pnpm": ">=8.6.0" } }, + "node_modules/eslint-formatter-gha": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/eslint-formatter-gha/-/eslint-formatter-gha-1.5.2.tgz", + "integrity": "sha512-1TY8AYbrIP9DCcbydYW467nTP67eW79bT+oVKdUehO3WPMP8pn2oOZVkDc8yDcWf35+t2Li1elY5Dh6jTjJ3/Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-formatter-json": "^8.40.0", + "eslint-formatter-stylish": "^8.40.0" + } + }, + "node_modules/eslint-formatter-json": { + "version": "8.40.0", + "resolved": "https://registry.npmjs.org/eslint-formatter-json/-/eslint-formatter-json-8.40.0.tgz", + "integrity": "sha512-0bXo4At1EoEU23gFfN7wcDeqRXDHLJnvDOuQKD3Q6FkBlk7L2oVNPYg/sciIWdYrUnCBcKuMit3IWXkdSfzChg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint-formatter-stylish": { + "version": "8.40.0", + "resolved": "https://registry.npmjs.org/eslint-formatter-stylish/-/eslint-formatter-stylish-8.40.0.tgz", + "integrity": "sha512-blbD5ZSQnjNEUaG38VCO4WG9nfDQWE8/IOmt8DFRHXUIfZikaIXmsQTdWNFk0/e0j7RgIVRza86MpsJ+aHgFLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint-formatter-stylish/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint-formatter-stylish/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/eslint-plugin-prettier": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.4.0.tgz", diff --git a/package.json b/package.json index 9a4e86636..4bc4f586d 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "eslint": "^9.27.0", "eslint-config-prettier": "^10.1.5", "eslint-define-config": "^2.1.0", + "eslint-formatter-gha": "^1.5.2", "eslint-plugin-prettier": "^5.4.0", "lerna": "^8.2.2", "prettier": "3.5.3",