eslint-plugin-react-features 1.4.0 → 1.6.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/README.md +55 -58
- package/package.json +2 -2
- package/src/index.js +1 -1
- package/src/rules/component-api/no-arbitrary-token-class.js +1 -1
- package/src/rules/component-api/no-inline-style.js +1 -1
- package/src/rules/react/hooks-exhaustive-deps.js +1 -1
- package/src/rules/react/jsx-no-literals.js +1 -1
- package/src/rules/react/jsx-no-script-url.js +1 -1
- package/src/rules/react/jsx-no-target-blank.js +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features" target="blank"><img src="https://eslint.interlace.tools/logos/interlace.svg" alt="Interlace" height="90" /></a>
|
|
2
|
+
<a href="https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features" target="blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://eslint.interlace.tools/logos/interlace-dark.svg"><img src="https://eslint.interlace.tools/logos/interlace-light.svg" alt="Interlace" height="90" /></picture></a>
|
|
3
3
|
|
|
4
4
|
<a href="https://react.dev" target="_blank"><img src="https://eslint.interlace.tools/logos/react.svg" alt="React" height="90" /></a>
|
|
5
5
|
|
|
6
|
-
<a href="https://oxc.rs" target="_blank"><img src="https://eslint.interlace.tools/logos/oxlint.svg" alt="oxlint" height="90" /></a>
|
|
6
|
+
<a href="https://oxc.rs" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://eslint.interlace.tools/logos/oxlint-dark.svg"><img src="https://eslint.interlace.tools/logos/oxlint-light.svg" alt="oxlint" height="90" /></picture></a>
|
|
7
7
|
|
|
8
|
-
<a href="https://eslint.org" target="_blank"><img src="https://eslint.interlace.tools/logos/eslint.svg" alt="ESLint" height="90" /></a>
|
|
8
|
+
<a href="https://eslint.org" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://eslint.interlace.tools/logos/eslint-dark.svg"><img src="https://eslint.interlace.tools/logos/eslint-light.svg" alt="ESLint" height="90" /></picture></a>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
@@ -27,57 +27,25 @@
|
|
|
27
27
|
|
|
28
28
|
This plugin provides Advanced React patterns, hook usage, and best practices enforcement.
|
|
29
29
|
|
|
30
|
-
## Philosophy
|
|
31
|
-
|
|
32
|
-
**Interlace** fosters **strength through integration**. Instead of stacking isolated rules, we **interlace** security directly into your workflow to create a resilient fabric of code. We believe tools should **guide rather than gatekeep**, providing educational feedback that strengthens the developer with every interaction.
|
|
33
|
-
|
|
34
30
|
<!-- AUTO-GENERATED:DOCTRINE:START - Do not edit manually -->
|
|
35
31
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
That is a trade, and it is made deliberately. It costs recall, and we measure what it
|
|
44
|
-
costs rather than assuming it is free.
|
|
45
|
-
|
|
46
|
-
## How the rules decide
|
|
47
|
-
|
|
48
|
-
**Evidence, not names.** A rule fires on what the code *does*, resolved through the
|
|
49
|
-
AST and ESLint's own scope analysis — not on an identifier that happens to contain
|
|
50
|
-
`query`, a method called `setItem`, or a file whose path contains `key`. Every one of
|
|
51
|
-
those was a real false positive in this ecosystem, found by reading our own output on
|
|
52
|
-
open-source projects and fixed with a test that fails on the unfixed rule.
|
|
53
|
-
|
|
54
|
-
Where a rule has known false-positive shapes, its page carries a **Not a finding**
|
|
55
|
-
section: what it deliberately stays quiet on, and what to check first when it fires
|
|
56
|
-
and you disagree.
|
|
57
|
-
|
|
58
|
-
## What you get
|
|
32
|
+
- **Why** — a linter nobody reads protects nothing. We would rather miss a finding
|
|
33
|
+
than spend your attention on one that was never real.
|
|
34
|
+
- **How** — evidence, not names. A rule fires on what the code *does*, resolved
|
|
35
|
+
through the AST and ESLint's own scope analysis.
|
|
36
|
+
- **What** — every finding carries its fix, in prose for a human and as structured
|
|
37
|
+
JSON for an agent. Security rules add a CWE mapping and, where assigned, a CVSS score.
|
|
59
38
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
[open an issue](https://github.com/ofri-peretz/eslint/issues) — a false positive is a
|
|
65
|
-
bug here, not a tuning exercise for you.
|
|
66
|
-
|
|
67
|
-
How that is measured, on which projects, and where it falls short:
|
|
68
|
-
[benchmark methodology](https://github.com/ofri-peretz/eslint/blob/main/BENCHMARK-METHODOLOGY.md)
|
|
69
|
-
and [results](https://github.com/ofri-peretz/eslint/blob/main/BENCHMARK-RESULTS.md).
|
|
39
|
+
That trade costs recall, and we measure it:
|
|
40
|
+
[methodology](https://github.com/ofri-peretz/eslint/blob/main/BENCHMARK-METHODOLOGY.md)
|
|
41
|
+
· [results](https://github.com/ofri-peretz/eslint/blob/main/BENCHMARK-RESULTS.md)
|
|
42
|
+
· [a false positive is a bug](https://github.com/ofri-peretz/eslint/issues).
|
|
70
43
|
|
|
71
44
|
<!-- AUTO-GENERATED:DOCTRINE:END -->
|
|
72
45
|
|
|
73
46
|
## Getting Started
|
|
74
47
|
|
|
75
48
|
- To check out the [guide](https://eslint.interlace.tools/docs/quality/plugin-react-features?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features), visit [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features). 📚
|
|
76
|
-
- 要查看中文 [指南](https://eslint.interlace.tools/docs/quality/plugin-react-features?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features), 请访问 [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features). 📚
|
|
77
|
-
- [가이드](https://eslint.interlace.tools/docs/quality/plugin-react-features?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features) 문서는 [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features)에서 확인하실 수 있습니다. 📚
|
|
78
|
-
- [ガイド](https://eslint.interlace.tools/docs/quality/plugin-react-features?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features)は [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features)でご確認ください。 📚
|
|
79
|
-
- Para ver la [guía](https://eslint.interlace.tools/docs/quality/plugin-react-features?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features), visita [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features). 📚
|
|
80
|
-
- للاطلاع على [الدليل](https://eslint.interlace.tools/docs/quality/plugin-react-features?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features)، قم بزيارة [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features). 📚
|
|
81
49
|
|
|
82
50
|
```bash
|
|
83
51
|
npm install eslint-plugin-react-features --save-dev
|
|
@@ -176,23 +144,52 @@ See the [ESLint Version Support Policy](../../docs/ESLINT_VERSION_SUPPORT.md)
|
|
|
176
144
|
| [static-property-placement](https://eslint.interlace.tools/docs/quality/plugin-react-features/rules/static-property-placement?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features) | | | | static-property-placement rule | 🟢 | | | | 💡 | |
|
|
177
145
|
| [void-dom-elements-no-children](https://eslint.interlace.tools/docs/quality/plugin-react-features/rules/void-dom-elements-no-children?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features) | | | | Prevent void DOM elements from receiving children. This rule is part of eslint-plugin-react-features and pr… | 🟢 | | | | 💡 | |
|
|
178
146
|
<!-- AUTO-GENERATED:RULES_TABLE:END -->
|
|
147
|
+
<!-- AUTO-GENERATED:ECOSYSTEM_TABLE:START - Do not edit manually -->
|
|
148
|
+
|
|
179
149
|
## 🔗 Related ESLint Plugins
|
|
180
150
|
|
|
181
|
-
Part of the **Interlace ESLint
|
|
151
|
+
Part of the **Interlace ESLint ecosystem** — AI-native rules with LLM-optimized error messages:
|
|
152
|
+
|
|
153
|
+
**Security**
|
|
182
154
|
|
|
183
155
|
| Plugin | Downloads | Description |
|
|
184
156
|
| :--- | :---: | :--- |
|
|
185
|
-
| [`eslint-plugin-
|
|
186
|
-
| [`eslint-plugin-
|
|
187
|
-
| [`eslint-plugin-
|
|
188
|
-
| [`eslint-plugin-
|
|
189
|
-
| [`eslint-plugin-
|
|
190
|
-
| [`eslint-plugin-
|
|
191
|
-
| [`eslint-plugin-
|
|
192
|
-
| [`eslint-plugin-
|
|
193
|
-
| [`eslint-plugin-
|
|
194
|
-
| [`eslint-plugin-
|
|
195
|
-
| [`eslint-plugin-
|
|
157
|
+
| [`eslint-plugin-anthropic-security`](https://www.npmjs.com/package/eslint-plugin-anthropic-security) | [](https://www.npmjs.com/package/eslint-plugin-anthropic-security) | Anthropic SDK security. |
|
|
158
|
+
| [`eslint-plugin-browser-security`](https://www.npmjs.com/package/eslint-plugin-browser-security) | [](https://www.npmjs.com/package/eslint-plugin-browser-security) | XSS, DOM security. |
|
|
159
|
+
| [`eslint-plugin-drizzle-security`](https://www.npmjs.com/package/eslint-plugin-drizzle-security) | [](https://www.npmjs.com/package/eslint-plugin-drizzle-security) | Drizzle security. |
|
|
160
|
+
| [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security) | [](https://www.npmjs.com/package/eslint-plugin-express-security) | Express middleware hardening. |
|
|
161
|
+
| [`eslint-plugin-gemini-security`](https://www.npmjs.com/package/eslint-plugin-gemini-security) | [](https://www.npmjs.com/package/eslint-plugin-gemini-security) | Google Gemini SDK security. |
|
|
162
|
+
| [`eslint-plugin-jwt-security`](https://www.npmjs.com/package/eslint-plugin-jwt-security) | [](https://www.npmjs.com/package/eslint-plugin-jwt-security) | Token security. |
|
|
163
|
+
| [`eslint-plugin-knex-security`](https://www.npmjs.com/package/eslint-plugin-knex-security) | [](https://www.npmjs.com/package/eslint-plugin-knex-security) | Knex security. |
|
|
164
|
+
| [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security) | [](https://www.npmjs.com/package/eslint-plugin-lambda-security) | AWS Lambda hardening. |
|
|
165
|
+
| [`eslint-plugin-mcp-sdk-security`](https://www.npmjs.com/package/eslint-plugin-mcp-sdk-security) | [](https://www.npmjs.com/package/eslint-plugin-mcp-sdk-security) | MCP SDK security. |
|
|
166
|
+
| [`eslint-plugin-mongodb-security`](https://www.npmjs.com/package/eslint-plugin-mongodb-security) | [](https://www.npmjs.com/package/eslint-plugin-mongodb-security) | MongoDB injection. |
|
|
167
|
+
| [`eslint-plugin-mysql-security`](https://www.npmjs.com/package/eslint-plugin-mysql-security) | [](https://www.npmjs.com/package/eslint-plugin-mysql-security) | MySQL security. |
|
|
168
|
+
| [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | [](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | NestJS framework hardening. |
|
|
169
|
+
| [`eslint-plugin-node-security`](https://www.npmjs.com/package/eslint-plugin-node-security) | [](https://www.npmjs.com/package/eslint-plugin-node-security) | Server-side patterns. |
|
|
170
|
+
| [`eslint-plugin-openai-security`](https://www.npmjs.com/package/eslint-plugin-openai-security) | [](https://www.npmjs.com/package/eslint-plugin-openai-security) | OpenAI SDK security. |
|
|
171
|
+
| [`eslint-plugin-postgresql-security`](https://www.npmjs.com/package/eslint-plugin-postgresql-security) | [](https://www.npmjs.com/package/eslint-plugin-postgresql-security) | PostgreSQL security. |
|
|
172
|
+
| [`eslint-plugin-prisma-security`](https://www.npmjs.com/package/eslint-plugin-prisma-security) | [](https://www.npmjs.com/package/eslint-plugin-prisma-security) | Prisma security. |
|
|
173
|
+
| [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | [](https://www.npmjs.com/package/eslint-plugin-secure-coding) | Injection prevention. |
|
|
174
|
+
| [`eslint-plugin-sequelize-security`](https://www.npmjs.com/package/eslint-plugin-sequelize-security) | [](https://www.npmjs.com/package/eslint-plugin-sequelize-security) | Sequelize ORM security. |
|
|
175
|
+
| [`eslint-plugin-sqlite-security`](https://www.npmjs.com/package/eslint-plugin-sqlite-security) | [](https://www.npmjs.com/package/eslint-plugin-sqlite-security) | SQLite security. |
|
|
176
|
+
| [`eslint-plugin-typeorm-security`](https://www.npmjs.com/package/eslint-plugin-typeorm-security) | [](https://www.npmjs.com/package/eslint-plugin-typeorm-security) | TypeORM security. |
|
|
177
|
+
| [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | [](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | AI SDK security. |
|
|
178
|
+
|
|
179
|
+
**Code quality**
|
|
180
|
+
|
|
181
|
+
| Plugin | Downloads | Description |
|
|
182
|
+
| :--- | :---: | :--- |
|
|
183
|
+
| [`eslint-plugin-conventions`](https://www.npmjs.com/package/eslint-plugin-conventions) | [](https://www.npmjs.com/package/eslint-plugin-conventions) | Team-specific habits and styles. |
|
|
184
|
+
| [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next) | [](https://www.npmjs.com/package/eslint-plugin-import-next) | Fast cycle + import-graph analysis. |
|
|
185
|
+
| [`eslint-plugin-maintainability`](https://www.npmjs.com/package/eslint-plugin-maintainability) | [](https://www.npmjs.com/package/eslint-plugin-maintainability) | Cognitive load and clean-code patterns. |
|
|
186
|
+
| [`eslint-plugin-modernization`](https://www.npmjs.com/package/eslint-plugin-modernization) | [](https://www.npmjs.com/package/eslint-plugin-modernization) | ESNext migration + syntax evolution. |
|
|
187
|
+
| [`eslint-plugin-modularity`](https://www.npmjs.com/package/eslint-plugin-modularity) | [](https://www.npmjs.com/package/eslint-plugin-modularity) | Structural integrity and DDD patterns. |
|
|
188
|
+
| [`eslint-plugin-operability`](https://www.npmjs.com/package/eslint-plugin-operability) | [](https://www.npmjs.com/package/eslint-plugin-operability) | Production readiness and resource health. |
|
|
189
|
+
| [`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. |
|
|
190
|
+
| [`eslint-plugin-reliability`](https://www.npmjs.com/package/eslint-plugin-reliability) | [](https://www.npmjs.com/package/eslint-plugin-reliability) | Runtime stability and error safety. |
|
|
191
|
+
|
|
192
|
+
<!-- AUTO-GENERATED:ECOSYSTEM_TABLE:END -->
|
|
196
193
|
|
|
197
194
|
<!-- INTERLACE:STAR_CTA:START -->
|
|
198
195
|
## ⭐ Support & follow
|
|
@@ -212,5 +209,5 @@ MIT © [Ofri Peretz](https://github.com/ofri-peretz)
|
|
|
212
209
|
</p>
|
|
213
210
|
|
|
214
211
|
<p align="center">
|
|
215
|
-
<a href="https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features" target="blank"><img src="https://eslint.interlace.tools/
|
|
212
|
+
<a href="https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-react-features" target="blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://eslint.interlace.tools/logos/interlace-dark.svg"><img src="https://eslint.interlace.tools/logos/interlace-light.svg" alt="Interlace" height="70" /></picture></a>
|
|
216
213
|
</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-features",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "ESLint plugin for React — hooks, prop-types, JSX correctness, render performance, and class-to-hooks migration rules for modern React codebases.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@interlace/eslint-devkit": "^1.
|
|
72
|
+
"@interlace/eslint-devkit": "^1.18.0"
|
|
73
73
|
},
|
|
74
74
|
"repository": {
|
|
75
75
|
"type": "git",
|
package/src/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.rules={get"required-attributes"(){return require("./rules/react/required-attributes").requiredAttributes},get"jsx-key"(){return require("./rules/react/jsx-key").jsxKey},get"no-direct-mutation-state"(){return require("./rules/react/no-direct-mutation-state").noDirectMutationState},get"require-optimization"(){return require("./rules/react/require-optimization").requireOptimization},get"no-set-state"(){return require("./rules/react/no-set-state").noSetState},get"no-this-in-sfc"(){return require("./rules/react/no-this-in-sfc").noThisInSfc},get"no-access-state-in-setstate"(){return require("./rules/react/no-access-state-in-setstate").noAccessStateInSetState},get"no-children-prop"(){return require("./rules/react/no-children-prop").noChildrenProp},get"no-danger"(){return require("./rules/react/no-danger").noDanger},get"no-string-refs"(){return require("./rules/react/no-string-refs").noStringRefs},get"no-unknown-property"(){return require("./rules/react/no-unknown-property").noUnknownProperty},get"checked-requires-onchange-or-readonly"(){return require("./rules/react/checked-requires-onchange-or-readonly").checkedRequiresOnchangeOrReadonly},get"default-props-match-prop-types"(){return require("./rules/react/default-props-match-prop-types").defaultPropsMatchPropTypes},get"display-name"(){return require("./rules/react/display-name").displayName},get"jsx-handler-names"(){return require("./rules/react/jsx-handler-names").jsxHandlerNames},get"jsx-max-depth"(){return require("./rules/react/jsx-max-depth").jsxMaxDepth},get"jsx-no-bind"(){return require("./rules/react/jsx-no-bind").jsxNoBind},get"jsx-no-literals"(){return require("./rules/react/jsx-no-literals").jsxNoLiterals},get"no-adjacent-inline-elements"(){return require("./rules/react/no-adjacent-inline-elements").noAdjacentInlineElements},get"no-arrow-function-lifecycle"(){return require("./rules/react/no-arrow-function-lifecycle").noArrowFunctionLifecycle},get"no-did-mount-set-state"(){return require("./rules/react/no-did-mount-set-state").noDidMountSetState},get"no-did-update-set-state"(){return require("./rules/react/no-did-update-set-state").noDidUpdateSetState},get"no-invalid-html-attribute"(){return require("./rules/react/no-invalid-html-attribute").noInvalidHtmlAttribute},get"no-is-mounted"(){return require("./rules/react/no-is-mounted").noIsMounted},get"no-multi-comp"(){return require("./rules/react/no-multi-comp").noMultiComp},get"no-namespace"(){return require("./rules/react/no-namespace").noNamespace},get"no-object-type-as-default-prop"(){return require("./rules/react/no-object-type-as-default-prop").noObjectTypeAsDefaultProp},get"no-redundant-should-component-update"(){return require("./rules/react/no-redundant-should-component-update").noRedundantShouldComponentUpdate},get"no-render-return-value"(){return require("./rules/react/no-render-return-value").noRenderReturnValue},get"no-typos"(){return require("./rules/react/no-typos").noTypos},get"no-unescaped-entities"(){return require("./rules/react/no-unescaped-entities").noUnescapedEntities},get"prefer-es6-class"(){return require("./rules/react/prefer-es6-class").preferEs6Class},get"prefer-stateless-function"(){return require("./rules/react/prefer-stateless-function").preferStatelessFunction},get"prop-types"(){return require("./rules/react/prop-types").propTypes},get"react-in-jsx-scope"(){return require("./rules/react/react-in-jsx-scope").reactInJsxScope},get"require-default-props"(){return require("./rules/react/require-default-props").requireDefaultProps},get"require-render-return"(){return require("./rules/react/require-render-return").requireRenderReturn},get"sort-comp"(){return require("./rules/react/sort-comp").sortComp},get"state-in-constructor"(){return require("./rules/react/state-in-constructor").stateInConstructor},get"static-property-placement"(){return require("./rules/react/static-property-placement").staticPropertyPlacement},get"hooks-exhaustive-deps"(){return require("./rules/react/hooks-exhaustive-deps").hooksExhaustiveDeps},get"jsx-no-target-blank"(){return require("./rules/react/jsx-no-target-blank").jsxNoTargetBlank},get"jsx-no-script-url"(){return require("./rules/react/jsx-no-script-url").jsxNoScriptUrl},get"jsx-no-duplicate-props"(){return require("./rules/react/jsx-no-duplicate-props").jsxNoDuplicateProps},get"no-danger-with-children"(){return require("./rules/react/no-danger-with-children").noDangerWithChildren},get"no-deprecated"(){return require("./rules/react/no-deprecated").noDeprecated},get"no-find-dom-node"(){return require("./rules/react/no-find-dom-node").noFindDomNode},get"no-unsafe"(){return require("./rules/react/no-unsafe").noUnsafe},get"void-dom-elements-no-children"(){return require("./rules/react/void-dom-elements-no-children").voidDomElementsNoChildren},get"react-class-to-hooks"(){return require("./rules/migration/react-class-to-hooks").reactClassToHooks},get"no-unnecessary-rerenders"(){return require("./rules/performance/no-unnecessary-rerenders").noUnnecessaryRerenders},get"react-render-optimization"(){return require("./rules/performance/react-render-optimization").reactRenderOptimization},get"react-no-inline-functions"(){return require("./rules/performance/react-no-inline-functions").reactNoInlineFunctions},get"no-default-test-id"(){return require("./rules/component-api/no-default-test-id").noDefaultTestId},get"require-data-slot"(){return require("./rules/component-api/require-data-slot").requireDataSlot},get"no-is-prefix-prop"(){return require("./rules/component-api/no-is-prefix-prop").noIsPrefixProp},get"no-inline-style"(){return require("./rules/component-api/no-inline-style").noInlineStyle},get"no-raw-color-literal"(){return require("./rules/component-api/no-raw-color-literal").noRawColorLiteral},get"no-arbitrary-token-class"(){return require("./rules/component-api/no-arbitrary-token-class").noArbitraryTokenClass},get"no-kind-prop-discriminator"(){return require("./rules/component-api/no-kind-prop-discriminator").noKindPropDiscriminator},get"no-wrapper-sub-component"(){return require("./rules/component-api/no-wrapper-sub-component").noWrapperSubComponent},get"react/required-attributes"(){return require("./rules/react/required-attributes").requiredAttributes},get"react/jsx-key"(){return require("./rules/react/jsx-key").jsxKey},get"react/no-direct-mutation-state"(){return require("./rules/react/no-direct-mutation-state").noDirectMutationState},get"react/require-optimization"(){return require("./rules/react/require-optimization").requireOptimization},get"react/no-set-state"(){return require("./rules/react/no-set-state").noSetState},get"react/no-this-in-sfc"(){return require("./rules/react/no-this-in-sfc").noThisInSfc},get"react/no-access-state-in-setstate"(){return require("./rules/react/no-access-state-in-setstate").noAccessStateInSetState},get"react/no-children-prop"(){return require("./rules/react/no-children-prop").noChildrenProp},get"react/no-danger"(){return require("./rules/react/no-danger").noDanger},get"react/no-string-refs"(){return require("./rules/react/no-string-refs").noStringRefs},get"react/no-unknown-property"(){return require("./rules/react/no-unknown-property").noUnknownProperty},get"react/checked-requires-onchange-or-readonly"(){return require("./rules/react/checked-requires-onchange-or-readonly").checkedRequiresOnchangeOrReadonly},get"react/default-props-match-prop-types"(){return require("./rules/react/default-props-match-prop-types").defaultPropsMatchPropTypes},get"react/display-name"(){return require("./rules/react/display-name").displayName},get"react/jsx-handler-names"(){return require("./rules/react/jsx-handler-names").jsxHandlerNames},get"react/jsx-max-depth"(){return require("./rules/react/jsx-max-depth").jsxMaxDepth},get"react/jsx-no-bind"(){return require("./rules/react/jsx-no-bind").jsxNoBind},get"react/jsx-no-literals"(){return require("./rules/react/jsx-no-literals").jsxNoLiterals},get"react/no-adjacent-inline-elements"(){return require("./rules/react/no-adjacent-inline-elements").noAdjacentInlineElements},get"react/no-arrow-function-lifecycle"(){return require("./rules/react/no-arrow-function-lifecycle").noArrowFunctionLifecycle},get"react/no-did-mount-set-state"(){return require("./rules/react/no-did-mount-set-state").noDidMountSetState},get"react/no-did-update-set-state"(){return require("./rules/react/no-did-update-set-state").noDidUpdateSetState},get"react/no-invalid-html-attribute"(){return require("./rules/react/no-invalid-html-attribute").noInvalidHtmlAttribute},get"react/no-is-mounted"(){return require("./rules/react/no-is-mounted").noIsMounted},get"react/no-multi-comp"(){return require("./rules/react/no-multi-comp").noMultiComp},get"react/no-namespace"(){return require("./rules/react/no-namespace").noNamespace},get"react/no-object-type-as-default-prop"(){return require("./rules/react/no-object-type-as-default-prop").noObjectTypeAsDefaultProp},get"react/no-redundant-should-component-update"(){return require("./rules/react/no-redundant-should-component-update").noRedundantShouldComponentUpdate},get"react/no-render-return-value"(){return require("./rules/react/no-render-return-value").noRenderReturnValue},get"react/no-typos"(){return require("./rules/react/no-typos").noTypos},get"react/no-unescaped-entities"(){return require("./rules/react/no-unescaped-entities").noUnescapedEntities},get"react/prefer-es6-class"(){return require("./rules/react/prefer-es6-class").preferEs6Class},get"react/prefer-stateless-function"(){return require("./rules/react/prefer-stateless-function").preferStatelessFunction},get"react/prop-types"(){return require("./rules/react/prop-types").propTypes},get"react/react-in-jsx-scope"(){return require("./rules/react/react-in-jsx-scope").reactInJsxScope},get"react/require-default-props"(){return require("./rules/react/require-default-props").requireDefaultProps},get"react/require-render-return"(){return require("./rules/react/require-render-return").requireRenderReturn},get"react/sort-comp"(){return require("./rules/react/sort-comp").sortComp},get"react/state-in-constructor"(){return require("./rules/react/state-in-constructor").stateInConstructor},get"react/static-property-placement"(){return require("./rules/react/static-property-placement").staticPropertyPlacement},get"react/hooks-exhaustive-deps"(){return require("./rules/react/hooks-exhaustive-deps").hooksExhaustiveDeps},get"react/jsx-no-target-blank"(){return require("./rules/react/jsx-no-target-blank").jsxNoTargetBlank},get"react/jsx-no-script-url"(){return require("./rules/react/jsx-no-script-url").jsxNoScriptUrl},get"react/jsx-no-duplicate-props"(){return require("./rules/react/jsx-no-duplicate-props").jsxNoDuplicateProps},get"react/no-danger-with-children"(){return require("./rules/react/no-danger-with-children").noDangerWithChildren},get"react/no-deprecated"(){return require("./rules/react/no-deprecated").noDeprecated},get"react/no-find-dom-node"(){return require("./rules/react/no-find-dom-node").noFindDomNode},get"react/no-unsafe"(){return require("./rules/react/no-unsafe").noUnsafe},get"react/void-dom-elements-no-children"(){return require("./rules/react/void-dom-elements-no-children").voidDomElementsNoChildren},get"migration/react-class-to-hooks"(){return require("./rules/migration/react-class-to-hooks").reactClassToHooks},get"performance/no-unnecessary-rerenders"(){return require("./rules/performance/no-unnecessary-rerenders").noUnnecessaryRerenders},get"performance/react-render-optimization"(){return require("./rules/performance/react-render-optimization").reactRenderOptimization},get"performance/react-no-inline-functions"(){return require("./rules/performance/react-no-inline-functions").reactNoInlineFunctions},get"component-api/no-default-test-id"(){return require("./rules/component-api/no-default-test-id").noDefaultTestId},get"component-api/require-data-slot"(){return require("./rules/component-api/require-data-slot").requireDataSlot},get"component-api/no-is-prefix-prop"(){return require("./rules/component-api/no-is-prefix-prop").noIsPrefixProp},get"component-api/no-inline-style"(){return require("./rules/component-api/no-inline-style").noInlineStyle},get"component-api/no-raw-color-literal"(){return require("./rules/component-api/no-raw-color-literal").noRawColorLiteral},get"component-api/no-arbitrary-token-class"(){return require("./rules/component-api/no-arbitrary-token-class").noArbitraryTokenClass},get"component-api/no-kind-prop-discriminator"(){return require("./rules/component-api/no-kind-prop-discriminator").noKindPropDiscriminator},get"component-api/no-wrapper-sub-component"(){return require("./rules/component-api/no-wrapper-sub-component").noWrapperSubComponent}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-react-features",exports.rules);exports.plugin={meta:{name:"eslint-plugin-react-features",version:"1.3.1"},rules:exports.rules};exports.configs={flagship:{plugins:{"react-features":exports.plugin},rules:{"react-features/hooks-exhaustive-deps":"error"}},recommended:{plugins:{"react-features":exports.plugin},rules:{"react-features/jsx-key":"error","react-features/no-children-prop":"warn","react-features/no-danger":"warn","react-features/no-string-refs":"error","react-features/no-unknown-property":"error","react-features/hooks-exhaustive-deps":"warn","react-features/jsx-no-target-blank":"error","react-features/jsx-no-script-url":"error","react-features/jsx-no-duplicate-props":"error","react-features/no-danger-with-children":"error","react-features/no-deprecated":"warn"}},componentApi:{plugins:{"react-features":exports.plugin},rules:{"react-features/component-api/no-default-test-id":"error","react-features/component-api/require-data-slot":"warn","react-features/component-api/no-is-prefix-prop":"warn","react-features/component-api/no-inline-style":"warn","react-features/component-api/no-raw-color-literal":"warn","react-features/component-api/no-arbitrary-token-class":"warn","react-features/component-api/no-kind-prop-discriminator":"warn","react-features/component-api/no-wrapper-sub-component":"warn"}}};exports.default=exports.plugin;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.rules={get"required-attributes"(){return require("./rules/react/required-attributes").requiredAttributes},get"jsx-key"(){return require("./rules/react/jsx-key").jsxKey},get"no-direct-mutation-state"(){return require("./rules/react/no-direct-mutation-state").noDirectMutationState},get"require-optimization"(){return require("./rules/react/require-optimization").requireOptimization},get"no-set-state"(){return require("./rules/react/no-set-state").noSetState},get"no-this-in-sfc"(){return require("./rules/react/no-this-in-sfc").noThisInSfc},get"no-access-state-in-setstate"(){return require("./rules/react/no-access-state-in-setstate").noAccessStateInSetState},get"no-children-prop"(){return require("./rules/react/no-children-prop").noChildrenProp},get"no-danger"(){return require("./rules/react/no-danger").noDanger},get"no-string-refs"(){return require("./rules/react/no-string-refs").noStringRefs},get"no-unknown-property"(){return require("./rules/react/no-unknown-property").noUnknownProperty},get"checked-requires-onchange-or-readonly"(){return require("./rules/react/checked-requires-onchange-or-readonly").checkedRequiresOnchangeOrReadonly},get"default-props-match-prop-types"(){return require("./rules/react/default-props-match-prop-types").defaultPropsMatchPropTypes},get"display-name"(){return require("./rules/react/display-name").displayName},get"jsx-handler-names"(){return require("./rules/react/jsx-handler-names").jsxHandlerNames},get"jsx-max-depth"(){return require("./rules/react/jsx-max-depth").jsxMaxDepth},get"jsx-no-bind"(){return require("./rules/react/jsx-no-bind").jsxNoBind},get"jsx-no-literals"(){return require("./rules/react/jsx-no-literals").jsxNoLiterals},get"no-adjacent-inline-elements"(){return require("./rules/react/no-adjacent-inline-elements").noAdjacentInlineElements},get"no-arrow-function-lifecycle"(){return require("./rules/react/no-arrow-function-lifecycle").noArrowFunctionLifecycle},get"no-did-mount-set-state"(){return require("./rules/react/no-did-mount-set-state").noDidMountSetState},get"no-did-update-set-state"(){return require("./rules/react/no-did-update-set-state").noDidUpdateSetState},get"no-invalid-html-attribute"(){return require("./rules/react/no-invalid-html-attribute").noInvalidHtmlAttribute},get"no-is-mounted"(){return require("./rules/react/no-is-mounted").noIsMounted},get"no-multi-comp"(){return require("./rules/react/no-multi-comp").noMultiComp},get"no-namespace"(){return require("./rules/react/no-namespace").noNamespace},get"no-object-type-as-default-prop"(){return require("./rules/react/no-object-type-as-default-prop").noObjectTypeAsDefaultProp},get"no-redundant-should-component-update"(){return require("./rules/react/no-redundant-should-component-update").noRedundantShouldComponentUpdate},get"no-render-return-value"(){return require("./rules/react/no-render-return-value").noRenderReturnValue},get"no-typos"(){return require("./rules/react/no-typos").noTypos},get"no-unescaped-entities"(){return require("./rules/react/no-unescaped-entities").noUnescapedEntities},get"prefer-es6-class"(){return require("./rules/react/prefer-es6-class").preferEs6Class},get"prefer-stateless-function"(){return require("./rules/react/prefer-stateless-function").preferStatelessFunction},get"prop-types"(){return require("./rules/react/prop-types").propTypes},get"react-in-jsx-scope"(){return require("./rules/react/react-in-jsx-scope").reactInJsxScope},get"require-default-props"(){return require("./rules/react/require-default-props").requireDefaultProps},get"require-render-return"(){return require("./rules/react/require-render-return").requireRenderReturn},get"sort-comp"(){return require("./rules/react/sort-comp").sortComp},get"state-in-constructor"(){return require("./rules/react/state-in-constructor").stateInConstructor},get"static-property-placement"(){return require("./rules/react/static-property-placement").staticPropertyPlacement},get"hooks-exhaustive-deps"(){return require("./rules/react/hooks-exhaustive-deps").hooksExhaustiveDeps},get"jsx-no-target-blank"(){return require("./rules/react/jsx-no-target-blank").jsxNoTargetBlank},get"jsx-no-script-url"(){return require("./rules/react/jsx-no-script-url").jsxNoScriptUrl},get"jsx-no-duplicate-props"(){return require("./rules/react/jsx-no-duplicate-props").jsxNoDuplicateProps},get"no-danger-with-children"(){return require("./rules/react/no-danger-with-children").noDangerWithChildren},get"no-deprecated"(){return require("./rules/react/no-deprecated").noDeprecated},get"no-find-dom-node"(){return require("./rules/react/no-find-dom-node").noFindDomNode},get"no-unsafe"(){return require("./rules/react/no-unsafe").noUnsafe},get"void-dom-elements-no-children"(){return require("./rules/react/void-dom-elements-no-children").voidDomElementsNoChildren},get"react-class-to-hooks"(){return require("./rules/migration/react-class-to-hooks").reactClassToHooks},get"no-unnecessary-rerenders"(){return require("./rules/performance/no-unnecessary-rerenders").noUnnecessaryRerenders},get"react-render-optimization"(){return require("./rules/performance/react-render-optimization").reactRenderOptimization},get"react-no-inline-functions"(){return require("./rules/performance/react-no-inline-functions").reactNoInlineFunctions},get"no-default-test-id"(){return require("./rules/component-api/no-default-test-id").noDefaultTestId},get"require-data-slot"(){return require("./rules/component-api/require-data-slot").requireDataSlot},get"no-is-prefix-prop"(){return require("./rules/component-api/no-is-prefix-prop").noIsPrefixProp},get"no-inline-style"(){return require("./rules/component-api/no-inline-style").noInlineStyle},get"no-raw-color-literal"(){return require("./rules/component-api/no-raw-color-literal").noRawColorLiteral},get"no-arbitrary-token-class"(){return require("./rules/component-api/no-arbitrary-token-class").noArbitraryTokenClass},get"no-kind-prop-discriminator"(){return require("./rules/component-api/no-kind-prop-discriminator").noKindPropDiscriminator},get"no-wrapper-sub-component"(){return require("./rules/component-api/no-wrapper-sub-component").noWrapperSubComponent},get"react/required-attributes"(){return require("./rules/react/required-attributes").requiredAttributes},get"react/jsx-key"(){return require("./rules/react/jsx-key").jsxKey},get"react/no-direct-mutation-state"(){return require("./rules/react/no-direct-mutation-state").noDirectMutationState},get"react/require-optimization"(){return require("./rules/react/require-optimization").requireOptimization},get"react/no-set-state"(){return require("./rules/react/no-set-state").noSetState},get"react/no-this-in-sfc"(){return require("./rules/react/no-this-in-sfc").noThisInSfc},get"react/no-access-state-in-setstate"(){return require("./rules/react/no-access-state-in-setstate").noAccessStateInSetState},get"react/no-children-prop"(){return require("./rules/react/no-children-prop").noChildrenProp},get"react/no-danger"(){return require("./rules/react/no-danger").noDanger},get"react/no-string-refs"(){return require("./rules/react/no-string-refs").noStringRefs},get"react/no-unknown-property"(){return require("./rules/react/no-unknown-property").noUnknownProperty},get"react/checked-requires-onchange-or-readonly"(){return require("./rules/react/checked-requires-onchange-or-readonly").checkedRequiresOnchangeOrReadonly},get"react/default-props-match-prop-types"(){return require("./rules/react/default-props-match-prop-types").defaultPropsMatchPropTypes},get"react/display-name"(){return require("./rules/react/display-name").displayName},get"react/jsx-handler-names"(){return require("./rules/react/jsx-handler-names").jsxHandlerNames},get"react/jsx-max-depth"(){return require("./rules/react/jsx-max-depth").jsxMaxDepth},get"react/jsx-no-bind"(){return require("./rules/react/jsx-no-bind").jsxNoBind},get"react/jsx-no-literals"(){return require("./rules/react/jsx-no-literals").jsxNoLiterals},get"react/no-adjacent-inline-elements"(){return require("./rules/react/no-adjacent-inline-elements").noAdjacentInlineElements},get"react/no-arrow-function-lifecycle"(){return require("./rules/react/no-arrow-function-lifecycle").noArrowFunctionLifecycle},get"react/no-did-mount-set-state"(){return require("./rules/react/no-did-mount-set-state").noDidMountSetState},get"react/no-did-update-set-state"(){return require("./rules/react/no-did-update-set-state").noDidUpdateSetState},get"react/no-invalid-html-attribute"(){return require("./rules/react/no-invalid-html-attribute").noInvalidHtmlAttribute},get"react/no-is-mounted"(){return require("./rules/react/no-is-mounted").noIsMounted},get"react/no-multi-comp"(){return require("./rules/react/no-multi-comp").noMultiComp},get"react/no-namespace"(){return require("./rules/react/no-namespace").noNamespace},get"react/no-object-type-as-default-prop"(){return require("./rules/react/no-object-type-as-default-prop").noObjectTypeAsDefaultProp},get"react/no-redundant-should-component-update"(){return require("./rules/react/no-redundant-should-component-update").noRedundantShouldComponentUpdate},get"react/no-render-return-value"(){return require("./rules/react/no-render-return-value").noRenderReturnValue},get"react/no-typos"(){return require("./rules/react/no-typos").noTypos},get"react/no-unescaped-entities"(){return require("./rules/react/no-unescaped-entities").noUnescapedEntities},get"react/prefer-es6-class"(){return require("./rules/react/prefer-es6-class").preferEs6Class},get"react/prefer-stateless-function"(){return require("./rules/react/prefer-stateless-function").preferStatelessFunction},get"react/prop-types"(){return require("./rules/react/prop-types").propTypes},get"react/react-in-jsx-scope"(){return require("./rules/react/react-in-jsx-scope").reactInJsxScope},get"react/require-default-props"(){return require("./rules/react/require-default-props").requireDefaultProps},get"react/require-render-return"(){return require("./rules/react/require-render-return").requireRenderReturn},get"react/sort-comp"(){return require("./rules/react/sort-comp").sortComp},get"react/state-in-constructor"(){return require("./rules/react/state-in-constructor").stateInConstructor},get"react/static-property-placement"(){return require("./rules/react/static-property-placement").staticPropertyPlacement},get"react/hooks-exhaustive-deps"(){return require("./rules/react/hooks-exhaustive-deps").hooksExhaustiveDeps},get"react/jsx-no-target-blank"(){return require("./rules/react/jsx-no-target-blank").jsxNoTargetBlank},get"react/jsx-no-script-url"(){return require("./rules/react/jsx-no-script-url").jsxNoScriptUrl},get"react/jsx-no-duplicate-props"(){return require("./rules/react/jsx-no-duplicate-props").jsxNoDuplicateProps},get"react/no-danger-with-children"(){return require("./rules/react/no-danger-with-children").noDangerWithChildren},get"react/no-deprecated"(){return require("./rules/react/no-deprecated").noDeprecated},get"react/no-find-dom-node"(){return require("./rules/react/no-find-dom-node").noFindDomNode},get"react/no-unsafe"(){return require("./rules/react/no-unsafe").noUnsafe},get"react/void-dom-elements-no-children"(){return require("./rules/react/void-dom-elements-no-children").voidDomElementsNoChildren},get"migration/react-class-to-hooks"(){return require("./rules/migration/react-class-to-hooks").reactClassToHooks},get"performance/no-unnecessary-rerenders"(){return require("./rules/performance/no-unnecessary-rerenders").noUnnecessaryRerenders},get"performance/react-render-optimization"(){return require("./rules/performance/react-render-optimization").reactRenderOptimization},get"performance/react-no-inline-functions"(){return require("./rules/performance/react-no-inline-functions").reactNoInlineFunctions},get"component-api/no-default-test-id"(){return require("./rules/component-api/no-default-test-id").noDefaultTestId},get"component-api/require-data-slot"(){return require("./rules/component-api/require-data-slot").requireDataSlot},get"component-api/no-is-prefix-prop"(){return require("./rules/component-api/no-is-prefix-prop").noIsPrefixProp},get"component-api/no-inline-style"(){return require("./rules/component-api/no-inline-style").noInlineStyle},get"component-api/no-raw-color-literal"(){return require("./rules/component-api/no-raw-color-literal").noRawColorLiteral},get"component-api/no-arbitrary-token-class"(){return require("./rules/component-api/no-arbitrary-token-class").noArbitraryTokenClass},get"component-api/no-kind-prop-discriminator"(){return require("./rules/component-api/no-kind-prop-discriminator").noKindPropDiscriminator},get"component-api/no-wrapper-sub-component"(){return require("./rules/component-api/no-wrapper-sub-component").noWrapperSubComponent}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-react-features",exports.rules);exports.plugin={meta:{name:"eslint-plugin-react-features",version:"1.6.0"},rules:exports.rules};exports.configs={flagship:{plugins:{"react-features":exports.plugin},rules:{"react-features/hooks-exhaustive-deps":"error"}},recommended:{plugins:{"react-features":exports.plugin},rules:{"react-features/jsx-key":"error","react-features/no-children-prop":"warn","react-features/no-danger":"warn","react-features/no-string-refs":"error","react-features/no-unknown-property":"error","react-features/hooks-exhaustive-deps":"warn","react-features/jsx-no-target-blank":"error","react-features/jsx-no-script-url":"error","react-features/jsx-no-duplicate-props":"error","react-features/no-danger-with-children":"error","react-features/no-deprecated":"warn"}},componentApi:{plugins:{"react-features":exports.plugin},rules:{"react-features/component-api/no-default-test-id":"error","react-features/component-api/require-data-slot":"warn","react-features/component-api/no-is-prefix-prop":"warn","react-features/component-api/no-inline-style":"warn","react-features/component-api/no-raw-color-literal":"warn","react-features/component-api/no-arbitrary-token-class":"warn","react-features/component-api/no-kind-prop-discriminator":"warn","react-features/component-api/no-wrapper-sub-component":"warn"}}};exports.default=exports.plugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noArbitraryTokenClass=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const TOKENIZABLE_PROPS=new Set(["rounded","rounded-t","rounded-r","rounded-b","rounded-l","rounded-tl","rounded-tr","rounded-bl","rounded-br","px","py","pt","pb","pl","pr","p","mx","my","mt","mb","ml","mr","m","gap","gap-x","gap-y","space-x","space-y"]);const ARBITRARY_CLASS_PATTERN=/([\w-]+)-\[([^\]]+)\]/g;const TOKENIZABLE_VALUE=/^\d+(?:\.\d+)?(?:px|rem|em)$/;exports.noArbitraryTokenClass=(0,eslint_devkit_1.createRule)({name:"no-arbitrary-token-class",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-arbitrary-token-class.md",description:"No Tailwind arbitrary values when a token exists for that property (R19)"},schema:[],messages:{arbitraryClass:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.WARNING,issueName:"Arbitrary Tailwind class",description:"Arbitrary value `{{cls}}` \u2014 use a token or extend the theme (R19)",severity:"MEDIUM",fix:"Replace with the matching spacing/radius token or wire a `var(--token)` Tailwind class.",documentationLink:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-arbitrary-token-class.md"})}},defaultOptions:[],create(context){const scanString=(node,raw)=>{for(const match of raw.matchAll(ARBITRARY_CLASS_PATTERN)){const[whole,prop,value]=match;if(!TOKENIZABLE_PROPS.has(prop))continue;if(!TOKENIZABLE_VALUE.test(value))continue;context.report({node,messageId:"arbitraryClass",data:{cls:whole}})}};return{'JSXAttribute[name.name="className"] > Literal'(node){if(typeof node.value==="string")scanString(node,node.value)},'JSXAttribute[name.name="className"] TemplateElement'(node){scanString(node,node.value.cooked)},CallExpression(node){if(node.callee.type!=="Identifier")return;const name=node.callee.name;if(name!=="cn"&&name!=="clsx"&&name!=="twMerge"&&name!=="classNames")return;for(const arg of node.arguments){
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noArbitraryTokenClass=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const TOKENIZABLE_PROPS=new Set(["rounded","rounded-t","rounded-r","rounded-b","rounded-l","rounded-tl","rounded-tr","rounded-bl","rounded-br","px","py","pt","pb","pl","pr","p","mx","my","mt","mb","ml","mr","m","gap","gap-x","gap-y","space-x","space-y"]);const ARBITRARY_CLASS_PATTERN=/([\w-]+)-\[([^\]]+)\]/g;const TOKENIZABLE_VALUE=/^\d+(?:\.\d+)?(?:px|rem|em)$/;exports.noArbitraryTokenClass=(0,eslint_devkit_1.createRule)({name:"no-arbitrary-token-class",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-arbitrary-token-class.md",description:"No Tailwind arbitrary values when a token exists for that property (R19)"},schema:[],messages:{arbitraryClass:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.WARNING,issueName:"Arbitrary Tailwind class",description:"Arbitrary value `{{cls}}` \u2014 use a token or extend the theme (R19)",severity:"MEDIUM",fix:"Replace with the matching spacing/radius token or wire a `var(--token)` Tailwind class.",documentationLink:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-arbitrary-token-class.md"})}},defaultOptions:[],create(context){const scanString=(node,raw)=>{for(const match of raw.matchAll(ARBITRARY_CLASS_PATTERN)){const[whole,prop,value]=match;if(!TOKENIZABLE_PROPS.has(prop))continue;if(!TOKENIZABLE_VALUE.test(value))continue;context.report({node,messageId:"arbitraryClass",data:{cls:whole}})}};return{'JSXAttribute[name.name="className"] > Literal'(node){if(typeof node.value==="string")scanString(node,node.value)},'JSXAttribute[name.name="className"] TemplateElement'(node){scanString(node,node.value.cooked)},CallExpression(node){if(node.callee.type!=="Identifier")return;const name=node.callee.name;if(name!=="cn"&&name!=="clsx"&&name!=="twMerge"&&name!=="classNames")return;for(const arg of node.arguments){const staticText=(0,eslint_devkit_1.staticString)(arg);if(staticText!==null){scanString(arg,staticText)}}}}}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noInlineStyle=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const isCssVariableKey=prop=>{if(prop.type!=="Property")return false;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noInlineStyle=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const isCssVariableKey=prop=>{if(prop.type!=="Property")return false;const staticText=(0,eslint_devkit_1.staticString)(prop.key);if(staticText!==null){return staticText.startsWith("--")}return false};const isStaticLiteralValue=prop=>{if(prop.type!=="Property")return false;const v=prop.value;return v.type==="Literal"&&(typeof v.value==="string"||typeof v.value==="number")};exports.noInlineStyle=(0,eslint_devkit_1.createRule)({name:"no-inline-style",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-inline-style.md",description:"No inline `style={{}}` except for CSS-variable assignment (R18)"},schema:[],messages:{inlineStyle:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.WARNING,issueName:"Inline style prop",description:"Inline `style={{}}` with static value(s) \u2014 use Tailwind classes (R18)",severity:"MEDIUM",fix:"Move the static value to a Tailwind class. Reserve inline style for CSS variables and computed dynamic values.",documentationLink:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-inline-style.md"})}},defaultOptions:[],create(context){return{JSXAttribute(node){if(node.name.type!=="JSXIdentifier"||node.name.name!=="style")return;if(!node.value||node.value.type!=="JSXExpressionContainer")return;const expr=node.value.expression;if(expr.type!=="ObjectExpression")return;const hasStaticNonVarProp=expr.properties.some(p=>!isCssVariableKey(p)&&isStaticLiteralValue(p));if(hasStaticNonVarProp){context.report({node,messageId:"inlineStyle"})}}}}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.hooksExhaustiveDeps=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");const SKIP_KEYS=new Set(["parent","loc","range","tokens","comments","type"]);const CHILD_KEYS_CACHE=new Map;function getChildKeys(node){const cached=CHILD_KEYS_CACHE.get(node.type);if(cached)return cached;const keys=[];for(const key of Object.keys(node)){if(SKIP_KEYS.has(key))continue;const v=node[key];if(v&&typeof v==="object"){keys.push(key)}}CHILD_KEYS_CACHE.set(node.type,keys);return keys}const HOOKS_WITH_DEPS=new Set(["useEffect","useLayoutEffect","useCallback","useMemo","useImperativeHandle"]);exports.hooksExhaustiveDeps=(0,eslint_devkit_1.createRule)({name:"hooks-exhaustive-deps",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/hooks-exhaustive-deps.md",description:"Enforce exhaustive dependencies in React hooks to prevent stale closures",confidence:"high"},hasSuggestions:true,messages:{missingDep:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Missing Hook Dependency",description:"React Hook {{hookName}} has missing dependencies: {{deps}}",severity:"HIGH",fix:"Add missing dependencies to the dependency array or memoize values with useMemo/useCallback",documentationLink:"https://react.dev/reference/react/useEffect#specifying-reactive-dependencies"}),extraDep:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Unnecessary Hook Dependency",description:"React Hook {{hookName}} has unnecessary dependency: {{dep}}",severity:"MEDIUM",fix:"Remove the unnecessary dependency from the array - it never changes or is not used in the effect",documentationLink:"https://react.dev/reference/react/useEffect#removing-unnecessary-dependencies"}),unnecessaryDep:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.INFO,issueName:"Unnecessary Dependency",description:"The dependency {{dep}} is stable and never changes",severity:"LOW",fix:"Consider removing stable dependencies like setState functions or refs",documentationLink:"https://react.dev/reference/react/useEffect#removing-unnecessary-dependencies"}),suggestAddDep:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.INFO,issueName:"Add Missing Dependency",description:"Add {{dep}} to dependency array",severity:"LOW",fix:"Add the missing dependency to prevent stale closures",documentationLink:"https://react.dev/reference/react/useEffect#specifying-reactive-dependencies"}),suggestRemoveDep:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.INFO,issueName:"Remove Unnecessary Dependency",description:"Remove {{dep}} from dependency array",severity:"LOW",fix:"Remove the unnecessary dependency",documentationLink:"https://react.dev/reference/react/useEffect#removing-unnecessary-dependencies"}),depsNotArrayLiteral:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Non-literal Dependency Array",description:"React Hook {{hookName}} was passed a dependency list that is not an array literal. This means we cannot statically verify whether you have passed the correct dependencies.",severity:"HIGH",fix:"Replace the variable with an inline array literal: [dep1, dep2]. If you need dynamic deps, refactor to compute them inside the hook callback instead.",documentationLink:"https://react.dev/reference/react/useEffect#specifying-reactive-dependencies"})},schema:[{type:"object",properties:{additionalHooks:{type:"string",description:'Regex pattern for additional hooks to check (e.g., "useMyCustomHook")'},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean",default:false,description:"Enable autofix (warning: may cause infinite loops)"}},additionalProperties:false}]},defaultOptions:[{}],create(context){const options=context.options[0]||{};const additionalHooksPattern=options.additionalHooks?new RegExp(options.additionalHooks):null;function isHookWithDeps(node){const callee=node.callee;if(callee.type==="Identifier"){if(HOOKS_WITH_DEPS.has(callee.name)){return true}if(additionalHooksPattern?.test(callee.name)){return true}}if(callee.type==="MemberExpression"&&callee.object.type==="Identifier"&&callee.object.name==="React"&&callee.property.type==="Identifier"&&HOOKS_WITH_DEPS.has(callee.property.name)){return true}return false}function getHookName(node){const callee=node.callee;if(callee.type==="Identifier"){return callee.name}if(callee.type==="MemberExpression"&&callee.property.type==="Identifier"){return callee.property.name}return"unknown"}function extractLocallyDeclaredIdentifiers(node){const declared=new Set;const visited=new WeakSet;function visit(n){if(visited.has(n))return;visited.add(n);if(n.type==="VariableDeclaration"){for(const declarator of n.declarations){if(declarator.id.type==="Identifier"){declared.add(declarator.id.name)}else if(declarator.id.type==="ObjectPattern"){for(const prop of declarator.id.properties){if(prop.type==="Property"&&prop.value.type==="Identifier"){declared.add(prop.value.name)}}}else if(declarator.id.type==="ArrayPattern"){for(const element of declarator.id.elements){if(element&&element.type==="Identifier"){declared.add(element.name)}}}}}if(n.type==="FunctionDeclaration"&&n.id){declared.add(n.id.name)}if(n.type==="ArrowFunctionExpression"||n.type==="FunctionExpression"||n.type==="FunctionDeclaration"){const collectFromPattern=param=>{if(param.type==="Identifier"){declared.add(param.name)}else if(param.type==="ObjectPattern"){for(const prop of param.properties){if(prop.type==="Property"&&prop.value.type==="Identifier"){declared.add(prop.value.name)}else if(prop.type==="RestElement"&&prop.argument.type==="Identifier"){declared.add(prop.argument.name)}}}else if(param.type==="ArrayPattern"){for(const el of param.elements){if(el&&el.type==="Identifier")declared.add(el.name)}}else if(param.type==="RestElement"&¶m.argument.type==="Identifier"){declared.add(param.argument.name)}else if(param.type==="AssignmentPattern"&¶m.left.type==="Identifier"){declared.add(param.left.name)}};for(const param of n.params)collectFromPattern(param)}const keys=getChildKeys(n);for(let i=0;i<keys.length;i++){const child=n[keys[i]];if(Array.isArray(child)){for(let j=0;j<child.length;j++){const c=child[j];if(c&&typeof c==="object"&&"type"in c){visit(c)}}}else if(child&&typeof child==="object"&&"type"in child){visit(child)}}}visit(node);return declared}function extractUsedIdentifiers(node){const used=new Set;const visited=new WeakSet;function visit(n,isPropertyKey=false){if(visited.has(n)){return}visited.add(n);if(n.type==="MemberExpression"){visit(n.object,false);if(n.computed&&n.property){visit(n.property,false)}return}if(n.type==="CallExpression"){if(n.callee){visit(n.callee,false)}if(n.arguments){n.arguments.forEach(arg=>visit(arg,false))}return}if(n.type==="Identifier"&&!isPropertyKey){used.add(n.name)}const keys=getChildKeys(n);for(let i=0;i<keys.length;i++){const child=n[keys[i]];if(Array.isArray(child)){for(let j=0;j<child.length;j++){const c=child[j];if(c&&typeof c==="object"&&"type"in c){visit(c,false)}}}else if(child&&typeof child==="object"&&"type"in child){visit(child,false)}}}visit(node);return used}function extractDependencies(depsArray){const deps=new Set;for(const element of depsArray.elements){if(element?.type==="Identifier"){deps.add(element.name)}else if(element?.type==="MemberExpression"&&element.object.type==="Identifier"){const sourceCode=context.sourceCode;deps.add(sourceCode.getText(element))}}return deps}function isStableReference(name){const stablePatterns=[/^set[A-Z]/,/dispatch/i,/Ref$/];return stablePatterns.some(pattern=>pattern.test(name))}function filterReactiveDeps(used){const reactive=new Set;const nonReactive=new Set(["undefined","null","true","false","console","window","document","Math","JSON","Object","Array","String","Number","Boolean","Date","Promise","Error","Map","Set","WeakMap","WeakSet","Symbol","Reflect","Proxy","Intl","navigator","localStorage","sessionStorage","fetch","setTimeout","setInterval","clearTimeout","clearInterval","requestAnimationFrame","cancelAnimationFrame"]);for(const name of used){if(!nonReactive.has(name)&&!isStableReference(name)){reactive.add(name)}}return reactive}return{CallExpression(node){if(!isHookWithDeps(node)){return}const hookName=getHookName(node);const args=node.arguments;if(args.length===0){return}const callback=args[0];if(callback.type!=="ArrowFunctionExpression"&&callback.type!=="FunctionExpression"){return}const depsArg=args[1];if(!depsArg){return}const isTSAsArrayExpression=depsArg.type==="TSAsExpression"&&depsArg.expression?.type==="ArrayExpression";const isArrayExpression=depsArg.type==="ArrayExpression";if(!isArrayExpression&&!isTSAsArrayExpression){context.report({node:depsArg,messageId:"depsNotArrayLiteral",data:{hookName}});return}const depsArrayNode=isTSAsArrayExpression?depsArg.expression:depsArg;const usedInCallback=extractUsedIdentifiers(callback.body);const locallyDeclared=extractLocallyDeclaredIdentifiers(callback.body);const externalUsed=new Set;for(const id of usedInCallback){if(!locallyDeclared.has(id)){externalUsed.add(id)}}const reactiveDeps=filterReactiveDeps(externalUsed);const declaredDeps=extractDependencies(depsArrayNode);const missingDeps=[];for(const dep of reactiveDeps){if(!declaredDeps.has(dep)&&/^[a-z]/.test(dep)){missingDeps.push(dep)}}const extraDeps=[];for(const dep of declaredDeps){if(!usedInCallback.has(dep)&&!dep.includes(".")){extraDeps.push(dep)}}if(missingDeps.length>0){context.report({node:depsArg,messageId:"missingDep",data:{hookName,deps:missingDeps.join(", ")},suggest:missingDeps.map(dep=>({messageId:"suggestAddDep",data:{dep},fix(fixer){const lastElement=depsArrayNode.elements[depsArrayNode.elements.length-1];if(lastElement){return fixer.insertTextAfter(lastElement,`, ${dep}`)}else{return fixer.insertTextAfterRange([depsArrayNode.range[0]+1,depsArrayNode.range[0]+1],dep)}}}))})}for(const dep of extraDeps){context.report({node:depsArg,messageId:"extraDep",data:{hookName,dep},suggest:[{messageId:"suggestRemoveDep",data:{dep},fix(fixer){const element=depsArrayNode.elements.find(el=>el?.type==="Identifier"&&el.name===dep);if(element){const index=depsArrayNode.elements.indexOf(element);const isLast=index===depsArrayNode.elements.length-1;const isFirst=index===0;if(isFirst&&depsArrayNode.elements.length>1){const nextElement=depsArrayNode.elements[1];if(nextElement){return fixer.removeRange([element.range[0],nextElement.range[0]])}}else if(isLast&&index>0){const prevElement=depsArrayNode.elements[index-1];if(prevElement){return fixer.removeRange([prevElement.range[1],element.range[1]])}}return fixer.remove(element)}return null}}]})}}}}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.hooksExhaustiveDeps=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");const SKIP_KEYS=new Set(["parent","loc","range","tokens","comments","type"]);const CHILD_KEYS_CACHE=new Map;function getChildKeys(node){const cached=CHILD_KEYS_CACHE.get(node.type);if(cached)return cached;const keys=[];for(const key of Object.keys(node)){if(SKIP_KEYS.has(key))continue;const v=node[key];if(v&&typeof v==="object"){keys.push(key)}}CHILD_KEYS_CACHE.set(node.type,keys);return keys}const HOOKS_WITH_DEPS=new Set(["useEffect","useLayoutEffect","useCallback","useMemo","useImperativeHandle"]);exports.hooksExhaustiveDeps=(0,eslint_devkit_1.createRule)({name:"hooks-exhaustive-deps",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/hooks-exhaustive-deps.md",description:"Enforce exhaustive dependencies in React hooks to prevent stale closures",confidence:"high"},hasSuggestions:true,messages:{missingDep:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Missing Hook Dependency",description:"React Hook {{hookName}} has missing dependencies: {{deps}}",severity:"HIGH",fix:"Add missing dependencies to the dependency array or memoize values with useMemo/useCallback",documentationLink:"https://react.dev/reference/react/useEffect#specifying-reactive-dependencies"}),extraDep:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Unnecessary Hook Dependency",description:"React Hook {{hookName}} has unnecessary dependency: {{dep}}",severity:"MEDIUM",fix:"Remove the unnecessary dependency from the array - it never changes or is not used in the effect",documentationLink:"https://react.dev/reference/react/useEffect#removing-unnecessary-dependencies"}),unnecessaryDep:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.INFO,issueName:"Unnecessary Dependency",description:"The dependency {{dep}} is stable and never changes",severity:"LOW",fix:"Consider removing stable dependencies like setState functions or refs",documentationLink:"https://react.dev/reference/react/useEffect#removing-unnecessary-dependencies"}),suggestAddDep:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.INFO,issueName:"Add Missing Dependency",description:"Add {{dep}} to dependency array",severity:"LOW",fix:"Add the missing dependency to prevent stale closures",documentationLink:"https://react.dev/reference/react/useEffect#specifying-reactive-dependencies"}),suggestRemoveDep:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.INFO,issueName:"Remove Unnecessary Dependency",description:"Remove {{dep}} from dependency array",severity:"LOW",fix:"Remove the unnecessary dependency",documentationLink:"https://react.dev/reference/react/useEffect#removing-unnecessary-dependencies"}),depsNotArrayLiteral:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Non-literal Dependency Array",description:"React Hook {{hookName}} was passed a dependency list that is not an array literal. This means we cannot statically verify whether you have passed the correct dependencies.",severity:"HIGH",fix:"Replace the variable with an inline array literal: [dep1, dep2]. If you need dynamic deps, refactor to compute them inside the hook callback instead.",documentationLink:"https://react.dev/reference/react/useEffect#specifying-reactive-dependencies"})},schema:[{type:"object",properties:{additionalHooks:{type:"string",description:'Regex pattern for additional hooks to check (e.g., "useMyCustomHook")'},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean",default:false,description:"Enable autofix (warning: may cause infinite loops)"}},additionalProperties:false}]},defaultOptions:[{}],create(context){const options=context.options[0]||{};const additionalHooksPattern=options.additionalHooks?new RegExp(options.additionalHooks):null;function isHookWithDeps(node){const callee=node.callee;if(callee.type==="Identifier"){if(HOOKS_WITH_DEPS.has(callee.name)){return true}if(additionalHooksPattern?.test(callee.name)){return true}}if(callee.type==="MemberExpression"&&callee.object.type==="Identifier"&&callee.object.name==="React"&&callee.property.type==="Identifier"&&HOOKS_WITH_DEPS.has(callee.property.name)){return true}return false}function getHookName(node){const callee=node.callee;if(callee.type==="Identifier"){return callee.name}if(callee.type==="MemberExpression"&&callee.property.type==="Identifier"){return callee.property.name}return"unknown"}function extractLocallyDeclaredIdentifiers(node){const declared=new Set;const visited=new WeakSet;function visit(n){if(visited.has(n))return;visited.add(n);if(n.type==="VariableDeclaration"){for(const declarator of n.declarations){if(declarator.id.type==="Identifier"){declared.add(declarator.id.name)}else if(declarator.id.type==="ObjectPattern"){for(const prop of declarator.id.properties){if(prop.type==="Property"&&prop.value.type==="Identifier"){declared.add(prop.value.name)}}}else if(declarator.id.type==="ArrayPattern"){for(const element of declarator.id.elements){if(element&&element.type==="Identifier"){declared.add(element.name)}}}}}if(n.type==="FunctionDeclaration"&&n.id){declared.add(n.id.name)}if(n.type==="ArrowFunctionExpression"||n.type==="FunctionExpression"||n.type==="FunctionDeclaration"){const collectFromPattern=param=>{if(param.type==="Identifier"){declared.add(param.name)}else if(param.type==="ObjectPattern"){for(const prop of param.properties){if(prop.type==="Property"&&prop.value.type==="Identifier"){declared.add(prop.value.name)}else if(prop.type==="RestElement"&&prop.argument.type==="Identifier"){declared.add(prop.argument.name)}}}else if(param.type==="ArrayPattern"){for(const el of param.elements){if(el&&el.type==="Identifier")declared.add(el.name)}}else if(param.type==="RestElement"&¶m.argument.type==="Identifier"){declared.add(param.argument.name)}else if(param.type==="AssignmentPattern"&¶m.left.type==="Identifier"){declared.add(param.left.name)}};for(const param of n.params)collectFromPattern(param)}const keys=getChildKeys(n);for(let i=0;i<keys.length;i++){const child=n[keys[i]];if(Array.isArray(child)){for(let j=0;j<child.length;j++){const c=child[j];if(c&&typeof c==="object"&&"type"in c){visit(c)}}}else if(child&&typeof child==="object"&&"type"in child){visit(child)}}}visit(node);return declared}function extractUsedIdentifiers(node){const used=new Set;const visited=new WeakSet;function visit(n,isPropertyKey=false){if(visited.has(n)){return}visited.add(n);if(n.type==="MemberExpression"){visit(n.object,false);if(n.computed&&n.property){visit(n.property,false)}return}if(n.type==="CallExpression"){if(n.callee){visit(n.callee,false)}if(n.arguments){n.arguments.forEach(arg=>visit(arg,false))}return}if(n.type==="Identifier"&&!isPropertyKey){used.add(n.name)}const keys=getChildKeys(n);for(let i=0;i<keys.length;i++){const child=n[keys[i]];if(Array.isArray(child)){for(let j=0;j<child.length;j++){const c=child[j];if(c&&typeof c==="object"&&"type"in c){visit(c,false)}}}else if(child&&typeof child==="object"&&"type"in child){visit(child,false)}}}visit(node);return used}function extractDependencies(depsArray){const deps=new Set;for(const element of depsArray.elements){if(element?.type==="Identifier"){deps.add(element.name)}else if(element?.type==="MemberExpression"&&element.object.type==="Identifier"){const sourceCode=context.sourceCode;deps.add(sourceCode.getText(element))}}return deps}function isStableReference(name,scope){for(let current=scope;current;current=current.upper){const variable=current.variables.find(v=>v.name===name);if(!variable)continue;const owner=variable.scope.type;if(owner==="module"||owner==="global")return true;return variable.defs.some(def=>isStableDefinition(def,name))}return true}function isStableDefinition(def,name){if(def.type!=="Variable")return false;const declarator=def.node;const init=declarator.init;if(!init||init.type!=="CallExpression")return false;const callee=init.callee;const hookName=callee.type==="Identifier"?callee.name:callee.type==="MemberExpression"?(0,eslint_devkit_2.propertyName)(callee)??"":"";if(hookName==="useRef")return declarator.id.type==="Identifier";if(hookName==="useState"||hookName==="useReducer"){if(declarator.id.type!=="ArrayPattern")return false;const second=declarator.id.elements[1];return second?.type==="Identifier"&&second.name===name}return false}function filterReactiveDeps(used,scope){const reactive=new Set;const nonReactive=new Set(["undefined","null","true","false","console","window","document","Math","JSON","Object","Array","String","Number","Boolean","Date","Promise","Error","Map","Set","WeakMap","WeakSet","Symbol","Reflect","Proxy","Intl","navigator","localStorage","sessionStorage","fetch","setTimeout","setInterval","clearTimeout","clearInterval","requestAnimationFrame","cancelAnimationFrame"]);for(const name of used){if(!nonReactive.has(name)&&!isStableReference(name,scope)){reactive.add(name)}}return reactive}return{CallExpression(node){if(!isHookWithDeps(node)){return}const hookName=getHookName(node);const args=node.arguments;if(args.length===0){return}const callback=args[0];if(callback.type!=="ArrowFunctionExpression"&&callback.type!=="FunctionExpression"){return}const depsArg=args[1];if(!depsArg){return}const isTSAsArrayExpression=depsArg.type==="TSAsExpression"&&depsArg.expression?.type==="ArrayExpression";const isArrayExpression=depsArg.type==="ArrayExpression";if(!isArrayExpression&&!isTSAsArrayExpression){context.report({node:depsArg,messageId:"depsNotArrayLiteral",data:{hookName}});return}const depsArrayNode=isTSAsArrayExpression?depsArg.expression:depsArg;const usedInCallback=extractUsedIdentifiers(callback.body);const locallyDeclared=extractLocallyDeclaredIdentifiers(callback.body);const externalUsed=new Set;for(const id of usedInCallback){if(!locallyDeclared.has(id)){externalUsed.add(id)}}const reactiveDeps=filterReactiveDeps(externalUsed,context.sourceCode.getScope(callback));const declaredDeps=extractDependencies(depsArrayNode);const missingDeps=[];for(const dep of reactiveDeps){if(!declaredDeps.has(dep)&&/^[a-z]/.test(dep)){missingDeps.push(dep)}}const extraDeps=[];for(const dep of declaredDeps){if(!usedInCallback.has(dep)&&!dep.includes(".")){extraDeps.push(dep)}}if(missingDeps.length>0){context.report({node:depsArg,messageId:"missingDep",data:{hookName,deps:missingDeps.join(", ")},suggest:missingDeps.map(dep=>({messageId:"suggestAddDep",data:{dep},fix(fixer){const lastElement=depsArrayNode.elements[depsArrayNode.elements.length-1];if(lastElement){return fixer.insertTextAfter(lastElement,`, ${dep}`)}else{return fixer.insertTextAfterRange([depsArrayNode.range[0]+1,depsArrayNode.range[0]+1],dep)}}}))})}for(const dep of extraDeps){context.report({node:depsArg,messageId:"extraDep",data:{hookName,dep},suggest:[{messageId:"suggestRemoveDep",data:{dep},fix(fixer){const element=depsArrayNode.elements.find(el=>el?.type==="Identifier"&&el.name===dep);if(element){const index=depsArrayNode.elements.indexOf(element);const isLast=index===depsArrayNode.elements.length-1;const isFirst=index===0;if(isFirst&&depsArrayNode.elements.length>1){const nextElement=depsArrayNode.elements[1];if(nextElement){return fixer.removeRange([element.range[0],nextElement.range[0]])}}else if(isLast&&index>0){const prevElement=depsArrayNode.elements[index-1];if(prevElement){return fixer.removeRange([prevElement.range[1],element.range[1]])}}return fixer.remove(element)}return null}}]})}}}}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.jsxNoLiterals=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.jsxNoLiterals=(0,eslint_devkit_1.createRule)({name:"jsx-no-literals",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/jsx-no-literals.md",description:"Prevent string literals in JSX"},messages:{jsxNoLiterals:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"String Literal in JSX",description:"String literal found in JSX",severity:"MEDIUM",fix:"Extract string to variable or use translation key",documentationLink:"https://react.dev/learn/passing-props-to-a-component#passing-jsx-as-children"})},schema:[{type:"object",properties:{noStrings:{type:"boolean",default:true},allowedStrings:{type:"array",items:{type:"string"},default:[]},ignoreProps:{type:"boolean",default:true}},additionalProperties:false}]},defaultOptions:[{}],create(context){const[options]=context.options;const noStrings=options?.noStrings??true;const allowedStrings=options?.allowedStrings??[];const ignoreProps=options?.ignoreProps??true;return{JSXText(node){if(!noStrings)return;const text=node.value.trim();if(text&&!allowedStrings.includes(text)){context.report({node,messageId:"jsxNoLiterals"})}},JSXAttribute(node){if(ignoreProps)return;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.jsxNoLiterals=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.jsxNoLiterals=(0,eslint_devkit_1.createRule)({name:"jsx-no-literals",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/jsx-no-literals.md",description:"Prevent string literals in JSX"},messages:{jsxNoLiterals:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"String Literal in JSX",description:"String literal found in JSX",severity:"MEDIUM",fix:"Extract string to variable or use translation key",documentationLink:"https://react.dev/learn/passing-props-to-a-component#passing-jsx-as-children"})},schema:[{type:"object",properties:{noStrings:{type:"boolean",default:true},allowedStrings:{type:"array",items:{type:"string"},default:[]},ignoreProps:{type:"boolean",default:true}},additionalProperties:false}]},defaultOptions:[{}],create(context){const[options]=context.options;const noStrings=options?.noStrings??true;const allowedStrings=options?.allowedStrings??[];const ignoreProps=options?.ignoreProps??true;return{JSXText(node){if(!noStrings)return;const text=node.value.trim();if(text&&!allowedStrings.includes(text)){context.report({node,messageId:"jsxNoLiterals"})}},JSXAttribute(node){if(ignoreProps)return;const attributeText=node.value===null?null:(0,eslint_devkit_1.staticString)(node.value);if(node.value&&attributeText!==null){const text=attributeText.trim();if(text&&!allowedStrings.includes(text)){context.report({node:node.value,messageId:"jsxNoLiterals"})}}}}}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.jsxNoScriptUrl=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");const URL_PROPS=new Set(["href","src","action","formAction","data","poster","background"]);exports.jsxNoScriptUrl=(0,eslint_devkit_2.createRule)({name:"jsx-no-script-url",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/jsx-no-script-url.md",description:"Forbid javascript: URLs",cwe:"CWE-79",cvss:9.5},messages:{noScriptUrl:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.SECURITY,issueName:"javascript: URL",cwe:"CWE-79",description:"javascript: URLs are a security risk and can lead to XSS attacks",severity:"CRITICAL",fix:"Use an onClick handler instead or a proper href",documentationLink:"https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md"})},schema:[{type:"array",items:{type:"object",properties:{name:{type:"string"},props:{type:"array",items:{type:"string"}}},required:["name","props"],additionalProperties:false}},{type:"object",properties:{includeFromSettings:{type:"boolean"}},additionalProperties:false}]},defaultOptions:[[],{}],create(context,[componentConfigs=[]]){const componentPropsMap=new Map;for(const config of componentConfigs){componentPropsMap.set(config.name,new Set(config.props))}function isJavaScriptUrl(value){return/^\s*javascript:/i.test(value)}function checkAttribute(node,elementName){if(node.name.type!=="JSXIdentifier")return;const propName=node.name.name;const isUrlProp=URL_PROPS.has(propName);const customProps=componentPropsMap.get(elementName);const isCustomProp=customProps?.has(propName);if(!isUrlProp&&!isCustomProp)return;if(!node.value)return;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.jsxNoScriptUrl=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");const URL_PROPS=new Set(["href","src","action","formAction","data","poster","background"]);exports.jsxNoScriptUrl=(0,eslint_devkit_2.createRule)({name:"jsx-no-script-url",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/jsx-no-script-url.md",description:"Forbid javascript: URLs",cwe:"CWE-79",cvss:9.5},messages:{noScriptUrl:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.SECURITY,issueName:"javascript: URL",cwe:"CWE-79",description:"javascript: URLs are a security risk and can lead to XSS attacks",severity:"CRITICAL",fix:"Use an onClick handler instead or a proper href",documentationLink:"https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md"})},schema:[{type:"array",items:{type:"object",properties:{name:{type:"string"},props:{type:"array",items:{type:"string"}}},required:["name","props"],additionalProperties:false}},{type:"object",properties:{includeFromSettings:{type:"boolean"}},additionalProperties:false}]},defaultOptions:[[],{}],create(context,[componentConfigs=[]]){const componentPropsMap=new Map;for(const config of componentConfigs){componentPropsMap.set(config.name,new Set(config.props))}function isJavaScriptUrl(value){return/^\s*javascript:/i.test(value)}function checkAttribute(node,elementName){if(node.name.type!=="JSXIdentifier")return;const propName=node.name.name;const isUrlProp=URL_PROPS.has(propName);const customProps=componentPropsMap.get(elementName);const isCustomProp=customProps?.has(propName);if(!isUrlProp&&!isCustomProp)return;if(!node.value)return;const staticText1=(0,eslint_devkit_1.staticString)(node.value);if(staticText1!==null){if(isJavaScriptUrl(staticText1)){context.report({node,messageId:"noScriptUrl"})}}if(node.value.type==="JSXExpressionContainer"){const expr=node.value.expression;const staticText2=(0,eslint_devkit_1.staticString)(expr);if(staticText2!==null){if(isJavaScriptUrl(staticText2)){context.report({node,messageId:"noScriptUrl"})}}if(expr.type==="TemplateLiteral"&&expr.quasis.length>0){const firstQuasi=expr.quasis[0];if(firstQuasi&&isJavaScriptUrl(firstQuasi.value.raw)){context.report({node,messageId:"noScriptUrl"})}}}}return{JSXOpeningElement(node){let elementName;if(node.name.type==="JSXIdentifier"){elementName=node.name.name}else if(node.name.type==="JSXMemberExpression"){elementName=context.sourceCode.getText(node.name)}else{return}for(const attr of node.attributes){if(attr.type==="JSXAttribute"){checkAttribute(attr,elementName)}}}}}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.jsxNoTargetBlank=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.jsxNoTargetBlank=(0,eslint_devkit_2.createRule)({name:"jsx-no-target-blank",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/jsx-no-target-blank.md",description:'Forbid target="_blank" without rel="noopener noreferrer"',cwe:"CWE-1022",cvss:7.5},fixable:"code",messages:{noTargetBlank:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.SECURITY,issueName:'Unsafe target="_blank"',cwe:"CWE-1022",description:'Using target="_blank" without rel="noopener noreferrer" is a security risk',severity:"HIGH",fix:'Add rel="noopener noreferrer" to prevent reverse tabnabbing',documentationLink:"https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md"}),noRelWithoutNoopener:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.SECURITY,issueName:"Missing noopener",cwe:"CWE-1022",description:'rel attribute is missing "noopener" value',severity:"MEDIUM",fix:'Add "noopener" to the rel attribute',documentationLink:"https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md"})},schema:[{type:"object",properties:{allowReferrer:{type:"boolean",default:false},enforceDynamicLinks:{type:"string",enum:["always","never"],default:"always"},warnOnSpreadAttributes:{type:"boolean",default:false},links:{type:"boolean",default:true},forms:{type:"boolean",default:false}},additionalProperties:false}]},defaultOptions:[{}],create(context,[options={}]){const{allowReferrer=false,enforceDynamicLinks="always",warnOnSpreadAttributes=false,links=true,forms=false}=options??{};const elementsToCheck=[];if(links)elementsToCheck.push("a");if(forms)elementsToCheck.push("form");function hasTargetBlank(node){const targetAttr=node.attributes.find(attr=>attr.type==="JSXAttribute"&&attr.name.type==="JSXIdentifier"&&attr.name.name==="target");if(!targetAttr||!targetAttr.value)return false;if(targetAttr.value.type==="Literal"){return targetAttr.value.value==="_blank"}if(enforceDynamicLinks==="always"){return true}return false}function hasExternalHref(node){const hrefAttr=node.attributes.find(attr=>attr.type==="JSXAttribute"&&attr.name.type==="JSXIdentifier"&&attr.name.name==="href");if(!hrefAttr||!hrefAttr.value)return false;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.jsxNoTargetBlank=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.jsxNoTargetBlank=(0,eslint_devkit_2.createRule)({name:"jsx-no-target-blank",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/jsx-no-target-blank.md",description:'Forbid target="_blank" without rel="noopener noreferrer"',cwe:"CWE-1022",cvss:7.5},fixable:"code",messages:{noTargetBlank:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.SECURITY,issueName:'Unsafe target="_blank"',cwe:"CWE-1022",description:'Using target="_blank" without rel="noopener noreferrer" is a security risk',severity:"HIGH",fix:'Add rel="noopener noreferrer" to prevent reverse tabnabbing',documentationLink:"https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md"}),noRelWithoutNoopener:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.SECURITY,issueName:"Missing noopener",cwe:"CWE-1022",description:'rel attribute is missing "noopener" value',severity:"MEDIUM",fix:'Add "noopener" to the rel attribute',documentationLink:"https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md"})},schema:[{type:"object",properties:{allowReferrer:{type:"boolean",default:false},enforceDynamicLinks:{type:"string",enum:["always","never"],default:"always"},warnOnSpreadAttributes:{type:"boolean",default:false},links:{type:"boolean",default:true},forms:{type:"boolean",default:false}},additionalProperties:false}]},defaultOptions:[{}],create(context,[options={}]){const{allowReferrer=false,enforceDynamicLinks="always",warnOnSpreadAttributes=false,links=true,forms=false}=options??{};const elementsToCheck=[];if(links)elementsToCheck.push("a");if(forms)elementsToCheck.push("form");function hasTargetBlank(node){const targetAttr=node.attributes.find(attr=>attr.type==="JSXAttribute"&&attr.name.type==="JSXIdentifier"&&attr.name.name==="target");if(!targetAttr||!targetAttr.value)return false;if(targetAttr.value.type==="Literal"){return targetAttr.value.value==="_blank"}if(enforceDynamicLinks==="always"){return true}return false}function hasExternalHref(node){const hrefAttr=node.attributes.find(attr=>attr.type==="JSXAttribute"&&attr.name.type==="JSXIdentifier"&&attr.name.name==="href");if(!hrefAttr||!hrefAttr.value)return false;const staticText1=(0,eslint_devkit_1.staticString)(hrefAttr.value);if(staticText1!==null){const href=staticText1;return/^(https?:)?\/\//.test(href)||href.startsWith("//")}return enforceDynamicLinks==="always"}function getRelAttribute(node){return node.attributes.find(attr=>attr.type==="JSXAttribute"&&attr.name.type==="JSXIdentifier"&&attr.name.name==="rel")}function hasNoopener(relAttr){if(!relAttr.value)return false;const staticText2=(0,eslint_devkit_1.staticString)(relAttr.value);if(staticText2!==null){const relValues=staticText2.toLowerCase().split(/\s+/);return relValues.includes("noopener")}return false}function hasNoreferrer(relAttr){if(!relAttr.value)return false;const staticText3=(0,eslint_devkit_1.staticString)(relAttr.value);if(staticText3!==null){const relValues=staticText3.toLowerCase().split(/\s+/);return relValues.includes("noreferrer")}return false}function hasSpreadAttribute(node){return node.attributes.some(attr=>attr.type==="JSXSpreadAttribute")}return{JSXOpeningElement(node){if(node.name.type!=="JSXIdentifier"||!elementsToCheck.includes(node.name.name)){return}if(hasSpreadAttribute(node)&&!warnOnSpreadAttributes){return}if(!hasTargetBlank(node)){return}if(node.name.name==="a"&&!hasExternalHref(node)){return}const relAttr=getRelAttribute(node);const hasNoopenerValue=relAttr?hasNoopener(relAttr):false;const hasNoreferrerValue=relAttr?hasNoreferrer(relAttr):false;if(hasNoopenerValue||hasNoreferrerValue){if(!allowReferrer&&!hasNoreferrerValue){return}return}context.report({node,messageId:relAttr?"noRelWithoutNoopener":"noTargetBlank",fix:fixer=>{if(relAttr&&relAttr.value&&relAttr.value.type==="Literal"){const currentRel=String((0,eslint_devkit_1.staticString)(relAttr.value));const newRel=allowReferrer?`${currentRel} noopener`.trim():`${currentRel} noopener noreferrer`.trim();return fixer.replaceText(relAttr.value,`"${newRel}"`)}else if(!relAttr){const lastAttr=node.attributes[node.attributes.length-1];const relValue=allowReferrer?"noopener":"noopener noreferrer";if(lastAttr){return fixer.insertTextAfter(lastAttr,` rel="${relValue}"`)}return fixer.insertTextAfter(node.name,` rel="${relValue}"`)}return null}})}}}});
|