Open PMExtra opened 5 years ago
Ref: https://github.com/palantir/tslint/blob/5.18.0/src/configuration.ts#L236-L245
We simply call loadConfigurationFromPath
from TSLint to load configs, which uses the Node module resolution to find it. Since it uses Node resolution, you should pass ./tslint.json
instead of .\tslint.json
.
This does not look like a bug but something we could improve, PRs welcome.
@ikatyang Great! So it's only a trouble for Windows users. It's awesome if we can simply replace the '\' with '/' on Windows. I'm not familiar with this project. I think maybe you could add below code in place.
if (process.platform === "win32") {
path = path.replace(/\\/g, '/')
}
I have checked.
> tslint-config-prettier-check ./tslint.json
> tslint-config-prettier-check C:/path/to/project/tslint.json
They are all works. So we can replace all the \
with /
on Windows at ease.
I just test it on Windows,
but I think it may also occurs on other platform(Edited: It's because windows path separator\
, so it won't occurs on other platform).%cd%
is equivalent to UNIX$(pwd)
for Windows.It seems because the check command calculate the relative path based
node_modules/...
instead the current work directory of shell.