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

ESLint error: '@generated/photon' should be listed in the project's dependencies. #314

Closed
schmidsi opened this issue Aug 3, 2019 · 4 comments
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug.

Comments

@schmidsi
Copy link

schmidsi commented Aug 3, 2019

I'm trying to run eslint on my prisma2 test project and it gives me the following error:

'@generated/photon' should be listed in the project's dependencies. Run 'npm i -S @generated/photon' to add it
From import/no-extraneous-dependencies

Installing @generated/photon (obviously) does not work.

I see some possible solutions:

  • Create a dummy @generated/photon repo that is only a placeholder and empty
  • Try to make the @generated prefix an NPM standard.
  • I just remove/disable this rule.
  • Put @generated/photon in the "peerDependencies" or "optionalDependencies". I'm not sure if this gives weird side-effects? At least it would not try to install if I run yarn or npm install.
  • Change the config so the generated files are placed somewhere else. But I actually like the @generated prefix.

Thoughts?

@ljharb
Copy link

ljharb commented Aug 3, 2019

bundledDeps is the right place; a PR to the import plugin would be welcome.

@divyenduz
Copy link
Contributor

This also ties into the discussion around this: prisma/prisma-client-js#88

If we have a npm package scope that we "own", adding an optional dependency might be a way to make the linter work.

@divyenduz divyenduz removed their assignment Aug 5, 2019
@pantharshit00 pantharshit00 added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. labels Aug 5, 2019
@cloverich
Copy link

Found this issue before I knew you could change the generated output via config. Linking for any other lost souls: https://github.com/prisma/prisma2/blob/master/docs/photon/codegen-and-node-setup.md

@schmidsi
Copy link
Author

Should be fixed with the next version of eslint-plugin-import. Just put @generated/photon into bundledDependencies in package.json.

See import-js/eslint-plugin-import#1436

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug.
Projects
None yet
Development

No branches or pull requests

5 participants