prettier / eslint-config-prettier

Turns off all rules that are unnecessary or might conflict with Prettier.
MIT License
5.39k stars 255 forks source link

ESLint is not a constructor? #224

Closed SturmB closed 2 years ago

SturmB commented 2 years ago

I just attempted to add this to a project and followed all of the rules, but I run into problems when I get to running the CLI helper tool.

Node: 10.24.1 npm: 6.14.12 prettier: 2.6.2

When I attempted to run npx eslint-config-prettier path/to/jsfile.js with ESLint v4.19.1, I was greeted with

ESLint is not a constructor

I upgraded ESLint to the latest version supported by Node 10 and got a different error message when attempting to run that CLI command:

configs.flatMap is not a function

I know our version of Node is old, but the higher-ups have not yet given us permission to upgrade it. I'm working on changing their minds, but what can I do in the meantime to get eslint-config-prettier to work?

lydell commented 2 years ago

Hi!

eslint-config-prettier requires ESLint 7 or later and does not support Node.js versions that are end of life.

You’ll need to try older versions of eslint-config-prettier. My guess would be 6.x or older.

SturmB commented 2 years ago

When I said that I upgraded ESLint to the latest version supported by Node 10, I meant ESLint 7.32.0.

Regardless, I downgraded eslint-config-prettier to 6.15.0 and still got the same configs.flatMap is not a function error message.

Can you give me optimal version numbers for eslint-config-prettier, ESLint, and Prettier that work well together with Node 10.24.1 (which is only a year old)?

lydell commented 2 years ago

Can you give me optimal version numbers for …

No, sorry, I can’t, because I don’t know. I’d have to spend time digging into the release/commit history, which would basically be doing your job. eslint-config-prettier is a small and simple package so I think it’s a good exercise for you – if you’re gonna be using end of life Node.js then you’ll run into issues with packages all the time.

lydell commented 2 years ago

Closing since the discussion died out and there does not seem to be anything to do from eslint-config-prettier’s side.