Package Exports
- @git-validator/eslint-config
Readme
@git-validator/eslint-config
A strict eslint config for linting js / ts / package.json files. Based on standard.js without any stylistic opinions.
Feature
- Lint
js/mjs/cjs/jsx/ts/mts/cts/tsx/package.jsonfiles only. - One-line of config.
- Type safe. TypeScript friendly.
- Respect
.gitignore. - Based on standard.js.
- Have no stylistic opinions. Prettier friendly.
- ESLint Flat config, compose easily!
- Strict, but progressive.
- Modern. ESM first.
- React friendly.
- NestJS friendly.
Usage
Install it in the root of js / ts project.
npm install -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.jsonfile in the root.
Advanced Usage
Config Builder
The default config is very strict. If you don't like the default config, use Builder to customize your own.
import { Builder } from "@git-validator/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({
project: "tsconfig.json", // tsconfig.json path
extend: {
// apply additional rules for ts files
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/consistent-type-assertions": [
"error",
{ assertionStyle: "never" },
],
"@typescript-eslint/no-non-null-assertion": "error",
},
})
.toConfig();License
MIT