tslint.js files throws a syntax error running yarn lint on windows
See original GitHub issueDescribe the bug A clear and concise description of what the bug is.
On the master branch after a successful run of yarn
of this project. The yarn lint
or yarn lint:fix
commands fail on my windows machine. A syntax error is thrown classed as a “Microsoft JScript compilation error”. (see attached screenshot)
It looks to be a Windows specific issue where this tslint.js is being run by windows instead of node when called in package.json - similar to this SO question: https://stackoverflow.com/questions/37192508/trying-to-execute-a-script-from-package-json-on-windows-throws-a-jscript-error
Expected results
What did you expect to happen?
The yarn lint command would run to completion and lint the project source files.
Observed results
The yarn lint command throws a syntax parse error on Windows machine, pointing to the tslint.js
file as the culprit. This is run straight after cloning and yarn install without any modification to the original code.
What happened?
Logs
Run react-native info
in your terminal and paste its contents here.
$ react-native info
React Native Environment Info:
System:
OS: Windows 7
CPU: (4) x64 Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz
Memory: 3.22 GB / 7.88 GB
Binaries:
Yarn: 1.13.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 5.6.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.3.0.0 AI-182.5107.16.33.5199772
Steps to reproduce
$ nvm list
* 8.11.4 (Currently using 64-bit executable)
8.11.2
8.10.0
$ nvm use 8.11.4
$ yarn
$ yarn lint
yarn run v1.13.0
$ tslint --project ./tsconfig.json
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Throws the following syntax parse error on Windows:
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
It worked. Merging. thanks!
Hi @BrianJVarley. Thanks for reporting this. I have actually not run this code on a windows machine. I’ll get hold of one and look into this.
Though from the looks of it,
./tsconfig.json
is mentioned on in the package.json and is not a valid path forwindows
environment, as far as I know. We’ll probably have to use something likecross-env
. I’ll give it a shot.If you have a proposed solution, please feel free to submit a PR. Thanks.