An Interest In:
Web News this Week
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
How to use eslint with webpack / ES6 / modules
Today we are going to talk about eslint and webpack. This is not going to teach you how to install eslint in your project, I will assume that you already did.
First of all, when you are new to eslint and want to auto-fix your JavaScript files, so you run npx eslint --fix .
but, you have this main.js that webpack kindly generated for you to make your code separated by modules, work.
So, you get this result
Full Screenshot
Even though the code still working, you are not going to pass eslint rules. We dont need to check this file with eslint, so what do we do?
We need to create a file in the root directory called .eslintignore
Demonstration
As you can see, the only line of code that you need to write is dist/main.js
And that's it, next time you use npx eslint .
or npx eslint --fix .
eslint will ignore this file.
If you want to check it out directly from the official documentation, go to the next link https://eslint.org/docs/user-guide/configuring#ignoring-files-and-directories
Happy Coding!
Original Link: https://dev.to/viricruz/how-to-use-eslint-with-webpack-es6-modules-4i4i
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To