diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index 299cb60..aa63b96 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -48,8 +48,13 @@ jobs: - name: 🗄 Cache .eslintcache uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # main with: - path: .eslintcache - key: eslintcache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} + path: "**/.eslintcache" + # Unique key per commit so the cache is refreshed when code changes, + # while restore-keys reuses the most recent previous cache as a base. + key: eslintcache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-${{ github.sha }} + restore-keys: | + eslintcache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}- + eslintcache-${{ runner.os }}- - name: 🔍 Install dependencies if: steps.cache-node_modules.outputs.cache-hit != 'true' diff --git a/.gitignore b/.gitignore index 1f0150c..cc8cb9c 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,7 @@ build/Release node_modules # Generated by TypeScript -dist \ No newline at end of file +dist + +# ESLint cache +.eslintcache \ No newline at end of file diff --git a/package.json b/package.json index 5a83ecb..7a6d664 100644 --- a/package.json +++ b/package.json @@ -66,17 +66,17 @@ "release": "semantic-release", "test": "run-p test:* test:presets:* test:rules:* test:styles:*", "test:format": "prettier --check .", - "test:lint": "eslint --max-warnings 0 .", + "test:lint": "eslint --cache --max-warnings 0 .", "test:publishable": "node ./semantic-release/verify-publishable.js", - "test:presets:javascript": "cd eslint/presets/javascript.test; eslint --max-warnings 0 .", - "test:presets:typescript": "cd eslint/presets/typescript.test; eslint --max-warnings 0 .", - "test:presets:typescript-react": "cd eslint/presets/typescript-react.test; eslint --max-warnings 0 .", - "test:rules:vitest": "cd eslint/rules/vitest.test; eslint --max-warnings 0 .", - "test:styles:jsx-no-literals": "cd eslint/styles/jsx-no-literals.test; eslint --max-warnings 0 .", - "test:styles:no-default-export": "cd eslint/styles/no-default-export.test; eslint --max-warnings 0 .", - "test:styles:no-null": "cd eslint/styles/no-null.test; eslint --max-warnings 0 .", - "test:styles:prefer-array-shorthand": "cd eslint/styles/prefer-array-shorthand.test; eslint --max-warnings 0 .", - "test:styles:prefer-interface": "cd eslint/styles/prefer-interface.test; eslint --max-warnings 0 .", + "test:presets:javascript": "cd eslint/presets/javascript.test; eslint --cache --max-warnings 0 .", + "test:presets:typescript": "cd eslint/presets/typescript.test; eslint --cache --max-warnings 0 .", + "test:presets:typescript-react": "cd eslint/presets/typescript-react.test; eslint --cache --max-warnings 0 .", + "test:rules:vitest": "cd eslint/rules/vitest.test; eslint --cache --max-warnings 0 .", + "test:styles:jsx-no-literals": "cd eslint/styles/jsx-no-literals.test; eslint --cache --max-warnings 0 .", + "test:styles:no-default-export": "cd eslint/styles/no-default-export.test; eslint --cache --max-warnings 0 .", + "test:styles:no-null": "cd eslint/styles/no-null.test; eslint --cache --max-warnings 0 .", + "test:styles:prefer-array-shorthand": "cd eslint/styles/prefer-array-shorthand.test; eslint --cache --max-warnings 0 .", + "test:styles:prefer-interface": "cd eslint/styles/prefer-interface.test; eslint --cache --max-warnings 0 .", "test:types": "tsc --noEmit" }, "dependencies": {