I encountered the same issue of
Module build failed: Error: No ESLint configuration found
. Thankfully, I found a solution by moving all the eslint-loader options from LoaderOptionsPlugin directly into rules section in my webpack.config.js file. Here is how my configuration looks:
// webpack.config.js
var webpack = require('webpack');
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
context: __dirname + "/src",
entry: './app.js',
output: {
path: path.join(__dirname, 'dist'),
publicPath: '',
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
enforce: 'pre',
loader: 'eslint-loader',
exclude: /node_modules/,
options: {
emitWarning: true,
emitError: true,
//failOnWarning: false,
//failOnError: true,
useEslintrc: false,
// configFile: path.join(__dirname, "eslint_conf.js")
configFile: "eslint_conf.js"
}
},
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" },
{ test: /\.(png|jpg)$/, loader: 'file-loader?name=[path][name].[ext]&outputPath=../dist/' },
{
test: /\.(scss|sass|css)$/,
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [{
loader: "css-loader",
options: {
autoprefixer: true,
sourceMap: true,
importLoaders: true
}
},
{
loader: "fast-sass-loader",
options: {
// sourceMap: true
}
}
]
})
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html'
}),
new ExtractTextPlugin('style.css'),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
'window.jQuery': 'jquery',
'window.$': 'jquery'
})
]
};
To run eslint using npm run lintjs
, I added scripts to my package.json like this:
"scripts": {
"dev": "nodemon --watch webpack.config.js --exec \"webpack-dev-server --env development\"",
"lintjs": "eslint src --cache --no-eslintrc -c eslint_conf.js",
"build": "webpack --env production"
}
The devDependencies I am utilizing are:
"devDependencies": {
"autoprefixer": "^6.7.6",
"babel-core": "^6.23.1",
"babel-eslint": "^7.1.1",
"babel-loader": "^6.3.2",
"babel-preset-es2015": "^6.22.0",
"css-loader": "^0.26.2",
"eslint": "^3.17.1",
"eslint-loader": "^1.6.3",
"extract-text-webpack-plugin": "^2.1.0",
"fast-sass-loader": "^1.0.7",
"file-loader": "^0.10.1",
"html-loader": "^0.4.5",
"html-webpack-plugin": "^2.28.0",
"inuitcss": "^6.0.0-beta.4",
"node-sass": "^4.5.0",
"postcss-cssnext": "^2.9.0",
"postcss-import": "^9.1.0",
"postcss-loader": "^1.3.3",
"style-loader": "^0.13.2",
"webpack": "^2.2.1"
}