teppeis / eslint-config-teppeis

ESLint shareable config for me!
https://npm.im/eslint-config-teppeis
MIT License
43 stars 4 forks source link
closure eslint javascript prettier typescript

eslint-config-teppeis

ESLint shareable configs for me!

npm version supported node.js version build status license

[!IMPORTANT] This config uses new flat config style since v19.

Priority

  1. Avoid "Possible Problems"
  2. Enable "Suggestions" if reasonable or fixable
  3. Use Prettier for stylistic formatting issues

Install

$ npm i -D eslint eslint-config-teppeis

and run npx eslint-config-teppeis --init to generate initial config files.

Usage

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"],
  },
);

Options

Configs for customization

Pure ECMAScript

Configs for ECMAScript versions

import { es2021 } from "eslint-config-teppeis/configs/es2021";

export default [es2021];

Node.js

Configs for Node versions

import { node18 } from "eslint-config-teppeis/configs/node18";

export default [node18];

TypeScript

Configs for TypeScript

import { node18, typescript } from "eslint-config-teppeis/configs";

export default [node18, typescript];

ES Modules

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 });

Browsers

This enables globals for browsers.

import { es2023, browser } from "eslint-config-teppeis/configs";

export default [es2023, browser];

Mocha

This enables globals for Mocha like describe or it only in **/test/*.js.

import { es2023, mocha } from "eslint-config-teppeis";

export default [es2023, mocha];

Note: Prettier

Just intall prettier and use it with eslint-config-teppeis. These configs don't include rule settings that conflict with Pretteir.

License

Licensed under the MIT license. Copyright (c) 2023, Teppei Sato