35 lines
1.7 KiB
JavaScript
35 lines
1.7 KiB
JavaScript
/** Shared ESLint base for the NestJS services (`auth-service`, `api-gateway`
|
|
* today). Legacy `.eslintrc` format, not flat config — matches
|
|
* `apps/web/.eslintrc.json`'s ESLint 8 era rather than introducing a second
|
|
* config format into the repo.
|
|
*
|
|
* Consuming package.json needs its own `eslint`, `@typescript-eslint/parser`,
|
|
* `@typescript-eslint/eslint-plugin` devDependencies — pnpm's non-hoisted
|
|
* node_modules means a shared config can't lend its own plugin resolution to
|
|
* a package that doesn't declare the plugin itself.
|
|
*
|
|
* Referenced from each service's `.eslintrc.json` as a relative file path
|
|
* (`"extends": "../../packages/config/eslint-preset/index.js"`), not as
|
|
* `"@duoc-thu/config/eslint-preset"` — tried that first, and ESLint 8's
|
|
* legacy shareable-config resolution only auto-resolves package names
|
|
* shaped like `eslint-config-*` / `@scope/eslint-config[-*]`, not an
|
|
* arbitrary subpath of an arbitrarily-named package. Confirmed live: the
|
|
* package-name form failed with "couldn't find the config", the relative
|
|
* path did not. */
|
|
module.exports = {
|
|
root: true,
|
|
parser: "@typescript-eslint/parser",
|
|
plugins: ["@typescript-eslint"],
|
|
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
|
env: { node: true, jest: true },
|
|
parserOptions: { sourceType: "module", ecmaVersion: 2022 },
|
|
rules: {
|
|
// NestJS constructor-injection params are conventionally unused by name
|
|
// (e.g. `constructor(private readonly foo: Foo)`); flag genuinely unused
|
|
// locals/imports without flagging that idiom.
|
|
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
|
|
"@typescript-eslint/no-explicit-any": "warn",
|
|
},
|
|
ignorePatterns: ["dist", "node_modules"],
|
|
};
|