Storybook: ESLint question

Created on 8 Oct 2017  路  3Comments  路  Source: storybookjs/storybook

There is error in project:
[eslint] '@storybook/addon-actions' should be listed in the project's dependencies, not devDependencies. (import/no-extraneous-dependencies) more about this rule. So, how to resolve this issue? I won't add @storybook/addon-actions in dependencies, but how to fix this error?

compatibility with other tools question / support

Most helpful comment

You may want to add something like this to your eslint config:

rules: {
  'import/no-extraneous-dependencies': [
      'error',
      {
        devDependencies: [
          '.storybook/**',
          'stories/**' 
        ]
      }
    ]
}

This will allow usage of devDependencies in the listed directories

All 3 comments

You may want to add something like this to your eslint config:

rules: {
  'import/no-extraneous-dependencies': [
      'error',
      {
        devDependencies: [
          '.storybook/**',
          'stories/**' 
        ]
      }
    ]
}

This will allow usage of devDependencies in the listed directories

@Hypnosphi Yeah, it's work fine, thank you very much

@Hypnosphi, you have a small typo in your comment above: error should be 'error'.

Years later, I copied your suggestion, with a small tweak for my project, and it worked perfectly - thank you! Including mine for anyone who would find it useful:

rules: {
  // ...

  'import/no-extraneous-dependencies': [
    'error',
    {
      devDependencies: [
        '**/*.stories.tsx',
      ],
    },
  ],

  // ...
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

shilman picture shilman  路  3Comments

alexanbj picture alexanbj  路  3Comments

sakulstra picture sakulstra  路  3Comments

purplecones picture purplecones  路  3Comments

shilman picture shilman  路  3Comments