I've had a similar problem, In my case I was using create-react-app and customize-cra to disable eslint, since I'm also using my own linter config, but I run into a problem with Storybook using different linting rules, and complaining about my source code.
I then realised that I could just look at the source code of customize-cra to find out how they disabled eslint in webpack and it worked.
disableEsLint = (e) => {
return e.module.rules.filter(e =>
e.use && e.use.some(e => e.options && void 0 !== e.options.useEslintrc)).forEach(s => {
e.module.rules = e.module.rules.filter(e => e !== s)
}), e
}
module.exports = function ({ config }) {
// Same config, except it is missing the eslint rule
config = disableEsLint(config);
// Do any thing else you want here
config.module.rules.unshift({
test: /\.story\.tsx?$/,
loaders: [
{
loader: require.resolve('@storybook/addon-storysource/loader'),
options: { parser: 'typescript' },
},
],
enforce: 'pre',
});
// return the new config
return config;
};
I'm not sure if this will work for your case but it worth a try.
Other suggestions are try to console log config in webpack, find the rule's name and config.module.rules.delete('your-rule-name')
In my case rules didn't have a name / or I coudn't find it.
.storybook/main.js
look at this link: storybook.js.org/docs/configurations/custom-webpack-config/… – Undercool