TSLint pulling wrong tslint.json file when including directory in jsconfig

I have two related projects in one repository, each with its own build process in its own package.json. I’ve been using this setup for a month or so, and Travis seems to work with it pretty well.

I recently added a mapping to the jsconfig of one project to point to a directory in the other so that I could share some typescript interfaces between the two. It works well locally, but once I created a pull request, the build fails on Travis.

More specifically, the pre-build linting fails on the API project, which is the one that has the mapping. Here’s the build in question. On line 503, you’ll see where it’s pulling the tslint from the Web project, rather than in the directory where it’s running. The Web project involves React, and therefore has react rules loaded; since the API project doesn’t have those rules installed, tslint throws an error. If I comment out the path mapping, there is no error.

I can run the same build locally and have no problem; the problem only happens when it tries to run on the Travis environment.

Any suggestions here? Not having duplicate interface declarations is quite handy, so I’d love to be able to use the pathing.

I solved this not long after submitting it, but since it hadn’t posted yet, I forgot to update it.

The solution was pretty simple, and I can’t believe I didn’t think of it before: designating the tslint config in the command:

tslint -p ./jsconfig.json -c ./tslint.json

Still a bit odd that the paths were enough to make it choose the other directory, but it worked properly once I added the -c flag.

Imprint