Getting typescript errors reported with js files
See original GitHub issueThe 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:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fair enough. Yes the
tsconfig.eslint.json
solution does indeed sort it, many thanks for all of your help @iamturns!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!