@pob/eslint-plugin 65.3.0 → 65.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,199 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [65.5.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v65.4.3...v65.5.0) (2026-06-12)
7
+
8
+ ### Features
9
+
10
+ * add namespace error
11
+ * add test case for namespace import in react-named-import rule
12
+
13
+ ## [65.4.1](https://github.com/christophehurpeau/eslint-config-pob/compare/v65.4.0...v65.4.1) (2026-05-01)
14
+
15
+ Note: no notable changes
16
+
17
+
18
+ ## [65.4.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v65.3.0...v65.4.0) (2026-05-01)
19
+
20
+ ### Features
21
+
22
+ * **deps:** update typescript-eslint monorepo to v8.59.1 ([#833](https://github.com/christophehurpeau/eslint-config-pob/issues/833))
23
+
24
+ ## [65.3.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v65.2.0...v65.3.0) (2026-03-23)
25
+
26
+ ### Features
27
+
28
+ * **deps:** update typescript-eslint monorepo to v8.57.1 ([#832](https://github.com/christophehurpeau/eslint-config-pob/issues/832))
29
+
30
+ ## [65.2.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v65.1.0...v65.2.0) (2026-03-01)
31
+
32
+ ### Features
33
+
34
+ * support eslint 10
35
+
36
+ ## [65.1.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v65.0.5...v65.1.0) (2026-02-25)
37
+
38
+ ### Features
39
+
40
+ * **deps:** update typescript-eslint monorepo to v8.56.1 ([#781](https://github.com/christophehurpeau/eslint-config-pob/issues/781))
41
+
42
+ ## [65.0.1](https://github.com/christophehurpeau/eslint-config-pob/compare/v65.0.0...v65.0.1) (2025-12-28)
43
+
44
+ Note: no notable changes
45
+
46
+
47
+ ## [64.2.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v64.1.4...v64.2.0) (2025-12-07)
48
+
49
+ ### Features
50
+
51
+ * add @whatwg-node/fetch
52
+
53
+ ## [63.0.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v62.0.0...v63.0.0) (2025-12-06)
54
+
55
+ ### ⚠ BREAKING CHANGES
56
+
57
+ * use eslint-plugin-import-x
58
+
59
+ ### Features
60
+
61
+ * **deps:** update eslint monorepo to ^9.39.1 ([#782](https://github.com/christophehurpeau/eslint-config-pob/issues/782))
62
+ * use eslint-plugin-import-x
63
+
64
+ ## [62.0.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v61.1.0...v62.0.0) (2025-09-11)
65
+
66
+ ### ⚠ BREAKING CHANGES
67
+
68
+ * drop node 20
69
+ * update dependencies
70
+
71
+ ### Features
72
+
73
+ * drop node 20 ([6b75dc0](https://github.com/christophehurpeau/eslint-config-pob/commit/6b75dc053da0c6b209c6afdc083dd7f096e16835))
74
+ * update dependencies ([05e6521](https://github.com/christophehurpeau/eslint-config-pob/commit/05e65216f02e7418b68643147af05be62e432c9d))
75
+
76
+ ## [61.1.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v61.0.0...v61.1.0) (2025-07-06)
77
+
78
+ ### Features
79
+
80
+ * **deps:** update typescript-eslint monorepo to v8.35.1 ([#756](https://github.com/christophehurpeau/eslint-config-pob/issues/756)) ([5d164d6](https://github.com/christophehurpeau/eslint-config-pob/commit/5d164d6975ab90bf96924b6d6ae04a07e45fe821))
81
+
82
+ ## [60.1.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v60.0.0...v60.1.0) (2025-05-29)
83
+
84
+ Note: no notable changes
85
+
86
+
87
+ ## [60.0.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v59.8.1...v60.0.0) (2025-04-27)
88
+
89
+ Note: no notable changes
90
+
91
+
92
+ ## [59.8.1](https://github.com/christophehurpeau/eslint-config-pob/compare/v59.8.0...v59.8.1) (2025-03-16)
93
+
94
+ ### Bug Fixes
95
+
96
+ * **deps:** update typescript-eslint monorepo to v8.26.1 ([#741](https://github.com/christophehurpeau/eslint-config-pob/issues/741)) ([922f710](https://github.com/christophehurpeau/eslint-config-pob/commit/922f710e77d7a4797594a6b743d17c3885c550a3))
97
+
98
+ ## [59.8.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v59.7.0...v59.8.0) (2025-03-09)
99
+
100
+ ### Features
101
+
102
+ * add colorette ([82adbbf](https://github.com/christophehurpeau/eslint-config-pob/commit/82adbbf5081a38301ef962b3f0073e1e2565d8ee))
103
+ * update typescript ([090972e](https://github.com/christophehurpeau/eslint-config-pob/commit/090972ef3c80511454a8608890d33133dbc3570a))
104
+
105
+ ## [59.7.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v59.6.0...v59.7.0) (2025-02-17)
106
+
107
+ ### Features
108
+
109
+ * add rule forbid-non-native-node-imports ([0fde6ee](https://github.com/christophehurpeau/eslint-config-pob/commit/0fde6ee308683df6f3804616a216bb7d70969700))
110
+ * update eslint-plugin-unicorn ([c8c18f2](https://github.com/christophehurpeau/eslint-config-pob/commit/c8c18f25dde42b9b69d0178d876c4eebe4cce017))
111
+
112
+ ## [59.6.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v59.5.1...v59.6.0) (2025-02-06)
113
+
114
+ ### Features
115
+
116
+ * **deps:** update typescript-eslint monorepo ([#719](https://github.com/christophehurpeau/eslint-config-pob/issues/719)) ([46cd7fc](https://github.com/christophehurpeau/eslint-config-pob/commit/46cd7fc1e995952d49f3a00f701590158dfb50a4))
117
+
118
+ ## [59.5.1](https://github.com/christophehurpeau/eslint-config-pob/compare/v59.5.0...v59.5.1) (2025-02-02)
119
+
120
+ Note: no notable changes
121
+
122
+
123
+ ## [59.5.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v59.4.0...v59.5.0) (2025-02-02)
124
+
125
+ Note: no notable changes
126
+
127
+
128
+ ## [59.4.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v59.3.2...v59.4.0) (2025-01-17)
129
+
130
+ ### Features
131
+
132
+ * json ([bae42fa](https://github.com/christophehurpeau/eslint-config-pob/commit/bae42fa92ed5ee37a0f98aeaea0e6a74f2f0c608))
133
+
134
+ ## [59.3.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v59.2.0...v59.3.0) (2024-12-27)
135
+
136
+ ### Bug Fixes
137
+
138
+ * **deps:** update typescript-eslint monorepo to v8.18.2 ([#717](https://github.com/christophehurpeau/eslint-config-pob/issues/717)) ([e5f787d](https://github.com/christophehurpeau/eslint-config-pob/commit/e5f787d320b3424c37e0641c4574c3259dad0d25))
139
+
140
+ ## [59.2.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v59.1.2...v59.2.0) (2024-12-17)
141
+
142
+ ### Features
143
+
144
+ * **deps:** update typescript-eslint monorepo ([#706](https://github.com/christophehurpeau/eslint-config-pob/issues/706)) ([5c50d85](https://github.com/christophehurpeau/eslint-config-pob/commit/5c50d857bd2d4f93160cb70e594445a57f4d7fe9))
145
+
146
+ ### Bug Fixes
147
+
148
+ * **deps:** update typescript-eslint monorepo to v8.18.1 ([#714](https://github.com/christophehurpeau/eslint-config-pob/issues/714)) ([c78c411](https://github.com/christophehurpeau/eslint-config-pob/commit/c78c4114186e79e049d54a10e629ffa796dfa64a))
149
+
150
+ ## [59.0.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v58.1.0...v59.0.0) (2024-11-26)
151
+
152
+ ### ⚠ BREAKING CHANGES
153
+
154
+ * drop node 18
155
+
156
+ ### Miscellaneous Chores
157
+
158
+ * update dev deps and require node 20 ([cbe9fb1](https://github.com/christophehurpeau/eslint-config-pob/commit/cbe9fb15f719edb50251f925ff19b987a159b530))
159
+
160
+ ## [58.0.2](https://github.com/christophehurpeau/eslint-config-pob/compare/v58.0.1...v58.0.2) (2024-09-07)
161
+
162
+ Note: no notable changes
163
+
164
+
165
+ ## [58.0.1](https://github.com/christophehurpeau/eslint-config-pob/compare/v58.0.0...v58.0.1) (2024-08-25)
166
+
167
+ Note: no notable changes
168
+
169
+
170
+ ## [58.0.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v57.3.1...v58.0.0) (2024-08-14)
171
+
172
+ ### ⚠ BREAKING CHANGES
173
+
174
+ * update eslint v9
175
+
176
+ ### Features
177
+
178
+ * update eslint v9 ([6f8647f](https://github.com/christophehurpeau/eslint-config-pob/commit/6f8647f45589e9a9387bd38b9881fd2035ab32ad))
179
+
180
+ ## [57.0.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.1.0...v57.0.0) (2024-08-11)
181
+
182
+ ### ⚠ BREAKING CHANGES
183
+
184
+ * use flat config
185
+
186
+ ### Features
187
+
188
+ * use flat config ([b0bda47](https://github.com/christophehurpeau/eslint-config-pob/commit/b0bda47976ec40a30679988c603d425f9b75346f))
189
+
190
+ ### Bug Fixes
191
+
192
+ * fix error message ([a1abcef](https://github.com/christophehurpeau/eslint-config-pob/commit/a1abcef0a1e6711d121a567f045d7fcaf8516a6c))
193
+
194
+ ## [56.1.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2024-07-27)
195
+
196
+ ### Features
197
+
198
+ * pob plugin ([fd99ec8](https://github.com/christophehurpeau/eslint-config-pob/commit/fd99ec8711409b3bc9b960f7eb2e0b2e67984381))
199
+
@@ -17,21 +17,55 @@ export default {
17
17
  },
18
18
 
19
19
  create(context) {
20
- const checkNode = (node, messageId) => {
20
+ const sourceCode = context.sourceCode;
21
+
22
+ const checkImportSpecifier = (node, messageId) => {
21
23
  const importDeclaration = node.parent;
22
- const importSource = importDeclaration.source.value.trim();
24
+ const importSource =
25
+ importDeclaration &&
26
+ importDeclaration.source &&
27
+ importDeclaration.source.value &&
28
+ String(importDeclaration.source.value).trim();
23
29
  if (importSource !== "react") return;
24
- context.report({
25
- node,
26
- messageId,
27
- });
30
+ context.report({ node, messageId });
31
+ };
32
+
33
+ const isReactDeclaredInScope = (node) => {
34
+ const scope = sourceCode.getScope ? sourceCode.getScope(node) : null;
35
+ return (
36
+ scope &&
37
+ ((scope.set && scope.set.get("React")) ||
38
+ (scope.variables && scope.variables.find((v) => v.name === "React")))
39
+ );
28
40
  };
41
+
42
+ const checkReactUsage = (node, messageId = "namespace") => {
43
+ if (!isReactDeclaredInScope(node)) {
44
+ context.report({ node, messageId });
45
+ }
46
+ };
47
+
29
48
  return {
30
- ImportNamespaceSpecifier: (node) => {
31
- checkNode(node, "namespace");
49
+ ImportNamespaceSpecifier: (node) =>
50
+ checkImportSpecifier(node, "namespace"),
51
+ ImportDefaultSpecifier: (node) => checkImportSpecifier(node, "default"),
52
+ MemberExpression: (node) => {
53
+ if (
54
+ node.object &&
55
+ node.object.type === "Identifier" &&
56
+ node.object.name === "React"
57
+ ) {
58
+ checkReactUsage(node.object, "namespace");
59
+ }
32
60
  },
33
- ImportDefaultSpecifier: (node) => {
34
- checkNode(node, "default");
61
+ TSQualifiedName: (node) => {
62
+ if (
63
+ node.left &&
64
+ node.left.type === "Identifier" &&
65
+ node.left.name === "React"
66
+ ) {
67
+ checkReactUsage(node.left, "namespace");
68
+ }
35
69
  },
36
70
  };
37
71
  },
@@ -28,6 +28,34 @@ ruleTester.run("react-named-import", rule, {
28
28
  },
29
29
  ],
30
30
  invalid: [
31
+ {
32
+ code: `
33
+ export const simpleElement: React.ReactNode = <p>paragraph</p>;
34
+ `,
35
+ errors: [
36
+ {
37
+ messageId: "namespace",
38
+ line: 2,
39
+ column: 35,
40
+ },
41
+ ],
42
+ },
43
+ {
44
+ code: `
45
+ import { ReactNode } from 'react';
46
+ import * as React from 'react';
47
+
48
+ export const a: ReactNode = <p>ok</p>;
49
+ export const b: React.ReactNode = <p>bad</p>;
50
+ `,
51
+ errors: [
52
+ {
53
+ messageId: "namespace",
54
+ line: 3,
55
+ column: 14,
56
+ },
57
+ ],
58
+ },
31
59
  {
32
60
  code: `
33
61
  import React from 'react';
@@ -37,6 +65,8 @@ ruleTester.run("react-named-import", rule, {
37
65
  errors: [
38
66
  {
39
67
  messageId: "default",
68
+ line: 2,
69
+ column: 14,
40
70
  },
41
71
  ],
42
72
  },
@@ -49,6 +79,8 @@ ruleTester.run("react-named-import", rule, {
49
79
  errors: [
50
80
  {
51
81
  messageId: "namespace",
82
+ line: 2,
83
+ column: 14,
52
84
  },
53
85
  ],
54
86
  },
@@ -61,6 +93,22 @@ ruleTester.run("react-named-import", rule, {
61
93
  errors: [
62
94
  {
63
95
  messageId: "namespace",
96
+ line: 2,
97
+ column: 19,
98
+ },
99
+ ],
100
+ },
101
+ {
102
+ code: `
103
+ import * as R from 'react';
104
+
105
+ export const simpleElement: R.ReactNode = <p>paragraph</p>;
106
+ `,
107
+ errors: [
108
+ {
109
+ messageId: "namespace",
110
+ line: 2,
111
+ column: 14,
64
112
  },
65
113
  ],
66
114
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pob/eslint-plugin",
3
- "version": "65.3.0",
3
+ "version": "65.5.0",
4
4
  "description": "eslint plugin for react",
5
5
  "keywords": [],
6
6
  "author": "Christophe Hurpeau <christophe@hurpeau.com> (https://christophe.hurpeau.com)",
@@ -29,13 +29,13 @@
29
29
  ],
30
30
  "scripts": {
31
31
  "lint": "yarn run lint:eslint",
32
- "lint:eslint": "yarn ../.. run eslint --quiet '@pob/eslint-plugin'"
32
+ "lint:eslint": "yarn '../..' run eslint --quiet '@pob/eslint-plugin'"
33
33
  },
34
34
  "pob": {},
35
35
  "prettier": "@pob/root/prettier-config",
36
36
  "peerDependencies": {
37
37
  "eslint": "^9.39.1 || ^10.0.2",
38
- "typescript": ">=5.0.0 <6.0.0"
38
+ "typescript": ">=5.0.0 <7.0.0"
39
39
  },
40
40
  "peerDependenciesMeta": {
41
41
  "typescript": {
@@ -43,14 +43,14 @@
43
43
  }
44
44
  },
45
45
  "dependencies": {
46
- "@typescript-eslint/utils": "8.57.1",
46
+ "@typescript-eslint/utils": "8.59.1",
47
47
  "eslint-plugin-react": "^7.37.5"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "24.10.1",
51
- "@typescript-eslint/rule-tester": "8.57.1",
52
- "eslint": "10.0.2",
53
- "typescript": "5.9.3",
54
- "typescript-eslint": "8.57.1"
51
+ "@typescript-eslint/rule-tester": "8.59.1",
52
+ "eslint": "10.2.1",
53
+ "typescript": "6.0.3",
54
+ "typescript-eslint": "8.59.1"
55
55
  }
56
- }
56
+ }