GithubHelp home page GithubHelp logo

isabella232 / eslint-plugin-storybook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from storybookjs/eslint-plugin-storybook

0.0 0.0 0.0 1.2 MB

Official ESLint plugin for Storybook

JavaScript 0.70% Shell 0.05% TypeScript 99.25%

eslint-plugin-storybook's Introduction

Storybook

Build bulletproof UI components faster


Storybook Community Backers on Open Collective Sponsors on Open Collective Official Twitter Handle

eslint-plugin-storybook

Best practice rules for Storybook

Installation

You'll first need to install ESLint:

npm install eslint --save-dev
# or
yarn add eslint --dev

Next, install eslint-plugin-storybook:

npm install eslint-plugin-storybook --save-dev
# or
yarn add eslint-plugin-storybook --dev

Usage

Use .eslintrc.* file to configure rules. See also: https://eslint.org/docs/user-guide/configuring

Add plugin:storybook/recommended to the extends section of your .eslintrc configuration file. Note that we can omit the eslint-plugin- prefix:

{
  // extend plugin:storybook/<configuration>, such as:
  "extends": ["plugin:storybook/recommended"]
}

This plugin will only be applied to files following the *.stories.* (we recommend this) or *.story.* pattern. This is an automatic configuration, so you don't have to do anything.

Overriding/disabling rules

Optionally, you can override, add or disable rules settings. You likely don't want these settings to be applied in every file, so make sure that you add a overrides section in your .eslintrc.* file that applies the overrides only to your stories files.

{
  "overrides": [
    {
      // or whatever matches stories specified in .storybook/main.js
      "files": ['*.stories.@(ts|tsx|js|jsx|mjs|cjs)'],
      "rules": {
        // example of overriding a rule
        'storybook/hierarchy-separator': 'error',
        // example of disabling a rule
        'storybook/default-exports': 'off',
      }
    }
  ]
}

MDX Support

This plugin does not support MDX files.

Supported Rules and configurations

Key: ๐Ÿ”ง = fixable

Configurations: csf, csf-strict, addon-interactions, recommended

Name Description ๐Ÿ”ง Included in configurations
storybook/await-interactions Interactions should be awaited ๐Ÿ”ง
  • addon-interactions
  • recommended
storybook/context-in-play-function Pass a context when invoking play function of another story
  • recommended
  • addon-interactions
storybook/csf-component The component property should be set
  • csf
storybook/default-exports Story files should have a default export ๐Ÿ”ง
  • csf
  • recommended
storybook/hierarchy-separator Deprecated hierarchy separator in title property ๐Ÿ”ง
  • csf
  • recommended
storybook/no-redundant-story-name A story should not have a redundant name property ๐Ÿ”ง
  • csf
  • recommended
storybook/no-stories-of storiesOf is deprecated and should not be used
  • csf-strict
storybook/no-title-property-in-meta Do not define a title in meta ๐Ÿ”ง
  • csf-strict
storybook/prefer-pascal-case Stories should use PascalCase ๐Ÿ”ง
  • recommended
storybook/story-exports A story file must contain at least one story export
  • recommended
  • csf
storybook/use-storybook-expect Use expect from @storybook/jest ๐Ÿ”ง
  • addon-interactions
  • recommended
storybook/use-storybook-testing-library Do not use testing-library directly on stories ๐Ÿ”ง
  • addon-interactions
  • recommended

Contributors

Looking into improving this plugin? That would be awesome! Please refer to the contributing guidelines for steps to contributing.

eslint-plugin-storybook's People

Contributors

yannbf avatar shilman avatar aurmer avatar ghengeveld avatar daylennguyen avatar etlovett avatar ianvs avatar kylegach avatar yunchaotsai avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.