Files
strapi/nx.json
Andrei L b5452ab89f chore(eslint): migrate .eslintrc + .eslintignore to .eslintrc.cjs (#26216)
* chore(eslint): migrate .eslintrc + .eslintignore to .eslintrc.cjs

Consolidates the per-package ESLint setup into a single typed
`.eslintrc.cjs` file across the monorepo (177 files touched).

Why
- `.eslintignore` is removed in ESLint v9/v10. Folding ignore patterns
  into `ignorePatterns` inside the rc file is the supported migration
  path and unblocks future ESLint upgrades (which will likely be needed
  alongside the in-flight TypeScript 6 migration).
- `.cjs` extension is explicit about module format, so the configs keep
  working if any package later adopts `"type": "module"` (no CJS/ESM
  surprises).
- Wrapping each config in `// @ts-check` + a `Linter.Config`-typed
  `const config` block gives editor autocomplete and catches typos.
  Surfaced two real duplicates in
  `eslint-config-custom/back/typescript.js`
  (`node/no-unsupported-features/es-syntax`,
  `node/no-missing-import`), now deduplicated.
- `extends` references switched from the `custom/*` shorthand to the
  explicit `eslint-config-custom/*` package name. ESLint resolves both,
  but the explicit form makes the source unambiguous.
- Added `coverage/` to `ignorePatterns` so coverage output produced
  inside a workspace is not linted.

Misc
- `examples/kitchensink` had ESLint configured but no `lint` script;
  added one so the config actually runs.
- `nx.json` hash inputs updated:
  - removed `.eslintignore` (no longer exists)
  - replaced `{projectRoot}/.eslintrc.js` with
    `{projectRoot}/**/.eslintrc.cjs` so nested package configs are also
    part of the cache key (the previous glob missed them).
- `packages/utils/upgrade/tsconfig.eslint.json` include path updated
  from `.eslintrc.js` to `.eslintrc.cjs`.

Verification
- `eslint --print-config` resolves cleanly on sampled back/front
  packages (admin, users-permissions, upload).
- Full `pnpm -r lint` is clean.

* chore(eslint): set tsconfigRootDir for vscode-eslint typed linting

CLI lint resolved tsconfig paths via cwd, but vscode-eslint runs from
the workspace root and could not locate per-package tsconfigs. Set
parserOptions.tsconfigRootDir to __dirname in each package's
.eslintrc.cjs so the editor resolves typed-lint configs correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(eslint): self-ignore configs, scope coverage to jest packages

- Replace `env: { es6: true }` workaround with `.eslintrc.cjs` in
  ignorePatterns so eslint never lints the config file itself
  (root cause of the "const is not a keyword" parse error in es5)
- Add `.eslintrc.cjs` to ignorePatterns across all configs that
  were missing it
- Restrict `coverage/` ignorePatterns to workspace roots that
  actually run jest; drop from non-test packages and admin/server
  subdir configs (tests run from the workspace root)
2026-05-12 07:32:12 +00:00

116 lines
2.7 KiB
JSON

{
"namedInputs": {
"default": ["{projectRoot}/**/*"],
"production": [
"{workspaceRoot}/rollup.utils.mjs",
"!{projectRoot}/**/*.test.ts",
"!{projectRoot}/**/*.test.js",
"!{projectRoot}/**/*.test.api.js",
"!{projectRoot}/**/__mocks__/**",
"!{projectRoot}/**/__tests__/**",
"!{projectRoot}/**/*.md",
"!{projectRoot}/jest.config.js",
"!{projectRoot}/jest.config.front.js",
"!{projectRoot}/**/tsconfig.eslint.json",
"!{projectRoot}/**/.eslintrc.cjs"
]
},
"cli": {
"packageManager": "yarn"
},
"targetDefaults": {
"build": {
"inputs": ["default", "^production"],
"outputs": ["{projectRoot}/dist"],
"dependsOn": ["^build"],
"cache": true
},
"build:code": {
"inputs": ["default", "^production"],
"outputs": ["{projectRoot}/dist"],
"cache": true
},
"build:types": {
"inputs": ["default", "^production"],
"outputs": ["{projectRoot}/dist"],
"dependsOn": ["^build:types"],
"cache": true
},
"test:unit": {
"inputs": ["default", "{workspaceRoot}/jest-preset.unit.js"],
"cache": true
},
"test:front": {
"inputs": ["default", "{workspaceRoot}/jest-preset.front.js"],
"cache": true
},
"lint": {
"inputs": [
"{projectRoot}/**/*.js",
"{projectRoot}/**/*.ts",
"{projectRoot}/**/.eslintrc.cjs",
"{projectRoot}/**/tsconfig.eslint.json",
"{workspaceRoot}/packages/utils/eslint-config-custom/**/*"
],
"cache": true
}
},
"useInferencePlugins": false,
"parallel": 8,
"pluginsConfig": {
"@nx/js": {
"analyzeSourceFiles": false
}
},
"release": {
"projects": ["packages/**/*", ".github/actions/check-pr-status", "scripts/front"],
"changelog": {
"workspaceChangelog": {
"file": false,
"createRelease": "github"
}
},
"version": {
"conventionalCommits": false,
"git": {
"commitMessage": "release: {version}"
}
},
"conventionalCommits": {
"types": {
"docs": {
"changelog": {
"title": "📚 Documentation Changes"
}
},
"enhancement": {
"changelog": {
"title": "💅 Enhancement"
}
},
"feat": {
"changelog": {
"title": "🚀 New feature"
}
},
"fix": {
"changelog": {
"title": "🔥 Bug fix"
}
},
"security": {
"semverBump": "patch",
"changelog": {
"title": "🚨 Security"
}
},
"chore": {
"changelog": {
"title": "⚙️ Chore"
}
}
}
}
}
}