Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.0.1: Error: Cannot find module 'eslint/lib/formatters/stylish' #11910

Closed
rwieruch opened this issue Jun 26, 2019 · 3 comments
Closed

6.0.1: Error: Cannot find module 'eslint/lib/formatters/stylish' #11910

rwieruch opened this issue Jun 26, 2019 · 3 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon

Comments

@rwieruch
Copy link

I run into the following error when I try to build my project which uses ESLint 6.0.1. after upgrading it:

ERROR in ./src/index.js
Module build failed (from ./node_modules/eslint-loader/index.js):
Error: Cannot find module 'eslint/lib/formatters/stylish'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (/Users/me/Developer/Repos/use-custom-element/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.module.exports (/Users/me/Developer/Repos/use-custom-element/node_modules/eslint-loader/index.js:199:26)

Just yesterday I updated ESLint. I can confirm that it still works with version 5.16.0.

This minimal boilerplate project runs https://codesandbox.io/s/github/rwieruch/advanced-react-webpack-babel-setup But will fail with ESLint version 6.0.1.

Related: vuejs/eslint-plugin-vue#916

@rwieruch rwieruch added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Jun 26, 2019
@mysticatea
Copy link
Member

Thank you for your report.

However, this is a problem in eslint-loader package and we are not the maintainer of that package. Please report to eslint-loader's repo.

@rupamkhaitan
Copy link

rupamkhaitan commented Jul 2, 2019

In the eslint-loader README file you can see they mention how to override the path...

formatter (default: eslint stylish formatter)

Loader accepts a function that will have one argument: an array of eslint messages (object).
The function must return the output as a string.
You can use official eslint formatters.

module.exports = {
  entry: "...",
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: "eslint-loader",
        options: {
          // several examples !

          // default value
          formatter: require("eslint/lib/formatters/stylish"),

          // community formatter
          formatter: require("eslint-friendly-formatter"),

          // custom formatter
          formatter: function(results) {
            // `results` format is available here
            // http://eslint.org/docs/developer-guide/nodejs-api.html#executeonfiles()

            // you should return a string
            // DO NOT USE console.*() directly !
            return "OUTPUT";
          }
        }
      }
    ]
  }
};

@rupamkhaitan
Copy link

rupamkhaitan commented Jul 2, 2019

In the latest build of eslint 6.0.1 they moved the file path to below (so just override the path in your webpack)

// default value
formatter: require("eslint/lib/cli-engine/formatters/stylish"),

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Dec 24, 2019
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Dec 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon
Projects
None yet
Development

No branches or pull requests

3 participants