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

Error: eslint-plugin-prettier tried to access eslint-config-prettier, but it isn't declared in its dependencies #322

Closed
abdes opened this issue Aug 5, 2020 · 2 comments · Fixed by #367

Comments

@abdes
Copy link

abdes commented Aug 5, 2020

What version of eslint are you using?
v7.6.0

What version of prettier are you using?
2.0.5

What version of eslint-plugin-prettier are you using?
3.1.4

Please paste any applicable config files that you're using (e.g. .prettierrc or .eslintrc files)
eslintrc

...
  plugins: [
    'import',
    'md',
    '@typescript-eslint',
    'optimize-regex',
    'no-secrets',
    'security',
    'editorconfig',
    'json',
    'promise',
    'prettier'
  ],
  extends: [
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended',
    'plugin:json/recommended',
    'plugin:md/recommended',
    'plugin:security/recommended',
    'plugin:editorconfig/noconflict',
    'plugin:import/errors',
    'plugin:import/warnings',
    'plugin:import/typescript',
    'plugin:promise/recommended',
    'plugin:prettier/recommended',
    'prettier/@typescript-eslint'
  ],
,,,

package.json

...
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^3.8.0",
    "@typescript-eslint/parser": "^3.8.0",
    "@yarnpkg/builder": "^2.1.0",
    "eslint": "^7.6.0",
    "eslint-config-prettier": "^6.11.0",
    "eslint-plugin-editorconfig": "^2.1.3",
    "eslint-plugin-import": "^2.22.0",
    "eslint-plugin-json": "^2.1.2",
    "eslint-plugin-md": "^1.0.19",
    "eslint-plugin-no-secrets": "^0.6.8",
    "eslint-plugin-optimize-regex": "^1.2.0",
    "eslint-plugin-prettier": "^3.1.4",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-security": "^1.4.0",
    "husky": "^4.2.5",
    "markdown-eslint-parser": "^1.2.1",
    "prettier": "2.0.5",
    "prettier-plugin-organize-imports": "1.1.1",
    "prettier-plugin-package": "^1.0.0",
    "pretty-quick": "2.0.1",
    "typescript": "^3.9.7"
  },
...

What source code are you linting?
Various.
not relevant.

What did you expect to happen?

No warning to be issued by YARN because of the above.
The eslint-config-prettier should be part of eslint-plugin-prettier dependencies or peerDependencies. other package managers may not report such issue because they are not as strict in having dependencies being declared before being used.

YARN version - IMPORTANT
2.1.1

What actually happened?

(node:7832) [MODULE_NOT_FOUND] Error: eslint-plugin-prettier tried to access eslint-config-prettier, but it isn't 
declared in its dependencies; this makes the require call ambiguous and unsound.

then linting happens with no issue.

@six5536
Copy link

six5536 commented Dec 11, 2020

Try adding

packageExtensions:
  "eslint-plugin-prettier@*":
    dependencies:
      "eslint-config-prettier": "*"

to your .yarnrc.yml

@BPScott
Copy link
Member

BPScott commented Dec 13, 2020

This should be fixed as of v3.3.0

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

Successfully merging a pull request may close this issue.

3 participants