Back to React Three Fiber

@react-three/eslint-plugin

packages/eslint-plugin/README.md

9.6.13.1 KB
Original Source

@react-three/eslint-plugin

An ESLint plugin which provides lint rules for @react-three/fiber.

Installation

bash
npm install @react-three/eslint-plugin --save-dev

Configuration

Use the recommended config to get reasonable defaults:

json
"extends": [
  "plugin:@react-three/recommended"
]

If you do not use a config you will need to specify individual rules and add extra configuration.

Add "@react-three" to the plugins section.

json
"plugins": [
  "@react-three"
]

Enable the rules that you would like to use.

json
"rules": {
  "@react-three/no-clone-in-frame-loop": "error"
}

Rules

✅ Enabled in the recommended configuration.

🔧 Automatically fixable by the --fix CLI option.

💡 Manually fixable by editor suggestions.

<!-- START_RULE_CODEGEN --> <!-- @command yarn codegen:eslint -->
RuleDescription🔧💡
<a href="./docs/rules/no-clone-in-loop.md">no-clone-in-loop</a>Disallow cloning vectors in the frame loop which can cause performance problems.
<a href="./docs/rules/no-new-in-loop.md">no-new-in-loop</a>Disallow instantiating new objects in the frame loop which can cause performance problems.
<!-- END_CODEGEN -->

Shareable configs

This plugin exports a recommended configuration that enforces rules appropriate for everyone using React Three Fiber.

json
"extends": [
  "plugin:@react-three/recommended"
]

All

This plugin also exports an all configuration that includes every available rule.

json
"extends": [
  "plugin:@react-three/all"
]