Skip to content

Drozerah/ESLint-Standard-in-Webpack-4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Using ESLint with Webpack 4 and JavaScript Standard Style guide

ESLint installation

Install eslint from npm, if you haven't already:

npm install eslint --save-dev

Set up a configuration file:

npx eslint --init

This command will run the ESLint CLI

ESLint prompt options

Note:

We choose the Standard style guide in the prompt "? Which style guide do you want to follow?"

This will creates the eslintrc.js into the root directory

Ignoring files

We tell ESLint to ignore specific files and directories by creating an .eslintignore file:

touch .eslintignore

In addition we configure the .eslintignore file:

# /node_modules/* and /bower_components/* in the project root are ignored by default

# Ignore built files except build/index.js
#build/*
#!build/index.js

# Ignore dist folder with all files inside
dist/*

Using ESLint with Webpack

Install eslint-loader from npm:

npm install eslint-loader --save-dev

Usage:

we add eslint-loader into the webpack configuration file:

webpack.config.js

module.exports = {
  // ...
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /(node_modules|bower_components)/,
        loader: 'eslint-loader',
        options: {
          // eslint options (if necessary)
        },
      },
    ],
  },
  // ...
};

That's it !

Author:

  • Thomas G. aka Drozerah - Github

License:

  • ISC

About

Using ESLint with Webpack 4 and JavaScript Standard Style guide

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published