Skip to content

miqdadfwz/eslint-plugin-loadable-component

Repository files navigation

eslint-plugin-loadable-component

Unofficial lint support for @loadable/component.

Test CI codecov

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-loadable-component:

npm install eslint-plugin-loadable-component --save-dev

Or, with yarn:

yarn add -D eslint-plugin-loadable-component

Usage

Note: This plugin doesn't have "recommended" rule set at the moment. We are currently still considering of the right rules to be the recommended default set. Please make sure to enable rules based on your needs.

To get started, add loadable-component to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["loadable-component"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "loadable-component/no-empty-fallback": "warn",
    "loadable-component/no-full-dynamic-import": "error",
    "loadable-component/no-other-loadable-identifier": "error"
  }
}

Rules

Name Type Docs
no-empty-fallback Best Practices Link
no-full-dynamic-import Best Practices Link
no-other-loadable-idenfier Possible Error Link

Disabling Rule

You can disable certain rule by using ESLint directive syntax to hint ESLint to disable in specific line or entire file. You can find a list of ESLint directives here.

// eslint-disable-next-line no-empty-fallback
loadable(() => import('./foo.js'));

License

MIT