ESLint plugin with rules for React Native Unistyles v3, providing `no-unused-styles` and `sort-styles` rules to detect unused stylesheet definitions and enforce sorted style properties. Current stable version is 3.0.7. The plugin supports both ESLint flat config (ESLint 9+) and legacy config (.eslintrc). Key differentiator: it is specifically tailored for the React Native Unistyles library, covering usage patterns like `createStyleSheet`, `useStyles`, and component detection, including wrapped components (e.g., `memo()`).
npm install eslint-plugin-react-native-unistylesVerified import paths — ran on the pinned version, not inferred.
This example shows how to set up the plugin with ESLint flat config, enabling both rules.
Update ESLint config to use flat config or add 'legacy-' prefix for extends.
Update option name to `ignoreStyleNames` in sort-styles rule configuration.
Add `languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } }` in flat config or `parserOptions: { ecmaFeatures: { jsx: true } }` in legacy config.Use @typescript-eslint/parser and set `languageOptions: { parser: '@typescript-eslint/parser' }` in flat config.Run `yarn add eslint-plugin-react-native-unistyles -D` or `npm install eslint-plugin-react-native-unistyles --save-dev`.
Set `type: 'module'` in package.json or use `.mjs` extension for config file.
Use numeric severity (0, 1, 2) or string severity ('off', 'warn', 'error') correctly depending on ESLint config format.