Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source-loader: Disable linting altogether #9417

Merged
merged 1 commit into from
Jan 14, 2020
Merged

Conversation

shilman
Copy link
Member

@shilman shilman commented Jan 13, 2020

Issue: #9407 #9423

What I did

More aggressive than #9410 - just disable linting entirely in these synthetic files. Since this happens at load time, it shouldn't affect users' linting in general.

How to test

Didn't test

@shilman shilman added bug patch:yes Bugfix & documentation PR that need to be picked to main branch source-loader labels Jan 13, 2020
@vercel
Copy link

vercel bot commented Jan 13, 2020

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/storybook/monorepo/4qkkg7mqk
✅ Preview: https://monorepo-git-9407-source-loader-eslint.storybook.now.sh

@shilman shilman requested review from mrmckeb and ndelangen January 13, 2020 21:03
@shilman shilman added this to the 5.3.x milestone Jan 13, 2020
@shilman shilman requested a review from tmeasday January 14, 2020 06:27
@shilman
Copy link
Member Author

shilman commented Jan 14, 2020

Self-merging @tmeasday @ndelangen @mrmckeb

@shilman shilman merged commit 57aed62 into next Jan 14, 2020
@shilman shilman deleted the 9407-source-loader-eslint branch January 14, 2020 08:47
@shilman shilman added the patch:done Patch/release PRs already cherry-picked to main/release branch label Jan 16, 2020
@zslabs
Copy link

zslabs commented Jan 31, 2020

I'm thinking this may be causing an issue when eslint is integrated into the webpack config and part of the reloading:

// main.js

const webpack = require('webpack');

module.exports = {
  stories: ['../src/components/*.stories.(js|mdx)'],
  addons: [
    '@storybook/addon-docs',
    '@storybook/addon-knobs',
    '@storybook/addon-actions',
    '@storybook/addon-viewport',
    '@storybook/addon-a11y',
  ],
  webpackFinal: async config => {
    // Provide React by default (since we don't need it with Emotion)
    config.plugins.push(
      new webpack.ProvidePlugin({
        React: 'react',
      })
    );

    config.module.rules[0].use[0].options.presets = [
      require.resolve('@babel/preset-react'),
      require.resolve('@babel/preset-env'),
      // Emotion preset must run BEFORE reacts preset to properly convert css-prop.
      // Babel preset-ordering runs reversed (from last to first). Emotion has to be after React preset.
      require.resolve('@emotion/babel-preset-css-prop'),
    ];

    // Enable eslint
    config.module.rules.push({
      test: /\.jsx?$/,
      exclude: /(node_modules|cache)/,
      use: [
        {
          loader: 'eslint-loader',
        },
      ],
    });

    config.node = {
      module: 'empty',
      dgram: 'empty',
      dns: 'mock',
      fs: 'empty',
      net: 'empty',
      tls: 'empty',
      child_process: 'empty',
    };

    // Return the altered config
    return config;
  },
};

The initial build works fine, but saves after error out. This worked fine in 5.3.1, but everything after has this issue.

@shilman
Copy link
Member Author

shilman commented Jan 31, 2020

@zslabs what do you think is going on? And what is your setup? CRA? Do you have a repro available?

1 similar comment
@shilman
Copy link
Member Author

shilman commented Jan 31, 2020

@zslabs what do you think is going on? And what is your setup? CRA? Do you have a repro available?

@zslabs
Copy link

zslabs commented Jan 31, 2020

@zslabs what do you think is going on? And what is your setup? CRA? Do you have a repro available?

Sorry, that was a very vague implementation I had on my end. You can find the complete repo at https://github.com/gremlin/chaoskit/tree/feature/emotion If you download, and run yarn develop, saves to *.stories.js work properly, but if you upgrade all the Storybook deps to the latest, subsequent saves to those stories will throw the error.

@zslabs
Copy link

zslabs commented Feb 7, 2020

Anymore info I could provide here? Should I open up an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch source-loader
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants