Configuring my TSLint rules has been a challenge for me, especially when it comes to including ordered-imports
with module-source-path
. I aim to establish rules where imports are organized primarily by path and then by sources with distinct groups (1st group = external libraries, 2nd group = internal sources). It is crucial for me to have an auto-fix feature as well.
Here is an example of correctly sorted imports:
import { CommonModule } from '@angular/common';
import { Observable } from 'rxjs';
import { MainComponent } from 'app/components/main.component';
import { MainService } from 'app/services/main.service';
I made the following addition to my tslint.json
:
"ordered-imports": [
true,
{
"import-sources-order": "any",
"named-imports-order": "case-insensitive",
"grouped-imports": true,
"module-source-path": "full"
}
],
However, WebStorm gives me an error or warning on the lines "grouped-imports": true,
and "module-source-path": "full"
, stating that "Property 'X' is not allowed" (where X represents one of these options). Despite the documentation indicating that it is feasible to add them here.
Interestingly, there are only 3 out of 4 available options for this rule on GitHub.
My tools are: TSLint 5.11.0 and WebStorm 2018.2.2.
Have I missed something in the configuration? Is there another approach to implement these rules effectively?
EDIT: In addition to the warnings, it seems that these two rules do not function at all - the linter does not flag errors with imports like this:
import { MainService } from 'app/services/main.service';
import { MainComponent } from 'app/components/main.component';