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

yarn lint fails when choosing react-storybook template #149

Closed
iammathew opened this issue Apr 20, 2022 · 2 comments
Closed

yarn lint fails when choosing react-storybook template #149

iammathew opened this issue Apr 20, 2022 · 2 comments

Comments

@iammathew
Copy link

iammathew commented Apr 20, 2022

Current Behavior

After creating a new dts-cli project, choosing the react-storybook template, running yarn lint will fail due to not being able to load eslint-plugin-prettier correctly.

Expected behavior

yarn lint works without any problems

Suggested solution(s)

Installing eslint-plugin-prettier helps get rid of the error message, but it does not seem to be the intended way, since for the react template it works out of the box (and there it is also missing in the package.json)

Additional context

It apparently only fails in the react-storybook template.

yarn run v1.19.1
$ dts lint
Defaulting to "dts lint src test" 
You can override this in the package.json scripts, like "lint": "dts lint src otherDir"
Error: Failed to load plugin 'prettier' declared in 'BaseConfig': Cannot find module 'eslint-plugin-prettier'
Require stack:
- /Users/dummy/react-libs/dts-test-storybook/__placeholder__.js
Referenced from: BaseConfig
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.resolve (node:internal/modules/cjs/helpers:108:19)
    at Object.resolve (/Users/dummy/react-libs/dts-test-storybook/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2325:46)
    at ConfigArrayFactory._loadPlugin (/Users/dummy/react-libs/dts-test-storybook/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3376:33)
    at ConfigArrayFactory._loadExtendedPluginConfig (/Users/dummy/react-libs/dts-test-storybook/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3196:29)
    at ConfigArrayFactory._loadExtends (/Users/dummy/react-libs/dts-test-storybook/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3117:29)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/Users/dummy/react-libs/dts-test-storybook/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3058:25)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (/Users/dummy/react-libs/dts-test-storybook/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3003:20)
    at _normalizeObjectConfigData.next (<anonymous>) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/dummy/react-libs/dts-test-storybook/__placeholder__.js'
  ],
  messageTemplate: 'plugin-missing',
  messageData: {
    pluginName: 'eslint-plugin-prettier',
    resolvePluginsRelativeTo: '/Users/dummy/react-libs/dts-test-storybook',
    importerName: 'BaseConfig'
  }
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Your environment

System:
    OS: macOS 12.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
    Memory: 701.05 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.19.1 - ~/.yarn/bin/yarn
    npm: 8.5.0 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 98.1.35.100
    Chrome: 100.0.4896.127
    Firefox: 98.0.2
    Safari: 15.2
  npmPackages:
    dts-cli: ^1.5.0 => 1.5.0 
    typescript: ^4.6.3 => 4.6.3 
@iammathew iammathew changed the title yarn lint, fails when choosing react-storybook template yarn lint fails when choosing react-storybook template Apr 20, 2022
@aladdin-add
Copy link

aladdin-add commented Apr 21, 2022

it's because sometime yarn did not dedupe dts-cli's deps. you'll need to run npx yarn-deduplicate to do this.

Technically the plugins should be the app's deps(not dts-cli's), but it's a quiet big overhead for dts users. I planned to take the eslint's new config system (still wip, likely to be shipped in eslint v9) to avoid this. so, as of now you may need to run npx yarn-deduplicate.

if you are using yarn v2+, just run yarn dedupe.

@aladdin-add
Copy link

related eslint/eslint#3458

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

No branches or pull requests

2 participants