10
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

webpack経由でeslintするときの注意点

Last updated at Posted at 2016-07-31

当たり前な気がしますが、gruntやgulpではお目にかからない、webpackっぽい話

  • eslint src/
    • => src/の全ての.jsに対してlint実行
  • webpack + eslint-loader
    • => エントリーファイルから辿れる.jsに対してだけ lint実行
    • まだimport,requireしてないファイルとかはlintされない

参考までにeslint-loaderを組み込んだ、webpack.config.jsの例

webpack.config.js
const webpack = require('webpack')

module.exports = {
  context: `${__dirname}/src`,
  output: {filename: 'bundle.js', path: `${__dirname}/public`},
  resolve: {extensions: ['', '.js']},
  entry: {
    main: './index.js',
  module: {loaders: [
    {test: /\.js$/, exclude: /node_modules/, loader: ['babel-loader', 'eslint-loader']},
  ]}
}
10
12
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?