ESLint shareable configs for me!
[!IMPORTANT] This config uses new flat config style since v19.
$ npm i -D eslint eslint-config-teppeis
and run npx eslint-config-teppeis --init
to generate initial config files.
Load eslint-config-teppeis
and export default build()
in your eslint.config.js
:
import { build } from "eslint-config-teppeis";
import { mocha } from "eslint-config-teppeis/configs/mocha";
export default await build(
{ base: "node18", typescript: true, esm: true },
mocha,
{
ignores: ["dist", "test/fixtures"],
},
);
base
(enum, required): es2021
, es2022
, es2023
, node18
or node20
typescript
(boolean, default false): use TypeScriptproject
(boolean|string|srting[], default false): the property of parserOptions
to enable linting with type informationesm
(boolean, default false): treat .js
and .ts
as ESM for a project that configures type:module
in package.json
Configs for ECMAScript versions
import { es2021 } from "eslint-config-teppeis/configs/es2021";
export default [es2021];
es2021
es2022
es2023
Configs for Node versions
node18
(v18.18+ Maintenance)node20
(v20.9+ Active LTS)import { node18 } from "eslint-config-teppeis/configs/node18";
export default [node18];
Configs for TypeScript
typescript
: Enable rules that don't require type informationtypescriptTypeChecked
: Require type informationimport { node18, typescript } from "eslint-config-teppeis/configs";
export default [node18, typescript];
By default, only *.mjs
and *.mts
are treated as ES Modules in configs for Node.js.
If you use type:module
in package.json, use esm: true
like:
import { build } from "eslint-config-teppeis";
export default build({ base: "node18", esm: true });
This enables globals for browsers.
import { es2023, browser } from "eslint-config-teppeis/configs";
export default [es2023, browser];
This enables globals for Mocha like describe
or it
only in **/test/*.js
.
import { es2023, mocha } from "eslint-config-teppeis";
export default [es2023, mocha];
Just intall prettier
and use it with eslint-config-teppeis
.
These configs don't include rule settings that conflict with Pretteir.
Licensed under the MIT license. Copyright (c) 2023, Teppei Sato