import { SecondaryService } from "./src";
export class BasicService {
public State: boolean;
constructor(public s: SecondaryService) {
}
}
with tslint.json configuration:
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {
"import-blacklist": [
true,
"^.*src$",
]
},
"rulesDirectory": []
}
Tslint does not emit any errors
string import { SecondaryService } from "./src"; should mark as wrong by import-blacklist regex rule
https://github.com/alxpsr/tslint-regex
import-blacklist regex patterns?Solution: wrap any regular expressions in arrays. ["^.*src$"] instead of "^.*src$".
This isn't described well in the documentation; accepting PRs to explicitly mention this!
{
"defaultSeverity": "error",
"jsRules": {},
"rules": {
"import-blacklist": [
true,
["^.*src$"]
]
},
"rulesDirectory": []
}
Thanks
When i run tslint --project . tslint no emit any error. But in VsCode my import mark as green (probably as warning). On the other hand if i added rxjs to config and to my src/service.ts - tslint emit error (VsCode anyway mark import as warning). Why do the two strategies (regex-pattern vs simple string) have different behaviors?
Guys?
Hi @alxpsr - please file a separate issue. It's better to have one issue per discussion (and one discussion per issue) to keep these issues organized. Differences in lint complaints in VS Code vs the CLI are a separate issue from the documentation here.
Sorry for the ambiguity - the original issue here is still accepting PRs 馃槃 just there should be a second issue.
{
"defaultSeverity": "error",
"jsRules": {},
"rules": {
"import-blacklist": [
true,
["^.*src$"]
]
},
"rulesDirectory": []
}
doesn't match on organisation names like @mylib/thing/src
@alshdavid Could you find a solution by now? I have exactly the same issue right now with ["^.*@app/bkh.*"].
No solution, sadly
馃 Beep boop! 馃憠 TSLint is deprecated 馃憟 _(#4534)_ and you should switch to typescript-eslint! 馃
馃敀 This issue is being locked to prevent further unnecessary discussions. Thank you! 馃憢
Most helpful comment
Solution: wrap any regular expressions in arrays.
["^.*src$"]instead of"^.*src$".This isn't described well in the documentation; accepting PRs to explicitly mention this!