Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 18
node-version-file: .tool-versions
cache: npm
cache-dependency-path: ${{ matrix.path }}/package-lock.json
- run: npm install --frozen-lockfile
Expand All @@ -49,7 +49,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 18
node-version-file: .tool-versions
cache: npm
cache-dependency-path: ${{ matrix.path }}/package-lock.json
- run: npm install --frozen-lockfile
Expand Down
File renamed without changes.
54 changes: 0 additions & 54 deletions pr-review/.eslintrc.yml

This file was deleted.

45 changes: 45 additions & 0 deletions pr-review/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import js from "@eslint/js"
import importPlugin from "eslint-plugin-import"
import sonarjs from "eslint-plugin-sonarjs"
import eslintPluginUnicorn from "eslint-plugin-unicorn"
import { defineConfig, globalIgnores } from "eslint/config"
import tseslint from "typescript-eslint"

// eslint-disable-next-line import/no-default-export
export default defineConfig([
globalIgnores(["dist/*"]),
{
files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
plugins: { js },
extends: ["js/recommended"],
languageOptions: {
parserOptions: {
projectService: { allowDefaultProject: ["eslint.config.js"] },
tsconfigRootDir: import.meta.dirname,
},
},
},
importPlugin.flatConfigs.recommended,
importPlugin.flatConfigs.typescript,
tseslint.configs.recommended,
tseslint.configs.recommendedTypeChecked,
tseslint.configs.stylisticTypeChecked,
sonarjs.configs.recommended,
eslintPluginUnicorn.configs.recommended,
Comment on lines +9 to +28

Choose a reason for hiding this comment

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

Your ESLint configuration for both pr-review and pr-summary is almost identical. To avoid duplication and ensure consistency, consider extracting the shared parts into a common module (e.g. eslint.common.config.js) and then spreading it:

// eslint.common.config.js
import js from "@eslint/js";
import importPlugin from "eslint-plugin-import";
import sonarjs from "eslint-plugin-sonarjs";
import unicorn from "eslint-plugin-unicorn";
import tsEslint from "@typescript-eslint/eslint-plugin/flat";
import { defineConfig, globalIgnores } from "eslint/config";

export const shared = [
  globalIgnores(["dist/*"]),
  {
    files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
    plugins: { js },
    extends: ["js/recommended"],
    languageOptions: {
      parserOptions: {
        projectService: { allowDefaultProject: ["eslint.config.js"] },
        tsconfigRootDir: import.meta.dirname,
      },
    },
  },
  importPlugin.flatConfigs.recommended,
  importPlugin.flatConfigs.typescript,
  tsEslint.configs.recommended,
  tsEslint.configs.recommendedTypeChecked,
  tsEslint.configs.stylisticTypeChecked,
  sonarjs.configs.recommended,
  unicorn.configs.recommended,
];

defineConfig([...shared, { rules: { /* overrides */ } }]);

Then in each project’s eslint.config.js, simply import and extend this shared array.

{
rules: {
"unicorn/no-array-for-each": "off",
"unicorn/prefer-string-replace-all": "off",
"unicorn/prevent-abbreviations": "off",
"no-plusplus": "off",
"no-param-reassign": ["error", { props: false }],
"unicorn/no-negated-condition": "off",
"@typescript-eslint/no-use-before-define": "off",
"import/extensions": "off",
"import/no-extraneous-dependencies": ["error", { devDependencies: true }],
"import/prefer-default-export": "off",
"import/no-default-export": "error",
"import/no-unresolved": "off",
},
},
])
Loading