eslint-config-geksones- v1.0.17
Personal eslint config
Slightly extended airbnb base config with prettier and html parsing support.
The point is to include eslint
and prettier
formating in project by installing the only one npm package and writing one .eslintrc
file. Package already has eslint
itself in dependencies
.
Supported extensions: *.ts
, *.js
, *.html
.
NOTE: to get
vscode-eslint
html parsing support, we need to add the folowing in vscodesettings
."eslint.validate": [ "html" // Add "html" to enable linting `.html` files. ]
Usage
Examples of .eslintrc
file below
Default
{
"root": true,
"extends": "eslint-config-geksones-"
}
Angular
{
"root": true,
"extends": "eslint-config-geksones-",
"overrides": [
{
"files": [
"*.component.ts"
],
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"class-methods-use-this": "off"
}
},
{
"files": [
"*.component.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
]
}
]
}
Usefull tips
1. default-case issue
It doesn't require you to write default case specifictly. You just can leave a comment // no default
in switch block. The rule is described here.
switch (a) {
case 1:
/* code */
break;
// no default
}
2. consistent-type-imports and Angular's Dependency Injection issue
If your are using Angular and came across the issue when your injected dependencies imports are replaced with type
only imports so this is your case.
Just add "emitDecoratorMetadata": true,
into your "compilerOptions"
to fix.