Open ChrisMBarr opened 7 years ago
Do other projects in the solution with tslint.json
have local installation of tslint
npm package as well, or just the main project?
Ah, yes that's correct. Only the main project has tslint installed. I run tslint via a gulp task, so in the main project I do const tslint = require("tslint");
and in the other projects I do const tslint = require("../../MyProj.WebApp/node_modules/tslint");
I think you are correct, this is the issue. However, we do this to help speed up the npm install
task on our automated builds, otherwise we have to keep installing the same packages multiple times.
If you install tslint
npm package at the solution "level" (so that you have node_modules/tslint
under the folder that contains .sln
file) - does linting starts to work for other projects with no local installation of tslint
(I believe it should)?
This is the current logic:
.ts
filetslint.cmd
under the project path, if none found, goto 2a
2a. If no tslint.cmd
under the project path, try the solution pathThis logic can be extended to read tslint.json
from the current project, look at extends
if local tslint.cmd
is not found and based on that path try to find tslint.cmd
there. However, it is something that would require several days to implement.
First, check if the proposed workaround works. Then we can start from there and put new logic on a TODO.
Hmm, I am not able to do that very easily in Visual Studio right now. I know I could do it from the command line, but communicating that to everyone and getting everyone to keep that up to date would be a bit of a pain
No problem. I'll set this as WIP, but no ETA at this moment due to surge of work and upcoming annual leave. Stay tuned!
Just had a thought for an alternative way to go about this.
What if by default it works exactly as it does now, but it also looks for a specially named configuration file in the root of each project. In that file we could specify the path to the tslint installation.
Example: A file named vs-tslint-config.json
that could contain something like this:
{
"tslint-path": "../MainProject/node_modules/tslint"
}
Also maybe some other configuration options if needed.
It would be a hard-coded way of solving the issue, which I would not like to pursue. I have an idea at implementing this in a general, tslint
way, but for the reasons mentioned above, I can not do it before the second half of September.
I have a VS 2015 Solution with multiple projects that use Typescript. The "main" project has the base
tslint.json
file, so in this project I extend that in this project like this:This extension works fine in the "main" project, but it does nothing at all in any project that uses the
extends
that points back a directory. It seems related to Issue #2 that I opened a while back.I am using Windows 10, Visual Studio 2015, Typescript 2.3.4, TSLint 5.5.0