Browse Source

lint(storybook): Fix eslint module import errors (#17467)

Evan Purkhiser 5 years ago
parent
commit
9c74f49a66
2 changed files with 13 additions and 15 deletions
  1. 0 14
      .storybook/main.js
  2. 13 1
      .storybook/webpack.config.js

+ 0 - 14
.storybook/main.js

@@ -1,19 +1,5 @@
 /*eslint-env node*/
 /*eslint import/no-nodejs-modules:0 */
-const path = require('path');
-const webpack = require('webpack');
-const appConfig = require('../webpack.config');
-
-const staticPath = path.resolve(
-  __dirname,
-  '..',
-  'src',
-  'sentry',
-  'static',
-  'sentry',
-  'app'
-);
-
 module.exports = {
   stories: ['../docs-ui/components/*.stories.*'],
   addons: [

+ 13 - 1
.storybook/webpack.config.js

@@ -14,8 +14,20 @@ const staticPath = path.resolve(
   'app'
 );
 
-module.exports = ({config}) => {
+/**
+ * Default the config parameter that storybook passes into our webpack config
+ * to an empty object specifically for eslint, since it will load this config
+ * without passing in a config object.
+ */
+const emptyConfig = {
+  module: {rules: []},
+  resolve: {alias: {}, extensions: []},
+  plugins: [],
+};
+
+module.exports = ({config} = {config: emptyConfig}) => {
   const [firstRule, ...rules] = config.module.rules;
+
   const filteredRules = rules.filter(rule => {
     return (
       (!rule.loader || !rule.loader.includes('file-loader')) &&