# npm
npm i -D eslint @susisu/eslint-config
# yarn
yarn add -D eslint @susisu/eslint-config
# pnpm
pnpm add -D eslint @susisu/eslint-config
NOTE: Formatting rules are not enabled. I recommend using Prettier.
The package provides a factory function that configures all language settings and rules for each file type.
import { config } from "@susisu/eslint-config";
export default config({
tsconfigRootDir: import.meta.dirname,
});
export default config(
// Options
{
// Enable recommended rules. (default: true)
recommendedRules: true,
// Default sourceType for .js files. (default: "module")
jsSourceType: "module",
// Set languageOptions.parserOptions.projectService for TypeScript files. (default: true)
// If both `tsProjectService` and `tsProject` are enabled, only `tsProjectService` will have effect.
tsProjectService: true,
// Set languageOptions.parserOptions.project for TypeScript files. (default: false)
tsProject: false,
// Set languageOptions.parserOptions.tsconfigRootDir for TypeScript files. (default: undefined)
tsconfigRootDir: undefined,
// If true, mixes eslint-config-prettier to disable formatting rules. (default: true)
prettier: true,
},
// Custom configs
[
{
files: ["/path/to/file.js"],
// Configs in `extends` are expanded in the same way as tseslint.config() does.
// See https://typescript-eslint.io/packages/typescript-eslint#flat-config-extends
extends: [somePlugin.recommended],
rules: {
"no-console": "off",
},
},
],
);
);
config()
do?reportUnusedDisableDirectives
@typescript-eslint/*
)@stylistic/*
)@susisu/safe-typescript/*
)sourceType: "module"
for .js, .mjs, .ts, .tsx, .cts, .ctsx, .mts, .mtsxsourceType: "commonjs"
for .cjsSee the source code for more details.
error
: problems that should be fixed in most of the projects and contextswarn
: problems that might be fixed depending on the project or context, or just notifications (like highlighting TODO comments)