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

CLI: Add eslint-plugin-storybook to automigrate #16550

Merged
merged 4 commits into from
Nov 11, 2021

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Nov 1, 2021

Issue: N/A

What I did

This PR adds a new automigration step: eslint-plugin.

It will:
1 - Check if the user has eslint but does not have eslint-plugin-storybook
2 - If that is the case, it will check if the .eslintrc file of the user is supported (js or cjs)
3 - It will install the eslint-plugin-storybook dependency
4.1 - After that, if the eslintrc is supported, it will write the configuration in the eslint file.
4.2 If the eslintrc file is unsupported (json, yml, yaml), it will log a warning with instructions to install manually (but successfully install the dependency)

What this depends on

The eslint plugin is not ready, so this should not be merged until it is published.

How to test

  • Is this testable with Jest or Chromatic screenshots?
  • Does this need a new example in the kitchen sink apps?
  • Does this need an update to the documentation?

1 - go to examples/official-storybook
2 - add eslint in package.json
3 - add a .eslintrc.js file in examples/official-storybook:

module.exports = {
  extends: ['plugin:prettier/recommended'],
  plugins: ["react", "@typescript-eslint"],
  rules: {
    'some/rule': 'warn'
  }
};

4 - run yarn build cli
5 - run ../../lib/cli/bin/index.js automigrate

@nx-cloud
Copy link

nx-cloud bot commented Nov 1, 2021

Nx Cloud Report

CI ran the following commands for commit 1df03aa. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch

Status Command
#000000 nx run-many --target=prepare --all --parallel --max-parallel=15

Sent with 💌 from NxCloud.

Copy link
Contributor

@kylegach kylegach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment

@yannbf yannbf force-pushed the feature/eslint-plugin-automigrate branch from 7d3b4e5 to 81923fc Compare November 11, 2021 13:39
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chef's kiss 😽

@yannbf
Copy link
Member Author

yannbf commented Nov 11, 2021

@shilman I think this is good to go. I don't think this caused the failures in the E2E, have you seen these failures elsewhere?

@shilman shilman merged commit dd560fd into next Nov 11, 2021
@shilman shilman deleted the feature/eslint-plugin-automigrate branch November 11, 2021 16:10
@shilman shilman added this to the 6.4 PRs milestone Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants