43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
// @ts-check
|
|
import { base as baseConfig } from "./base.mjs";
|
|
import { defineConfig } from "eslint/config";
|
|
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
import globals from "globals";
|
|
|
|
export { globals };
|
|
|
|
/**
|
|
* @param {string} tsconfigRootDir
|
|
* @param {Record<string, import("eslint").Linter.RuleEntry>} [overrides]
|
|
* @returns {ReturnType<import("eslint/config").defineConfig>}
|
|
*/
|
|
export function createNestjsConfig(tsconfigRootDir, overrides = {}) {
|
|
return defineConfig(
|
|
{ ignores: ["eslint.config.mjs"] },
|
|
...baseConfig,
|
|
eslintPluginPrettierRecommended,
|
|
{
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.node,
|
|
...globals.jest,
|
|
},
|
|
sourceType: "commonjs",
|
|
parserOptions: {
|
|
projectService: true,
|
|
tsconfigRootDir,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
rules: {
|
|
"class-methods-use-this": "off",
|
|
"@typescript-eslint/no-floating-promises": "warn",
|
|
// "@typescript-eslint/no-unsafe-argument": "warn",
|
|
"prettier/prettier": ["error", { endOfLine: "auto" }],
|
|
...overrides,
|
|
},
|
|
},
|
|
);
|
|
}
|