0.0.1 • Published 4 months ago

@t1m0fe1/eslint-plugin-reanimated v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@t1m0fe1/eslint-plugin-reanimated

forked from eslint-plugin-reanimated v2.0.1 as the original repository seems no longer maintained.

npm version Downloads Build Status

The goal of this plugin is to help you when writing animation worklets with Reanimated.

💿 Install & Usage

npm install --save-dev @t1m0fe1/eslint-plugin-reanimated

eslint.config.js (requires eslint>=v8.23.0)

const reanimatedPlugin = require("@t1m0fe1/eslint-plugin-reanimated");

module.exports = [
  reanimatedPlugin.configs["flat/recommended"],
  {
    rules: {
      "reanimated/js-function-in-worklet": "error",
    }
  }
]

To setup without the recommended configs, you'll need to add the plugin:

const reanimatedPlugin = require("@t1m0fe1/eslint-plugin-reanimated");

module.exports = [
  {
    plugins: {
      reanimated: reanimatedPlugin,
    },
    rules: {
      "reanimated/js-function-in-worklet": "error",
    }
  }
]

.eslintrc.json (legacy example)

{
  "extends": ["plugin:reanimated/recommended"],
  "rules": {
    "reanimated/js-function-in-worklet": "error"
  }
}

To setup without the recommended rules you'll need to add the plugin:

{
  "plugins": ["reanimated"],
  "rules": {
    "reanimated/js-function-in-worklet": "error"
  }
}

📖 Rules

🔧 Automatically fixable by the --fix CLI option.\ 💡 Manually fixable by editor suggestions.

Name                             Description🔧💡
js-thread-on-ui-threadDetects JavaScript thread functions being called directly on the UI thread in react-native-reanimated or extended libraries.🔧💡
no-multiple-animated-style-usagesAnimated styles cannot be used multiple times. Call useAnimatedStyle() multiple times instead.
unsupported-syntaxSome syntaxes are not a supported within a worklet.

🔧 Configs

Name
recommended/flat