question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Error] There was trouble creating the ESLint CLIEngine

See original GitHub issue

Hello !

First of all, thanks for this amazing project, I love it 😃

Context : I’m using prettier-standard with husky and lint-staged. Relevant parts of package.json :

{
  "name": "client",
  "version": "1.0.0",
  "private": true,
  "devDependencies": {
    "husky": "^0.13.2",
    "lint-staged": "^3.4.0",
    "prettier-standard": "^1.0.4",
    "react-scripts": "^0.8.4"
  },
  "dependencies": {
    ...
  },
  "scripts": {
   ...
    "precommit": "lint-staged"
  },
  "lint-staged": {
    "gitDir": "../",
    "linters": {
      "client/src/**/*.js": [
        "prettier-standard",
        "git add"
      ]
    }
  },
  "proxy": "http://localhost:8080"
}

I don’t know if it’s relevant, but my git repository contains two folders : client and server. Server is a Java spring boot application, and client contains the package.json above (hence the ‘gitDir’ option and the linter pattern)

When I run yarn run precommit, I get the following error :

yarn run v0.20.3
$ lint-staged 
 ❯ Running tasks for client/src/**/*.js
   → failure formatting 1 file with prettier-standard
   ✖ prettier-standard
     → failure formatting 1 file with prettier-standard
     git add
🚫 prettier-standard found some errors. Please fix them and try committing again.
prettier-eslint [ERROR]: There was trouble creating the ESLint CLIEngine. Is "eslintPath: /home/benoit/Documents/YR/ihm-address-control/client/node_modules/prettier-standard/node_modules/eslint" a correct path to the ESLint module?
prettier-standard [ERROR]: There was an error formatting "/home/benoit/Documents/YR/ihm-address-control/client/src/index.js": 
    Error: Cannot find module '/home/benoit/Documents/YR/ihm-address-control/client/node_modules/prettier-standard/node_modules/eslint'
        at Function.Module._resolveFilename (module.js:472:15)
        at Function.Module._load (module.js:420:25)
        at Module.require (module.js:500:17)
        at require (internal/module.js:20:19)
        at getESLintCLIEngine (/home/benoit/Documents/YR/ihm-address-control/client/node_modules/prettier-eslint/dist/index.js:219:20)
        at getConfig (/home/benoit/Documents/YR/ihm-address-control/client/node_modules/prettier-eslint/dist/index.js:187:22)
        at format (/home/benoit/Documents/YR/ihm-address-control/client/node_modules/prettier-eslint/dist/index.js:78:54)
        at MapSubscriber.rxReadFile.map.text [as project] (/home/benoit/Documents/YR/ihm-address-control/client/node_modules/prettier-standard/lib/format-files.js:242:55)
        at MapSubscriber._next (/home/benoit/Documents/YR/ihm-address-control/client/node_modules/rxjs/operator/map.js:77:35)
        at MapSubscriber.Subscriber.next (/home/benoit/Documents/YR/ihm-address-control/client/node_modules/rxjs/Subscriber.js:89:18)
failure formatting 1 file with prettier-standard

I’m guessing the problem commes from prettier-standard because the path it’s complaining about is in prettier-standard, but I could be wrong.

The problem is that eslint is included both by prettier-standard and prettier-eslint, so yarn doesn’t put it in the prettier-standard node_modules folder. I found a workaround by adding an old version of prettier-eslint in my package.json, so that the current version end up in the folder that causes the error.

Do you know what might be causng this ? I looked in the code a bit, and it seems this line should find the correct path, but it doesn’t for some reason.

Is there an option that I can give to prettier-standard to avoid this, or is there a bug ?

Thanks in advance

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
Morantroncommented, Jul 5, 2017

Oops, this is broken again in 6.0.0, but works in 5.1.0

2reactions
tr1mscommented, Dec 7, 2019

I’m experiencing the same issue on version 9.0.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

There was trouble creating the ESLint CLIEngine
This is due to an issue with selecting the files with. **/*.js. A current UNIX workaround: use $PWD , i.e. $ npx prettier-eslint ......
Read more >
babel-eslint and prettier-eslint-cli Are Broken | rockyourcode
prettier-eslint [ERROR]: There was trouble creating the ESLint CLIEngine. There is a workaround for Linux and MacOS: inject $(pwd) before the ...
Read more >
Linting with ESLint v6 in 2019.1 fails with an error 'TypeError
Error-Message: ESLint: TypeError: This.cliEngine is not a constructor. Please provide any additional information below. Attach a code sample as text, ...
Read more >
Support for eslint 8.x is missing - Visual Studio Feedback
Warning internal-error (ESLint) i.CLIEngine is not a constructor foo\tsconfig.json foo\bar.ts 1 Active. This is probably because VS calls CLIEngine as ...
Read more >
eslint/eslint - Gitter
I'm trying to create some custom rules, but my vue-cli-service build fails after creating a new eslint-plugin, with error TypeError: eslint.CLIEngine is not ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found