How disable eslint-loader of storybook's webpack?

by filiberto , in category: Javascript , a year ago

How disable eslint-loader of storybook's webpack?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by brandy , a year 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.

Related Threads:

How to disable eslint in a laravel project?
How to access dom from webpack loader?
How to resolve loader in webpack 4?
How to resolve css loader in webpack config?
How to use 'import' statements in custom webpack loader?
How to disable logs in webpack?