@flizpay-de/eslint
Version:
Shared ESLint flat-config for FlizPay projects
35 lines (28 loc) • 1.41 kB
JavaScript
import base from "./base.js";
import { FlatCompat } from "@eslint/eslintrc";
const compat = new FlatCompat();
const backendOverlay = [
...compat.extends("plugin:n/recommended", "plugin:n/recommended-module"),
...compat.config({
plugins: ["n"],
env: { node: true, es2023: true },
settings: { node: { version: ">=18" } },
}),
{
rules: {
/* --- Node core hygiene --------------------------------- */
"n/no-missing-import": "error", // unresolved path or package
"n/no-process-exit": "error", // disallow `process.exit()` in app code
"n/no-missing-require": "off", // turn of this rule cause it clashes with our @... imports.
/* --- Callback conventions ------------------------------ */
"handle-callback-err": ["error", "^err(or)?$"], // callback's 1st arg error not handled
"callback-return": ["error", ["callback", "cb", "next"]], // code after invoking callback
/* --- Security-focused rules (from eslint-plugin-security) */
"security/detect-non-literal-require": "error", // variable-based `require()` path
"security/detect-non-literal-fs-filename": "error", // variable filename to `fs.*`
"security/detect-child-process": "error", // spawning child processes
"max-params": "off", // no max-params limit on backend
},
},
];
export default [...base, ...backendOverlay];