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.

Getting typescript errors reported with js files

See original GitHub issue

The readme says this works with both ts and js yet when I run npx eslint webpack.config.js I’m seeing lots of ts errors such as:

1:22  error    Require statement not part of import statement              @typescript-eslint/no-var-requires
   2:27  error    Require statement not part of import statement              @typescript-eslint/no-var-requires
   2:35  error    Unable to resolve path to module 'copy-webpack-plugin'      import/no-unresolved
   3:30  error    Require statement not part of import statement              @typescript-eslint/no-var-requires
   3:38  error    Unable to resolve path to module 'mini-css-extract-plugin'  import/no-unresolved
   4:14  error    Require statement not part of import statement              @typescript-eslint/no-var-requires
  30:24  warning  Missing return type on function                             @typescript-eslint/explicit-function-return-type

I’m using the base configuration.

.eslintrc:

{
  "root": true,
  "extends": [
    "airbnb-typescript/base",
    "plugin:@typescript-eslint/recommended",
    "plugin:prettier/recommended"
  ],
  "parser": "@typescript-eslint/parser",
  "plugins": ["@typescript-eslint"]
}

Using latest versions except eslint@6.8.0.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
nero120commented, Jun 10, 2020

Fair enough. Yes the tsconfig.eslint.json solution does indeed sort it, many thanks for all of your help @iamturns!

0reactions
iamturnscommented, Jun 10, 2020

Yeah I agree, it is a bit annoying. This is how @typescript-eslint/parser behaves. I’m sure there’s a good reason, but I haven’t looked into it. The tsconfig.eslint.json solution is a slight annoyance, but does the job!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Removing [ts] errors from JS files In VS Code - Stack Overflow
Yes. The TypeScript extension powers our javascript intellisense which is why you see [TS] in your js file. That only indicates what extension ......
Read more >
Unexpected [ts] errors in JavaScript files · Issue #54261 - GitHub
@garretteklof I finally figured out how to disable the [ts] errors. Go to Extension view, search for @builtin javascript , and disable ...
Read more >
Remove [ts] errors from JS files - Medium
Remove [ts] errors from JS files. VSCode on my Windows machine has this annoying feature of reporting typescript issues such as type validations ......
Read more >
Documentation - Type Checking JavaScript Files - TypeScript
How to add type checking to JavaScript files using TypeScript. ... It is important to note that it is an error to call...
Read more >
TypeScript errors and how to fix them
Common Errors​​ Below you find a list of common TypeScript errors along with the buggy code and its fixed version.
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