question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tslint.js files throws a syntax error running yarn lint on windows

See original GitHub issue

Describe 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:

image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
AmitM30commented, Apr 2, 2019

It worked. Merging. thanks!

1reaction
AmitM30commented, Apr 1, 2019

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 for windows environment, as far as I know. We’ll probably have to use something like cross-env. I’ll give it a shot.

If you have a proposed solution, please feel free to submit a PR. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using yarn lint will fail with error ' was unexpected at this time ...
Typescript excecism using Windows OS (8.1). When running yarn lint above error will occur. error details: yarn lint v0.24.5 $ tslint ...
Read more >
ts-lint | Yarn - Package Manager
TSLint. An extensible linter for the TypeScript language. TSLint supports: custom lint rules; custom formatters (failure reporters); inline disabling ...
Read more >
How to run eslint --fix from npm script - Stack Overflow
You can run below command: npm run lint -- --fix.
Read more >
lint-staged - npm
Run linters against staged git files and don't let slip into your code base! npm install --save-dev lint-staged # requires further setup.
Read more >
Parsing Error: Cannot read file 'tsconfig.json' | bobbyhadz
To solve the error "Parsing Error: Cannot read file 'tsconfig.json'", update your .eslintrc.js file to set the tsconfigRootDir option to __dirname to force ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found