0.6.15 • Published 4 months ago

@fenge/eslint-config v0.6.15

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@fenge/eslint-config

npm.io npm.io npm.io npm.io PRs Welcome

A strict eslint config preset containing a comprehensive set of rules for linting js / ts / package.json files.

Feature

  • Lint js / mjs / cjs / jsx / ts / mts / cts / tsx / package.json files only.
  • Strict. More than 400+ rules.
  • Highly customizable by omitting unwanted.
  • Type safe. TypeScript friendly.
  • Pure JavaScript project friendly.
  • React friendly.
  • NestJS friendly.
  • Have no stylistic opinions. Prettier friendly.
  • Respect .gitignore.
  • ESLint Flat config, compose easily!
  • Modern. ESM first.
  • One-line of config.

Usage

Install it in the root of js / ts project.

npm i -D eslint @fenge/eslint-config

Config eslint.config.js (for ESM).

export { default } from "@fenge/eslint-config";

If you are in CommonJS, config eslint.config.js bellow:

module.exports = import("@fenge/eslint-config");

Config package.json

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}

Note: For TypeScript project, adding a tsconfig.json file in the root is recommended.

Advanced Usage

Config Builder

You can use Builder class to customize for selecting or omitting some rules.

// @ts-check
import { Builder } from "@fenge/eslint-config";

export default new Builder()
  .enablePackageJson({
    pick: ["packagejson/top-types"], // only these rules will work for package.json files
  })
  .enableJavaScript({
    omit: ["no-var"], // these rules will not work for js files
  })
  .enableTypeScript()
  // apply additional rules or override the built-in rules for ts files
  .append({
    name: "strictest",
    files: ["**/*.{ts,cts,mts,tsx}"],
    rules: {
      "@typescript-eslint/no-explicit-any": "error",
      "@typescript-eslint/consistent-type-assertions": [
        "error",
        { assertionStyle: "never" },
      ],
      "@typescript-eslint/no-non-null-assertion": "error",
    },
  })
  .toConfig();

Tips: By adding a // @ts-check at the top of the config file, you will get code hinting in VSCode/WebStorm. It will highly improve your development experience.

License

MIT

0.5.10

8 months ago

0.5.11

7 months ago

0.6.7

6 months ago

0.5.8

9 months ago

0.6.6

6 months ago

0.5.7

9 months ago

0.6.9

5 months ago

0.6.8

6 months ago

0.5.9

8 months ago

0.5.12

7 months ago

0.5.13

7 months ago

0.4.0-beta.0

11 months ago

0.4.0-beta.1

11 months ago

0.4.0-beta.2

10 months ago

0.6.10

5 months ago

0.5.5-beta.0

9 months ago

0.6.12

5 months ago

0.6.11

5 months ago

0.6.14

5 months ago

0.6.13

5 months ago

0.6.15

4 months ago

0.3.0

11 months ago

0.2.1

11 months ago

0.1.2

12 months ago

0.2.0

11 months ago

0.6.3

6 months ago

0.5.4

9 months ago

0.6.2

7 months ago

0.5.3

9 months ago

0.6.5

6 months ago

0.5.6

9 months ago

0.6.4

6 months ago

0.5.5

9 months ago

0.5.0

10 months ago

0.4.1

10 months ago

0.4.0

10 months ago

0.1.3

11 months ago

0.6.1

7 months ago

0.5.2

10 months ago

0.6.0

7 months ago

0.5.1

10 months ago

0.1.1

12 months ago

0.1.0

1 year ago

0.1.0-beta.0

1 year ago