Skip to content
This repository has been archived by the owner on Sep 28, 2020. It is now read-only.

Module build failed: Error: No ESLint configuration found #209

Closed
mittalyashu opened this issue Feb 3, 2018 · 8 comments · Fixed by #286
Closed

Module build failed: Error: No ESLint configuration found #209

mittalyashu opened this issue Feb 3, 2018 · 8 comments · Fixed by #286

Comments

@mittalyashu
Copy link

mittalyashu commented Feb 3, 2018

Getting this error: Module build failed: Error: No ESLint configuration found

Here's the code inside webpack.config.js.

{
				test: /\.js$/,
				exclude: /node_modules/,
				use: [
					"babel-loader",
					"eslint-loader"
				]
			}
@jiaowochunge
Copy link

same error. seems need configuration
./node_modules/.bin/eslint --init

@neemzy
Copy link

neemzy commented Mar 7, 2018

I had this problem when building a Webpack-based Vue.js app in an environment where my .eslintrc wasn't present - linting the code upon doing so was pointless to me as it is always linted before merging. Long story short, I moved the eslint-loader part of my global Webpack config to the dev-only config (based on the default Vue CLI setup):

diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js
index c265eb6..9b09c19 100644
--- a/build/webpack.base.conf.js
+++ b/build/webpack.base.conf.js
@@ -29,15 +29,6 @@ module.exports = {
   },
   module: {
     rules: [
-      {
-        test: /\.(js|vue)$/,
-        loader: 'eslint-loader',
-        enforce: 'pre',
-        include: [resolve('src'), resolve('test')],
-        options: {
-          formatter: require('eslint-friendly-formatter')
-        }
-      },
       {
         test: /\.vue$/,
         loader: 'vue-loader',
diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js
index 5470402..c4d91de 100644
--- a/build/webpack.dev.conf.js
+++ b/build/webpack.dev.conf.js
@@ -13,7 +13,17 @@ Object.keys(baseWebpackConfig.entry).forEach(function (name) {

 module.exports = merge(baseWebpackConfig, {
   module: {
-    rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
+    rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap }).concat([
+      {
+        test: /\.(js|vue)$/,
+        loader: 'eslint-loader',
+        enforce: 'pre',
+        include: [resolve('src'), resolve('test')],
+        options: {
+          formatter: require('eslint-friendly-formatter')
+        }
+      }
+    ])
   },
   // cheap-module-eval-source-map is faster for development
   devtool: '#cheap-module-eval-source-map',

Your mileage may vary if you're using a different setup, but you get the idea: you can't run Webpack with eslint-loader if you don't have a .eslintrc file, which sometimes you don't want.

@mittalyashu
Copy link
Author

Does anyone have any clue, how to use prettier in eslint-loader?

@Saf1997
Copy link

Saf1997 commented Apr 8, 2018

I use prettier on Mac: do control ^ + option + F

@mittalyashu
Copy link
Author

@Saf1997, do you use Prettier inside code editor or integrate with webpack.

@thasmo
Copy link

thasmo commented Apr 20, 2019

It would be nice if eslint-loader won't lint at all if no config was found/given or at least make it configurable. At the moment not providing a config will break the webpack build process.

@SerdarMustafa1
Copy link

Try creating a file named .eslintrc.json in the root of examples directory and input something in the file

{
"rules": {
"semi": ["error", "always"],
"quotes": ["error", "double"]
}
}

@akashingole1
Copy link

In my case there were these hidden files .babelrc, editorconfig, .eslintignore, .eslintrc.js and .postcssrc.js(in case you have installed bootstrap). These files were not commited so when I took pull these files were missing. I resolved my problem by copying back these files.
Hope that helps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants