Airbnb抛出错误而不是警告

时间:2018-09-05 14:30:04

标签: reactjs webpack eslint eslint-config-airbnb

我对airbnb短毛猫配置有疑问。 eslint不会发出警告,而是会引发错误,从而导致编译失败并出现failed to compile错误。

我的猜测是问题与webpack及其加载程序有关。需要配置。它必须以某种方式连接到在webpack中发出错误。我的webpack的重要部分如下所示:

      {
        test: /\.(js|jsx|mjs)$/,
        enforce: 'pre',
        use: [
          {
            options: {
              formatter: eslintFormatter,
              eslintPath: require.resolve('eslint'),
            },
            loader: require.resolve('eslint-loader'),
          },
        ],
        include: paths.appSrc,
      },
      {
        oneOf: [
          {
            test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
            loader: require.resolve('url-loader'),
            options: {
              limit: 10000,
              name: 'static/media/[name].[hash:8].[ext]',
            },
          },
          {
            test: /\.(js|jsx|mjs)$/,
            include: paths.appSrc,
            loader: require.resolve('babel-loader'),
            options: {

              cacheDirectory: true,
            },
          },
          {
            test: /\.css$/,
            use: [
              require.resolve('style-loader'),
              {
                loader: require.resolve('css-loader'),
                options: {
                  importLoaders: 1,
                },
              },
              {
                loader: require.resolve('postcss-loader'),
                options: {
                  ident: 'postcss',
                  plugins: () => [
                    require('postcss-flexbugs-fixes'),
                    autoprefixer({
                      browsers: [
                        '>1%',
                        'last 4 versions',
                        'Firefox ESR',
                        'not ie < 9', // React doesn't support IE8 anyway
                      ],
                      flexbox: 'no-2009',
                    }),
                  ],
                },
              },
            ],
          },

          {
            exclude: [/\.(js|jsx|mjs)$/, /\.html$/, /\.json$/, /\.sass$/, /\.scss$/],
            loader: require.resolve('file-loader'),
            options: {
              name: 'static/media/[name].[hash:8].[ext]',
            },
          },
          {
              test: /\.scss$/,
              exclude: /node_modules/,
              use: [
                  'style-loader',
                  'css-loader',
                  'sass-loader',
                  {
                      loader: 'sass-resources-loader',
                      options: {
                          resources: ['./src/styles/modules/_variables.scss'],
                      },
                  },
              ],
          },
        ],
      },
    ],
  },
  ...

0 个答案:

没有答案