Skip to content

Commit 25dc8ff

Browse files
authored
fix: false positive in 'react-x/no-context-provider' on components named 'Provider', closes #991 (#992)
1 parent 3615541 commit 25dc8ff

File tree

17 files changed

+51
-17
lines changed

17 files changed

+51
-17
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.34.0
1+
1.34.1-next.0

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eslint-react/monorepo",
3-
"version": "1.34.0",
3+
"version": "1.34.1-next.0",
44
"private": true,
55
"description": "Monorepo for eslint-plugin-react-[x, dom, web-api, hooks-extra, naming-convention].",
66
"keywords": [

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eslint-react/core",
3-
"version": "1.34.0",
3+
"version": "1.34.1-next.0",
44
"description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.",
55
"homepage": "https://github.com/Rel1cx/eslint-react",
66
"bugs": {

packages/plugins/eslint-plugin-react-debug/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-react-debug",
3-
"version": "1.34.0",
3+
"version": "1.34.1-next.0",
44
"description": "ESLint React's ESLint plugin for debugging related rules.",
55
"keywords": [
66
"react",

packages/plugins/eslint-plugin-react-dom/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-react-dom",
3-
"version": "1.34.0",
3+
"version": "1.34.1-next.0",
44
"description": "ESLint React's ESLint plugin for React DOM related rules.",
55
"keywords": [
66
"react",

packages/plugins/eslint-plugin-react-hooks-extra/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-react-hooks-extra",
3-
"version": "1.34.0",
3+
"version": "1.34.1-next.0",
44
"description": "ESLint React's ESLint plugin for React Hooks related rules.",
55
"keywords": [
66
"react",

packages/plugins/eslint-plugin-react-naming-convention/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-react-naming-convention",
3-
"version": "1.34.0",
3+
"version": "1.34.1-next.0",
44
"description": "ESLint React's ESLint plugin for naming convention related rules.",
55
"keywords": [
66
"react",

packages/plugins/eslint-plugin-react-web-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-react-web-api",
3-
"version": "1.34.0",
3+
"version": "1.34.1-next.0",
44
"description": "ESLint React's ESLint plugin for interacting with Web APIs",
55
"keywords": [
66
"react",

packages/plugins/eslint-plugin-react-x/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-react-x",
3-
"version": "1.34.0",
3+
"version": "1.34.1-next.0",
44
"description": "A set of composable linting rules for libraries and frameworks that use React as a UI runtime.",
55
"keywords": [
66
"react",

packages/plugins/eslint-plugin-react-x/src/rules/no-context-provider.spec.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import rule, { RULE_NAME } from "./no-context-provider";
66
ruleTester.run(RULE_NAME, rule, {
77
invalid: [
88
{
9-
code: tsx`<Provider />`,
9+
code: tsx`<context.Provider />`,
1010
errors: [
1111
{
1212
messageId: "noContextProvider",
@@ -101,6 +101,26 @@ ruleTester.run(RULE_NAME, rule, {
101101
},
102102
},
103103
},
104+
// TODO: Evaluate the necessity of supporting this kind of usage
105+
// {
106+
// code: tsx`
107+
// const Provider = Context.Provider;
108+
109+
// function Component() {
110+
// return <Provider>hello world</Provider>;
111+
// }
112+
// `,
113+
// errors: [
114+
// {
115+
// messageId: "noContextProvider",
116+
// },
117+
// ],
118+
// settings: {
119+
// "react-x": {
120+
// version: "19.0.0",
121+
// },
122+
// },
123+
// },
104124
],
105125
valid: [
106126
{
@@ -151,5 +171,19 @@ ruleTester.run(RULE_NAME, rule, {
151171
},
152172
},
153173
},
174+
{
175+
code: tsx`
176+
import { Provider } from "jotai";
177+
178+
function Component() {
179+
return <Provider>hello world</Provider>;
180+
}
181+
`,
182+
settings: {
183+
"react-x": {
184+
version: "19.0.0",
185+
},
186+
},
187+
},
154188
],
155189
});

0 commit comments

Comments
 (0)