@git-validator/eslint-config

0.4.13 • Public • Published

@git-validator/eslint-config

PRs Welcome

A strict eslint config for better code quality. Based on standard.js without any stylistic opinions.

Feature

  • Lint js / mjs / cjs / jsx / ts / mts / cts / tsx / package.json files only.
  • Based on standard.js.
  • Have no stylistic opinions. Prettier friendly.
  • ESLint Flat config, compose easily!
  • Strict, but progressive.
  • One-line of config.
  • Modern. ESM first.
  • Respect .gitignore.
  • React friendly.
  • NestJS friendly.
  • Type safe.

Usage

Install

pnpm add -D eslint @git-validator/eslint-config

Config eslint.config.js (for ESM)

import config from "@git-validator/eslint-config";

export default config;

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

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

Config package.json

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

Note: TypeScript project is required a tsconfig.eslint.json or tsconfig.json or tsconfig.build.json file in the root of the project. Otherwise, ts files will be ignored and only js files will be linted.

Progressive Usage

The default config is too strict for some projects. You can use pick or omit function in eslint.config.js to enable the rules step by step, progressively.

// @ts-check
import { pick } from "@git-validator/eslint-config";

// Enable the rules that you configured. The other builtin rules will not work.
export default pick([
  "unicorn/error-message",
  "@typescript-eslint/no-floating-promises",
  // Other rules key. You will get auto suggestions in VSCode here.
]);
// @ts-check
import { omit } from "@git-validator/eslint-config";

// Ignore the rules that you configure. The other builtin rules will work.
export default omit([
  "unicorn/error-message",
  "@typescript-eslint/no-floating-promises",
  // Other rules key. You will get auto suggestions in VSCode here.
]);

Tips: After enabling ts check by adding // @ts-check at the top, you will get auto suggestions when you are using pick and omit.

License

MIT

Package Sidebar

Install

npm i @git-validator/eslint-config

Weekly Downloads

182

Version

0.4.13

License

MIT

Unpacked Size

245 kB

Total Files

32

Last publish

Collaborators

  • zanminkian