Package Exports
- @git-validator/eslint-config
Readme
@git-validator/eslint-config
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.jsonfiles 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-configConfig 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.jsonortsconfig.jsonortsconfig.build.jsonfile 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-checkat the top, you will get auto suggestions when you are usingpickandomit.
License
MIT