ESLint errors for code injected by Babel
See original GitHub issueI’m using Babel with preset-env
for IE support (sad, I know), and I’m getting these errors:
/.../TestWorker.js
4:3 warning Unexpected var, use let or const instead no-var
5:29 warning Unexpected function expression prefer-arrow-callback
8:7 warning Expected property shorthand object-shorthand
10:12 warning Unexpected function expression prefer-arrow-callback
13:7 warning Expected property shorthand object-shorthand
The warnings seem to be about code that would be injected by Babel, but ESLint runs with enforce: pre
, so looks like double processing. This happens only for the worker the rest of the code is built correctly.
Here’s the (simplified) code for my worker:
import process from './process';
self.onmessage = ({data}) =>
process(data)
.then(result => postMessage({type: 'success', result}))
.catch(error => postMessage({type: 'error', error}));
This could be related to the problem reported in #86.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Build initially fails when using both babel and eslint but ...
Build fails on first attempt, succeeds on the second, with no code changes. Any changes to main.js (even trivial ones such as adding...
Read more >Eslint and Babel parser throwing errors in React
Having some strange behaviour when trying to configure ESlint(global install) and babel: Editor(VSCode) showing error on top most import:.
Read more >Avoid Common JavaScript Errors with ESLint
ESLint uses static analysis to check that your code adheres to a list of rules to help you avoid some specific runtime errors....
Read more >ESLint: The guardian of code conventions ⚔️
ESLint is a tool that allows us to maintain code quality and enforce code conventions. ESLint is a static code evaluator. Basically, it...
Read more >Find and fix problems in your JavaScript code - ESLint ...
The pluggable linting utility for JavaScript and JSX ESLint is an open source project that helps you find and fix problems with your...
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
@dohun-toss I had not noticed that
eslint-loader
was deprecated. Usingeslint-webpack-plugin
fixed the problem, thank you!but, eslint-loader is deprecated. how about trying to migrate to
eslint-webpack-plugin
?Before:
After: