eslint-plugin-react-native-animation-linter
raw JSON → 0.1.2 verified Fri May 01 auth: no javascript abandoned
An ESLint plugin that enforces safe management of React Native animations, particularly ensuring animated state variables are properly torn down to prevent memory leaks. Version 0.1.2 is the latest stable release with a single rule `must-tear-down-animations`. The plugin has no active development since its initial release; it supports only older ESLint versions (3.x, 4.x, 5.x) and is not compatible with ESLint 6+.
Common errors
error Error: Failed to load plugin 'react-native-animation-linter': Cannot find module 'eslint-plugin-react-native-animation-linter' ↓
cause The plugin is not installed or not in node_modules.
fix
Run
npm install eslint-plugin-react-native-animation-linter --save-dev error Error: ESLint configuration in .eslintrc.json is invalid: - Configuration for rule "react-native-animation-linter/must-tear-down-animations" is invalid: Value "error" should be number or object. ↓
cause Using string severity 'error' instead of number 2 or 'error' string is not allowed in older ESLint versions? Actually this might be a version issue; but the plugin expects numeric value.
fix
Use numeric severity: {"react-native-animation-linter/must-tear-down-animations": 2}
error Error: Cannot find module 'eslint' ↓
cause ESLint peer dependency is not installed.
fix
Run
npm install eslint@^5.0.0 --save-dev Warnings
gotcha Plugin only supports ESLint versions 3.x, 4.x, and 5.x. It does not work with ESLint 6+ (breaking change in plugin API). ↓
fix Downgrade ESLint to ^5.16.0 or use an alternative plugin that supports newer ESLint versions.
deprecated Only one rule (must-tear-down-animations) exists. No updates since 2018; the plugin is effectively abandoned. ↓
fix Consider forking or implementing custom rules if more coverage is needed.
gotcha Rule 'must-tear-down-animations' may produce false positives for modern React Native animation patterns (e.g., useRef with cleanup). ↓
fix Suppress false positives with inline eslint-disable comments or update code to match the plugin's expectations.
gotcha No shared configuration available. You must manually add the plugin and rules to your ESLint config. ↓
fix Copy the configuration from the README.
Install
npm install eslint-plugin-react-native-animation-linter yarn add eslint-plugin-react-native-animation-linter pnpm add eslint-plugin-react-native-animation-linter Imports
- ESLint Plugin wrong
Attempting to require the plugin directlycorrectAdd to .eslintrc plugins array as 'react-native-animation-linter' and enable rule 'react-native-animation-linter/must-tear-down-animations' - Rule configuration wrong
Using 'plugin:react-native-animation-linter/recommended' (no recommended config exists)correct{ "plugins": ["react-native-animation-linter"], "rules": { "react-native-animation-linter/must-tear-down-animations": 2 } } - Rule import in custom rule wrong
import { rules } from 'eslint-plugin-react-native-animation-linter' (ESM not supported)correctconst mustTearDownAnimations = require('eslint-plugin-react-native-animation-linter').rules['must-tear-down-animations'];
Quickstart
# Install ESLint (must be ^3.17.0 || ^4.0.0 || ^5.0.0)
npm install eslint@^5.16.0
# Install the plugin
npm install eslint-plugin-react-native-animation-linter@0.1.2
# .eslintrc.json
{
"plugins": ["react-native-animation-linter"],
"rules": {
"react-native-animation-linter/must-tear-down-animations": 2
}
}
# Run ESLint on a file
npx eslint App.js