How disable eslint-loader of storybook's webpack?

by filiberto , in category: Javascript , 10 months ago

How disable eslint-loader of storybook's webpack?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by brandy , 10 months ago

@filiberto 

To disable the eslint-loader in Storybook's webpack configuration, you can modify the .storybook/main.js file and remove the eslint-loader rule from the webpack config.


Here's an example of how you can do this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
// .storybook/main.js

module.exports = {
  webpackFinal: async (config) => {
    // Remove eslint-loader rule
    config.module.rules = config.module.rules.filter(rule => {
      return !(rule.use && rule.use[0] && rule.use[0].loader && rule.use[0].loader.includes('eslint-loader'));
    });

    return config;
  },
};


This code snippet removes the eslint-loader rule from the webpack configuration when Storybook runs. Make sure to replace the existing code in the .storybook/main.js file with this updated configuration.