typescript-tslint-plugin
typescript-tslint-plugin copied to clipboard
a tslint.json placed in a directory above tsconfig.json is not applied
Say there is a monorepo structure such as this one
- tslint.json
- node_modules/...
- packages/a/tsconfig.json
- packages/a/src/...
then tslint.json is not automatically found and applied (it is with the "old" tslint plugin)
if a tslint.json is placed in packages/a/tslint.json that just extends the root one then it will work
In that example, which folder have you opened in the editor?
A source file inside packages/a/src
Did you only open a single file in your editor? Or an entire subfolder?
a single .ts file
Also, maybe unrelated, when the tslint.json location is set in the plugins section of the tsconfig.json pointing to the root folder, if vscode is closed and reopened again then tslint won't work until such tsconfig.json file is resaved.
When using the extends trick it is ok.
Btw, what I mean by a single .ts file is that the workspace is pointing to the root, and then I double click on that single .ts file to open it.
If you want a proper example just clone this repo for example: https://github.com/mobxjs/mobx-state-tree then open the folder with vscode, run yarn and open any ts file inside packages\mobx-state-tree\src
A commit was just done to use tslint.json that extends to the root one, so if you clone that repo you may want to use this branch for example instead: https://github.com/mobxjs/mobx-state-tree/tree/better-liveliness-warning
I am also experiencing this with descending tslint files
Project is an ASP.NET Core project with Angular 6.X.X
/tsconfig.json /ClientApp/tsconfig.json (A) /ClientApp/src/tsconfig.json (B)
/ClientApp/tsconfig.json (A)
{
"defaultSeverity": "error",
"extends": "tslint:recommended",
"jsRules": {},
"rules": { },
"rulesDirectory": []
}
/ClientApp/tsconfig.json (B)
{
"extends": "../tslint.json",
"rules": {
"component-selector": [
true,
"element",
"app",
"kebab-case"
],
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
]
},
"linterOptions": {
"exclude": [
"test.ts",
"main.ts",
"polyfills.ts"
]
}
}
When I run the CLI or through Visual Studio with tslint-microsoft-contrib the excluded files are not excluded as expected. Which leads me to believe it is not being loaded in reference to the directory it sits in.
@xaviergonz Looks like that branch no longer exists. Do you have a link to version of that project where it doesn't work?
Same issue here, but I'm opening the whole monorepo in vscode
tslint.json
packages/
package1/
tsconfig.json
linter is not working and it did with the old extension
Closing as TSLint has been deprecated in favor of ESLint. We are archiving this repo as this project is no longer maintained