eslint-plugin-react-features 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/LICENSE +23 -0
- package/README.md +155 -0
- package/package.json +65 -0
- package/src/index.d.ts +1093 -0
- package/src/index.js +212 -0
- package/src/rules/migration/react-class-to-hooks.d.ts +22 -0
- package/src/rules/migration/react-class-to-hooks.js +178 -0
- package/src/rules/performance/no-unnecessary-rerenders.d.ts +26 -0
- package/src/rules/performance/no-unnecessary-rerenders.js +212 -0
- package/src/rules/performance/react-no-inline-functions.d.ts +24 -0
- package/src/rules/performance/react-no-inline-functions.js +211 -0
- package/src/rules/performance/react-render-optimization.d.ts +31 -0
- package/src/rules/performance/react-render-optimization.js +294 -0
- package/src/rules/react/checked-requires-onchange-or-readonly.d.ts +16 -0
- package/src/rules/react/checked-requires-onchange-or-readonly.js +74 -0
- package/src/rules/react/default-props-match-prop-types.d.ts +13 -0
- package/src/rules/react/default-props-match-prop-types.js +119 -0
- package/src/rules/react/display-name.d.ts +13 -0
- package/src/rules/react/display-name.js +164 -0
- package/src/rules/react/hooks-exhaustive-deps.d.ts +25 -0
- package/src/rules/react/hooks-exhaustive-deps.js +466 -0
- package/src/rules/react/jsx-handler-names.d.ts +13 -0
- package/src/rules/react/jsx-handler-names.js +57 -0
- package/src/rules/react/jsx-key.d.ts +20 -0
- package/src/rules/react/jsx-key.js +421 -0
- package/src/rules/react/jsx-max-depth.d.ts +19 -0
- package/src/rules/react/jsx-max-depth.js +80 -0
- package/src/rules/react/jsx-no-bind.d.ts +13 -0
- package/src/rules/react/jsx-no-bind.js +64 -0
- package/src/rules/react/jsx-no-duplicate-props.d.ts +21 -0
- package/src/rules/react/jsx-no-duplicate-props.js +70 -0
- package/src/rules/react/jsx-no-literals.d.ts +20 -0
- package/src/rules/react/jsx-no-literals.js +83 -0
- package/src/rules/react/jsx-no-script-url.d.ts +25 -0
- package/src/rules/react/jsx-no-script-url.js +131 -0
- package/src/rules/react/jsx-no-target-blank.d.ts +26 -0
- package/src/rules/react/jsx-no-target-blank.js +176 -0
- package/src/rules/react/no-access-state-in-setstate.d.ts +13 -0
- package/src/rules/react/no-access-state-in-setstate.js +92 -0
- package/src/rules/react/no-adjacent-inline-elements.d.ts +13 -0
- package/src/rules/react/no-adjacent-inline-elements.js +81 -0
- package/src/rules/react/no-arrow-function-lifecycle.d.ts +13 -0
- package/src/rules/react/no-arrow-function-lifecycle.js +63 -0
- package/src/rules/react/no-children-prop.d.ts +13 -0
- package/src/rules/react/no-children-prop.js +60 -0
- package/src/rules/react/no-danger-with-children.d.ts +16 -0
- package/src/rules/react/no-danger-with-children.js +110 -0
- package/src/rules/react/no-danger.d.ts +13 -0
- package/src/rules/react/no-danger.js +45 -0
- package/src/rules/react/no-deprecated.d.ts +16 -0
- package/src/rules/react/no-deprecated.js +140 -0
- package/src/rules/react/no-did-mount-set-state.d.ts +13 -0
- package/src/rules/react/no-did-mount-set-state.js +55 -0
- package/src/rules/react/no-did-update-set-state.d.ts +19 -0
- package/src/rules/react/no-did-update-set-state.js +80 -0
- package/src/rules/react/no-direct-mutation-state.d.ts +20 -0
- package/src/rules/react/no-direct-mutation-state.js +277 -0
- package/src/rules/react/no-find-dom-node.d.ts +15 -0
- package/src/rules/react/no-find-dom-node.js +56 -0
- package/src/rules/react/no-invalid-html-attribute.d.ts +13 -0
- package/src/rules/react/no-invalid-html-attribute.js +84 -0
- package/src/rules/react/no-is-mounted.d.ts +13 -0
- package/src/rules/react/no-is-mounted.js +52 -0
- package/src/rules/react/no-multi-comp.d.ts +18 -0
- package/src/rules/react/no-multi-comp.js +160 -0
- package/src/rules/react/no-namespace.d.ts +13 -0
- package/src/rules/react/no-namespace.js +41 -0
- package/src/rules/react/no-object-type-as-default-prop.d.ts +13 -0
- package/src/rules/react/no-object-type-as-default-prop.js +61 -0
- package/src/rules/react/no-redundant-should-component-update.d.ts +13 -0
- package/src/rules/react/no-redundant-should-component-update.js +55 -0
- package/src/rules/react/no-render-return-value.d.ts +13 -0
- package/src/rules/react/no-render-return-value.js +74 -0
- package/src/rules/react/no-set-state.d.ts +13 -0
- package/src/rules/react/no-set-state.js +50 -0
- package/src/rules/react/no-string-refs.d.ts +13 -0
- package/src/rules/react/no-string-refs.js +68 -0
- package/src/rules/react/no-this-in-sfc.d.ts +13 -0
- package/src/rules/react/no-this-in-sfc.js +65 -0
- package/src/rules/react/no-typos.d.ts +13 -0
- package/src/rules/react/no-typos.js +97 -0
- package/src/rules/react/no-unescaped-entities.d.ts +13 -0
- package/src/rules/react/no-unescaped-entities.js +50 -0
- package/src/rules/react/no-unknown-property.d.ts +13 -0
- package/src/rules/react/no-unknown-property.js +130 -0
- package/src/rules/react/no-unsafe.d.ts +20 -0
- package/src/rules/react/no-unsafe.js +112 -0
- package/src/rules/react/prefer-es6-class.d.ts +13 -0
- package/src/rules/react/prefer-es6-class.js +56 -0
- package/src/rules/react/prefer-stateless-function.d.ts +16 -0
- package/src/rules/react/prefer-stateless-function.js +134 -0
- package/src/rules/react/prop-types.d.ts +18 -0
- package/src/rules/react/prop-types.js +153 -0
- package/src/rules/react/react-in-jsx-scope.d.ts +13 -0
- package/src/rules/react/react-in-jsx-scope.js +94 -0
- package/src/rules/react/require-default-props.d.ts +16 -0
- package/src/rules/react/require-default-props.js +146 -0
- package/src/rules/react/require-optimization.d.ts +26 -0
- package/src/rules/react/require-optimization.js +436 -0
- package/src/rules/react/require-render-return.d.ts +13 -0
- package/src/rules/react/require-render-return.js +87 -0
- package/src/rules/react/required-attributes.d.ts +28 -0
- package/src/rules/react/required-attributes.js +212 -0
- package/src/rules/react/sort-comp.d.ts +17 -0
- package/src/rules/react/sort-comp.js +160 -0
- package/src/rules/react/state-in-constructor.d.ts +13 -0
- package/src/rules/react/state-in-constructor.js +103 -0
- package/src/rules/react/static-property-placement.d.ts +20 -0
- package/src/rules/react/static-property-placement.js +166 -0
- package/src/rules/react/void-dom-elements-no-children.d.ts +15 -0
- package/src/rules/react/void-dom-elements-no-children.js +94 -0
- package/src/types/index.d.ts +54 -0
- package/src/types/index.js +7 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `eslint-plugin-react-features` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Documentation
|
|
11
|
+
|
|
12
|
+
- 📘 Launched new documentation site: [eslint.interlace.tools](https://eslint.interlace.tools/)
|
|
13
|
+
- 📝 Achieved 100% documentation parity (both .md and .mdx files)
|
|
14
|
+
|
|
15
|
+
## [1.0.0] - 2026-01-26
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Initial stable release with 53 React rules
|
|
20
|
+
- 1,190+ test cases covering edge cases and TypeScript integration
|
|
21
|
+
- LLM-optimized error messages for AI-assisted development
|
|
22
|
+
- ESLint 9 flat config support
|
|
23
|
+
- TypeScript type definitions for all rule options
|
|
24
|
+
|
|
25
|
+
### Rule Categories
|
|
26
|
+
|
|
27
|
+
#### Migration Rules (React 17→18)
|
|
28
|
+
|
|
29
|
+
- `jsx-no-target-blank` - Require rel="noopener" on target="\_blank" links
|
|
30
|
+
- `jsx-no-script-url` - Disallow javascript: URLs in JSX
|
|
31
|
+
- `jsx-no-duplicate-props` - Disallow duplicate props
|
|
32
|
+
- `no-danger-with-children` - Disallow children with dangerouslySetInnerHTML
|
|
33
|
+
- `no-deprecated` - Disallow deprecated React APIs
|
|
34
|
+
- `no-find-dom-node` - Disallow findDOMNode
|
|
35
|
+
- `no-unsafe` - Disallow UNSAFE\_ lifecycle methods
|
|
36
|
+
- `void-dom-elements-no-children` - Disallow children in void DOM elements
|
|
37
|
+
|
|
38
|
+
#### Performance Rules
|
|
39
|
+
|
|
40
|
+
- `no-inline-handlers` - Disallow inline function handlers (re-render prevention)
|
|
41
|
+
- `no-object-style-literals` - Disallow object literals in style prop
|
|
42
|
+
- `require-memo` - Require React.memo for pure components
|
|
43
|
+
- `require-usecallback` - Require useCallback for function props
|
|
44
|
+
- `require-usememo` - Require useMemo for expensive computations
|
|
45
|
+
|
|
46
|
+
#### Core React Rules
|
|
47
|
+
|
|
48
|
+
- Hooks rules: exhaustive-deps, rules-of-hooks compliance
|
|
49
|
+
- Component patterns: naming, structure, composition
|
|
50
|
+
- State management: useState, useReducer patterns
|
|
51
|
+
|
|
52
|
+
### Presets
|
|
53
|
+
|
|
54
|
+
- `recommended` - Balanced React best practices
|
|
55
|
+
- `strict` - All rules as errors
|
|
56
|
+
- `performance` - Performance-focused subset
|
|
57
|
+
- `migration` - React upgrade assistance
|
|
58
|
+
|
|
59
|
+
### ⚠️ Breaking from 0.x
|
|
60
|
+
|
|
61
|
+
- Removed deprecated rules (now in `react-a11y`)
|
|
62
|
+
- Renamed: `react-perf/no-jsx-bind` → `performance/no-inline-handlers`
|
|
63
|
+
|
|
64
|
+
### Known Limitations
|
|
65
|
+
|
|
66
|
+
Documented in `docs/KNOWN-LIMITATIONS.md`:
|
|
67
|
+
|
|
68
|
+
- `jsx-no-target-blank`: Dynamic `href` variables not detected
|
|
69
|
+
- `jsx-no-script-url`: Obfuscated patterns in variables not detected
|
|
70
|
+
- Spread props (`{...props}`) prevent static attribute analysis
|
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ofri Peretz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://eslint.interlace.tools" target="blank"><img src="https://eslint.interlace.tools/eslint-interlace-logo-light.svg" alt="ESLint Interlace Logo" width="120" /></a>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
Advanced React patterns, hook usage, and best practices enforcement.
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/eslint-plugin-react-features" target="_blank"><img src="https://img.shields.io/npm/v/eslint-plugin-react-features.svg" alt="NPM Version" /></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/eslint-plugin-react-features" target="_blank"><img src="https://img.shields.io/npm/dm/eslint-plugin-react-features.svg" alt="NPM Downloads" /></a>
|
|
12
|
+
<a href="https://opensource.org/licenses/MIT" target="_blank"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="Package License" /></a>
|
|
13
|
+
<a href="https://app.codecov.io/gh/ofri-peretz/eslint/components?components%5B0%5D=react-features" target="_blank"><img src="https://codecov.io/gh/ofri-peretz/eslint/graph/badge.svg?component=react-features" alt="Codecov" /></a>
|
|
14
|
+
<a href="https://github.com/ofri-peretz/eslint" target="_blank"><img src="https://img.shields.io/badge/Since-Dec_2025-blue?logo=rocket&logoColor=white" alt="Since Dec 2025" /></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
## Description
|
|
18
|
+
|
|
19
|
+
This plugin optimizes your React development by enforcing advanced patterns, proper hook usage, and industry best practices. It identifies inefficient rendering, improper state management, and potential memory leaks, ensuring your application runs smoothly. By following these guidelines, you can write more robust and performant React code that aligns with the specialized features of the framework.
|
|
20
|
+
|
|
21
|
+
## Philosophy
|
|
22
|
+
|
|
23
|
+
**Interlace** fosters **strength through integration**. We **interlace** React best practices directly into your workflow, catching bugs and performance issues before they ship. Tools should **guide rather than gatekeep**, providing educational feedback that strengthens developers.
|
|
24
|
+
|
|
25
|
+
**Why an independent ecosystem?** 🚀 Ship fast without upstream bureaucracy • 🤖 AI-optimized messages (severity, fixes) • ⚡ Unified codebase for performance • 🏗️ Consistent patterns across all plugins • 📚 Educational "why" explanations
|
|
26
|
+
|
|
27
|
+
All rules are **clean-room implementations** following `eslint-plugin-react` naming conventions — familiar API, better engineering.
|
|
28
|
+
|
|
29
|
+
## Getting Started
|
|
30
|
+
|
|
31
|
+
- To check out the [guide](https://eslint.interlace.tools/docs/react-features), visit [eslint.interlace.tools](https://eslint.interlace.tools). 📚
|
|
32
|
+
- 要查看中文 [指南](https://eslint.interlace.tools/docs/react-features), 请访问 [eslint.interlace.tools](https://eslint.interlace.tools). 📚
|
|
33
|
+
- [가이드](https://eslint.interlace.tools/docs/react-features) 문서는 [eslint.interlace.tools](https://eslint.interlace.tools)에서 확인하실 수 있습니다. 📚
|
|
34
|
+
- [ガイド](https://eslint.interlace.tools/docs/react-features)は [eslint.interlace.tools](https://eslint.interlace.tools)でご確認ください。 📚
|
|
35
|
+
- Para ver la [guía](https://eslint.interlace.tools/docs/react-features), visita [eslint.interlace.tools](https://eslint.interlace.tools). 📚
|
|
36
|
+
- للاطلاع على [الدليل](https://eslint.interlace.tools/docs/react-features)، قم بزيارة [eslint.interlace.tools](https://eslint.interlace.tools). 📚
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install eslint-plugin-react-features --save-dev
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## ⚙️ Configuration Presets
|
|
43
|
+
|
|
44
|
+
| Preset | Description |
|
|
45
|
+
| :------------ | :----------------------------------------------- |
|
|
46
|
+
| `recommended` | Recommended React patterns and performance rules |
|
|
47
|
+
|
|
48
|
+
## Rules
|
|
49
|
+
|
|
50
|
+
**Legend**
|
|
51
|
+
|
|
52
|
+
| Icon | Description |
|
|
53
|
+
| :--: | :----------------------------------------------------------------- |
|
|
54
|
+
| 💼 | **Recommended**: Included in the recommended preset. |
|
|
55
|
+
| ⚠️ | **Warns**: Set to warn in recommended preset. |
|
|
56
|
+
| 🔧 | **Auto-fixable**: Automatically fixable by the `--fix` CLI option. |
|
|
57
|
+
| 💡 | **Suggestions**: Providing code suggestions in IDE. |
|
|
58
|
+
|
|
59
|
+
| Rule | Description | 💼 | ⚠️ | 🔧 |
|
|
60
|
+
| :-------------------------------------- | :------------------------------------------------------ | :-: | :-: | :-: |
|
|
61
|
+
| `jsx-key` | React: Detect missing key props in iterators | 💼 | | |
|
|
62
|
+
| `no-direct-mutation-state` | React: Prevent direct state mutation | 💼 | | |
|
|
63
|
+
| `no-children-prop` | React: Disallow passing children as prop | 💼 | | |
|
|
64
|
+
| `no-string-refs` | React: Disallow string refs | 💼 | | |
|
|
65
|
+
| `no-unknown-property` | React: Detect unknown DOM properties | 💼 | | 🔧 |
|
|
66
|
+
| `no-unescaped-entities` | React: Disallow unescaped entities in JSX | 💼 | | |
|
|
67
|
+
| `display-name` | React: Require displayName for components | | ⚠️ | |
|
|
68
|
+
| `no-this-in-sfc` | React: Disallow `this` in stateless components | 💼 | | |
|
|
69
|
+
| `no-access-state-in-setstate` | React: Prevent using this.state in setState | 💼 | | |
|
|
70
|
+
| `no-render-return-value` | React: Prevent using ReactDOM.render return value | 💼 | | |
|
|
71
|
+
| `require-render-return` | React: Require return in render method | 💼 | | |
|
|
72
|
+
| `react-in-jsx-scope` | React: Require React in scope (pre-17) | | | |
|
|
73
|
+
| `jsx-no-target-blank` | Security: Require rel="noopener" with target="\_blank" | 💼 | | |
|
|
74
|
+
| `jsx-no-script-url` | Security: Disallow javascript: URLs | 💼 | | |
|
|
75
|
+
| `jsx-no-duplicate-props` | Security: Prevent duplicate props | 💼 | | |
|
|
76
|
+
| `no-danger` | Security: Disallow dangerouslySetInnerHTML | 💼 | | |
|
|
77
|
+
| `no-danger-with-children` | Security: Prevent dangerouslySetInnerHTML with children | 💼 | | |
|
|
78
|
+
| `hooks-exhaustive-deps` | Hooks: Check effect dependencies | 💼 | | 🔧 |
|
|
79
|
+
| `jsx-no-bind` | Performance: Disallow .bind() in JSX props | | ⚠️ | |
|
|
80
|
+
| `no-unnecessary-rerenders` | Performance: Detect patterns causing rerenders | 💼 | | |
|
|
81
|
+
| `react-render-optimization` | Performance: Suggest render optimizations | 💼 | | |
|
|
82
|
+
| `react-no-inline-functions` | Performance: Disallow inline functions in JSX | | ⚠️ | |
|
|
83
|
+
| `require-optimization` | Performance: Enforce shouldComponentUpdate | | ⚠️ | |
|
|
84
|
+
| `no-object-type-as-default-prop` | Performance: Prevent object/array as default prop | | ⚠️ | |
|
|
85
|
+
| `no-did-mount-set-state` | Class: Disallow setState in componentDidMount | | ⚠️ | |
|
|
86
|
+
| `no-did-update-set-state` | Class: Disallow setState in componentDidUpdate | | ⚠️ | |
|
|
87
|
+
| `no-set-state` | Class: Disallow setState usage | | | |
|
|
88
|
+
| `prefer-es6-class` | Class: Enforce ES6 class for components | | ⚠️ | |
|
|
89
|
+
| `prefer-stateless-function` | Class: Suggest stateless functions when possible | | ⚠️ | |
|
|
90
|
+
| `no-redundant-should-component-update` | Class: Prevent useless shouldComponentUpdate | 💼 | | |
|
|
91
|
+
| `no-arrow-function-lifecycle` | Class: Disallow arrow functions for lifecycle | | ⚠️ | |
|
|
92
|
+
| `sort-comp` | Class: Enforce component method order | | | |
|
|
93
|
+
| `state-in-constructor` | Class: Enforce state initialization in constructor | | | |
|
|
94
|
+
| `static-property-placement` | Class: Enforce static property placement | | | |
|
|
95
|
+
| `no-deprecated` | Deprecated: Warn about deprecated React APIs | | ⚠️ | |
|
|
96
|
+
| `no-find-dom-node` | Deprecated: Disallow findDOMNode | 💼 | | |
|
|
97
|
+
| `no-is-mounted` | Deprecated: Disallow isMounted usage | 💼 | | |
|
|
98
|
+
| `no-unsafe` | Deprecated: Disallow UNSAFE\_ lifecycle methods | | ⚠️ | |
|
|
99
|
+
| `void-dom-elements-no-children` | Deprecated: Prevent void elements with children | 💼 | | |
|
|
100
|
+
| `jsx-handler-names` | JSX: Enforce event handler naming conventions | | | |
|
|
101
|
+
| `jsx-max-depth` | JSX: Enforce maximum JSX nesting depth | | | |
|
|
102
|
+
| `jsx-no-literals` | JSX: Disallow string literals in JSX | | | |
|
|
103
|
+
| `no-namespace` | JSX: Disallow namespace in JSX | | ⚠️ | |
|
|
104
|
+
| `no-adjacent-inline-elements` | JSX: Prevent adjacent inline elements | | | |
|
|
105
|
+
| `no-invalid-html-attribute` | JSX: Disallow invalid HTML attributes | | ⚠️ | |
|
|
106
|
+
| `prop-types` | Props: Validate prop types | | | |
|
|
107
|
+
| `require-default-props` | Props: Require default props for optional props | | | |
|
|
108
|
+
| `default-props-match-prop-types` | Props: Ensure defaultProps match propTypes | | ⚠️ | |
|
|
109
|
+
| `checked-requires-onchange-or-readonly` | Props: Require onChange or readOnly with checked | 💼 | | |
|
|
110
|
+
| `no-typos` | Props: Prevent common typos in properties | 💼 | | |
|
|
111
|
+
| `no-multi-comp` | Props: Prevent multiple components per file | | | |
|
|
112
|
+
| `react-class-to-hooks` | Migration: Assist class to hooks migration | | | 💡 |
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## AI-Optimized Messages
|
|
117
|
+
|
|
118
|
+
This plugin is optimized for ESLint's [Model Context Protocol (MCP)](https://eslint.org/docs/latest/use/mcp), enabling AI assistants like **Cursor**, **GitHub Copilot**, and **Claude** to:
|
|
119
|
+
|
|
120
|
+
- Understand the exact vulnerability type via CWE references
|
|
121
|
+
- Apply the correct fix using structured guidance
|
|
122
|
+
- Provide educational context to developers
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
// .cursor/mcp.json
|
|
126
|
+
{
|
|
127
|
+
"mcpServers": {
|
|
128
|
+
"eslint": {
|
|
129
|
+
"command": "npx",
|
|
130
|
+
"args": ["@eslint/mcp@latest"]
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## 🔗 Related ESLint Plugins
|
|
139
|
+
|
|
140
|
+
Part of the **Interlace ESLint Ecosystem** — AI-native plugins with LLM-optimized error messages:
|
|
141
|
+
|
|
142
|
+
| Plugin | Downloads | Description |
|
|
143
|
+
| :----------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------- |
|
|
144
|
+
| [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | [](https://www.npmjs.com/package/eslint-plugin-secure-coding) | General security rules & OWASP guidelines. |
|
|
145
|
+
| [`eslint-plugin-react-a11y`](https://www.npmjs.com/package/eslint-plugin-react-a11y) | [](https://www.npmjs.com/package/eslint-plugin-react-a11y) | React accessibility & WCAG compliance. |
|
|
146
|
+
| [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) | [](https://www.npmjs.com/package/eslint-plugin-crypto) | NodeJS Cryptography security rules. |
|
|
147
|
+
| [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | [](https://www.npmjs.com/package/eslint-plugin-jwt) | JWT security & best practices. |
|
|
148
|
+
|
|
149
|
+
## 📄 License
|
|
150
|
+
|
|
151
|
+
MIT © [Ofri Peretz](https://github.com/ofri-peretz)
|
|
152
|
+
|
|
153
|
+
<p align="center">
|
|
154
|
+
<a href="https://eslint.interlace.tools/docs/react-features"><img src="https://eslint.interlace.tools/images/og-react-features.png" alt="ESLint Interlace Plugin" width="300" /></a>
|
|
155
|
+
</p>
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eslint-plugin-react-features",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "ESLint React rules for modern react features, hooks, and patterns.",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"main": "./src/index.js",
|
|
7
|
+
"types": "./src/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./src/index.d.ts",
|
|
11
|
+
"default": "./src/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./types": {
|
|
14
|
+
"types": "./src/types/index.d.ts",
|
|
15
|
+
"default": "./src/types/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"author": "Ofri Peretz <ofriperetzdev@gmail.com>",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"src/",
|
|
25
|
+
"dist/",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"CHANGELOG.md"
|
|
29
|
+
],
|
|
30
|
+
"keywords": [
|
|
31
|
+
"eslint",
|
|
32
|
+
"eslint-plugin",
|
|
33
|
+
"interlace-quality",
|
|
34
|
+
"react",
|
|
35
|
+
"jsx",
|
|
36
|
+
"hooks",
|
|
37
|
+
"llm-optimized"
|
|
38
|
+
],
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=18.0.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {},
|
|
43
|
+
"peerDependenciesMeta": {
|
|
44
|
+
"typescript": {
|
|
45
|
+
"optional": true
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"tslib": "^2.3.0",
|
|
50
|
+
"@interlace/eslint-devkit": "*"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@typescript-eslint/parser": "^8.46.2",
|
|
54
|
+
"@typescript-eslint/rule-tester": "^8.46.2"
|
|
55
|
+
},
|
|
56
|
+
"repository": {
|
|
57
|
+
"type": "git",
|
|
58
|
+
"url": "https://github.com/ofri-peretz/eslint",
|
|
59
|
+
"directory": "packages/eslint-plugin-react-features"
|
|
60
|
+
},
|
|
61
|
+
"homepage": "https://github.com/ofri-peretz/eslint/tree/main/packages/eslint-plugin-react-features#readme",
|
|
62
|
+
"bugs": {
|
|
63
|
+
"url": "https://github.com/ofri-peretz/eslint/issues"
|
|
64
|
+
}
|
|
65
|
+
}
|