Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ESLint couldn't find the config "prettier/@typescript-eslint" after relocating .eslintrc to parent

Tags:

I have a folder structure like

parentFolder > componentA              > componentB              > componentC 

Each component has a package.json which defines a yarn lint command (eslint "myFilter" --no-error-on-unmatched-pattern). And each component has its own .eslintrc and .prettierrc

When I am in a componentA/B/C folder and run yarn lint, it is working as expected.

Since all of the .eslintrc are the same in each component folder, I moved the file under parentFolder and delete the copies in the component folders. When I call yarn lint, it used the .eslintrc in the parentFolder, but, I am getting an error.

Oops! Something went wrong! :(

ESLint: 6.8.0.

ESLint couldn't find the config "prettier/@typescript-eslint" to extend from. Please check that the name of the config is correct.

I moved the .prettierrc to the parent folder, but, it couldn't find it. What should I do? Thank you

Update: I noticed if I add the prettier on the package.json in the parent folder and run the yarn install, it works. But, I don't know if this is the proper way to do it.

like image 980
BoBoDev Avatar asked Jan 11 '21 23:01

BoBoDev


2 Answers

prettier/@typescript-eslint has been removed in eslint-config-prettier v8.0.0. Just remove it from your ESLint config file. The only entry in extends that is needed now for Prettier and ESLint to not conflict is "prettier" (make sure it's the last one in extends).

like image 72
thorn0 Avatar answered Sep 20 '22 15:09

thorn0


I got the same error when I updated to eslint-config-prettier 8.0.0, I fixed it by changing .eslintrc.js to:

    "plugins": ['@typescript-eslint'],     "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"] 

Make sure your package.json includes:

 @typescript-eslint/eslint-plugin  @typescript-eslint/parser 

You can of course include other plugins and other extends, you can find all the optons: https://www.npmjs.com/package/@typescript-eslint/eslint-plugin

like image 35
josesuero Avatar answered Sep 20 '22 15:09

josesuero