@vita-mojo/eslint-plugin
v1.0.2
Published
This library was generated with [Nx](https://nx.dev).
Keywords
Readme
eslint
This library was generated with Nx.
Eslint rules were taken from https://nx.dev/docs/technologies/eslint/eslint-plugin Probably worth to check the source once in a while and adapt with their changes
How to configure project to use this plugin
- Create file
.eslintrc.jsonin the root of the project with this content. If you already have another eslint config file in the project - probably a good idea to replace it with this configuration.
{
"root": true,
"plugins": ["@vita-mojo/eslint"],
"extends": ["plugin:@vita-mojo/eslint/prettier"],
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@vita-mojo/eslint/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@vita-mojo/eslint/javascript"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"env": {
"jest": true
},
"rules": {}
}
]
}- Restart editor or restart ESLint server
- Some projects might require manual install of typescript package. These are projects that have source files as javascript (ex: pos, online-store, etc)
How to extend it with custom rules
In the .eslintrc.json file you can override the default set of rules with custom ones. You should set the rules inside the overrides block and to the apropriate configuration used in your project. For js source files set the rules in js extends block.
For example, there might be projects where you don't want to ban ts-ignore comments. In this case you would do:
...
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@vita-mojo/eslint/typescript"],
"rules": {
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-inferrable-types": "off"
...
}
},
{
...
}
]
...