Skip to content

Commit f1e64e3

Browse files
committed
release: 0.9.7
1 parent 8496dc2 commit f1e64e3

File tree

78 files changed

+265
-309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+265
-309
lines changed

CHANGELOG.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,72 @@
1+
## v0.9.7 (Sun Dec 17 2023)
2+
3+
### Release Notes
4+
5+
#### Fix where functions in `<Component footer={() => <div />} />` or `<Component Footer={() => <div />} />` are treated as components
6+
7+
#### Fix false positive in rule `react/no-unstable-nested-components`
8+
9+
#### Fix false positive in rule `debug/function-component`
10+
11+
#### ⚠️ Change `ESLintReactSettingsSchema`
12+
13+
#### ⚠️ Rule `named-convention/filename-extension` rename `rule` option to `allow`
14+
15+
#### Rule `named-convention/filename` add `extensions` option
16+
17+
#### Rule `named-convention/filename-extension` add `extensions` option
18+
19+
#### Rules now support reading JSX extensions from `settings.eslintReact.jsx.extensions`
20+
21+
#### Replace ❌ Incorrect and ✅ Correct with Failing and Passing in rule docs
22+
23+
---
24+
25+
#### 🐛 Bug Fix
26+
27+
- `@eslint-react/eslint-plugin-react`
28+
- Fix where functions in `<Component footer={() => <div />} />` or `<Component Footer={() => <div />} />` are treated as components
29+
- Fix false positive in rule `react/no-unstable-nested-components`.
30+
31+
- `@eslint-react/eslint-plugin-debug`
32+
- Fix false positive in rule `debug/function-component`.
33+
34+
#### 📝 Documentation
35+
36+
- `@eslint-react/eslint-plugin-naming-convention`
37+
- Replace ❌ Incorrect and ✅ Correct with Failing and Passing in rule docs.
38+
- Update default rule option in `named-convention/filename` to `PascalCase`.
39+
40+
#### 🏠 Internal
41+
42+
- `@eslint-react/eslint-plugin-naming-convention`
43+
- ⚠️ Rule `named-convention/filename-extension` rename `rule` option to `allow`.
44+
- Rule `named-convention/filename` add `extensions` option.
45+
- Rule `named-convention/filename-extension` add `extensions` option.
46+
47+
- `@eslint-react/core`
48+
- Add `alias` argument to `isReactHookCallWithName`.
49+
- Add `isReactHook` function.
50+
51+
- `@eslint-react/shared`
52+
- ⚠️ Change `ESLintReactSettingsSchema`.
53+
- Move utils from `@eslint-react/shared` to `@eslint-react/utils`.
54+
- Remove `JSX_EXTENSIONS` from `@eslint-react/shared`.
55+
56+
- `@eslint-react/monorepo`
57+
- Add `@eslint-react/utils` package.
58+
- Add `format:package-json` script.
59+
- Update `bun` to `1.0.17`.
60+
- Update `vitest` to `1.0.4`.
61+
- Update `eslint-config-with-tsconfig` to `2.9.160`.
62+
- Minor improvements.
63+
64+
#### Authors: 1
65+
66+
- Eva1ent ([@Rel1cx](https://github.com/Rel1cx))
67+
68+
---
69+
170
## v0.9.7-beta.2 (Sat Dec 16 2023)
271

372
### Release Notes

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.9.7-beta.2
1+
0.9.7

examples/with-flat-config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "with-flat-config",
3-
"version": "0.9.7-beta.2",
3+
"version": "0.9.7",
44
"private": true,
55
"type": "module",
66
"scripts": {

examples/with-legacy-config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "with-legacy-config",
3-
"version": "0.9.7-beta.2",
3+
"version": "0.9.7",
44
"private": true,
55
"scripts": {
66
"build": "tsc && vite build",

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": "0.9.7-beta.2",
3+
"version": "0.9.7",
44
"description": "ESLint React's monorepo. More than 50 ESLint rules to catch common mistakes and improve your React code. Built (mostly) from scratch.",
55
"keywords": [
66
"eslint",

packages/ast/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/ast",
3-
"version": "0.9.7-beta.2",
3+
"version": "0.9.7",
44
"description": "ESLint React's TSESTree AST primitive utility module.",
55
"homepage": "https://github.com/rel1cx/eslint-react",
66
"bugs": {

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": "0.9.7-beta.2",
3+
"version": "0.9.7",
44
"description": "ESLint React's ESLint utility module for static analysis of React core API and Patterns.",
55
"homepage": "https://github.com/rel1cx/eslint-react",
66
"bugs": {

packages/core/src/component/component-collector.ts

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import {
2+
is,
23
isFunctionOfClassMethod,
34
isFunctionOfClassProperty,
45
isFunctionOfObjectMethod,
6+
isOneOf,
57
NodeType,
8+
traverseUp,
69
type TSESTreeFunction,
710
unsafeIsMapCall,
811
} from "@eslint-react/ast";
912
import { getPragmaFromContext, isChildrenOfCreateElement, isJSXValue } from "@eslint-react/jsx";
10-
import { M, MutList, MutRef, O } from "@eslint-react/tools";
13+
import { F, M, MutList, MutRef, O } from "@eslint-react/tools";
1114
import type { RuleContext } from "@eslint-react/types";
1215
import { uid } from "@eslint-react/utils";
1316
import { type TSESTree } from "@typescript-eslint/types";
@@ -39,7 +42,23 @@ function hasValidHierarchy(node: TSESTreeFunction, context: RuleContext, hint: b
3942
return false;
4043
}
4144

42-
return !(hint & ERComponentCollectorHint.SkipClassProperty && isFunctionOfClassProperty(node.parent));
45+
if (hint & ERComponentCollectorHint.SkipClassProperty && isFunctionOfClassProperty(node.parent)) {
46+
return false;
47+
}
48+
49+
return !F.pipe(
50+
traverseUp(
51+
node,
52+
isOneOf([
53+
NodeType.JSXExpressionContainer,
54+
NodeType.ArrowFunctionExpression,
55+
NodeType.FunctionExpression,
56+
NodeType.Property,
57+
NodeType.ClassBody,
58+
]),
59+
),
60+
O.exists(is(NodeType.JSXExpressionContainer)),
61+
);
4362
}
4463

4564
function getComponentFlag(initPath: ERFunctionComponent["initPath"], pragma: string) {
@@ -107,14 +126,14 @@ export function componentCollector(
107126
MutList.pop(functionStack);
108127
MutList.append(functionStack, [currentFn, true, []]);
109128

129+
const initPath = getComponentInitPath(currentFn);
110130
const id = getFunctionComponentIdentifier(currentFn, context);
111-
const key = uid.rnd();
112131
const name = O.flatMapNullable(
113132
id,
114133
getComponentNameFromIdentifier,
115134
);
116-
const initPath = getComponentInitPath(currentFn);
117135

136+
const key = uid.rnd();
118137
components.set(key, {
119138
_: key,
120139
id,
@@ -148,14 +167,14 @@ export function componentCollector(
148167
return;
149168
}
150169

170+
const initPath = getComponentInitPath(currentFn);
151171
const id = getFunctionComponentIdentifier(currentFn, context);
152-
const key = uid.rnd();
153172
const name = O.flatMapNullable(
154173
id,
155174
getComponentNameFromIdentifier,
156175
);
157-
const initPath = getComponentInitPath(currentFn);
158176

177+
const key = uid.rnd();
159178
components.set(key, {
160179
_: key,
161180
id,

packages/eslint-plugin-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-react/eslint-plugin-debug",
3-
"version": "0.9.7-beta.2",
3+
"version": "0.9.7",
44
"description": "ESLint React's ESLint plugin for debugging related rules.",
55
"homepage": "https://github.com/rel1cx/eslint-react",
66
"bugs": {

packages/eslint-plugin-debug/src/rules/function-component.spec.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -791,15 +791,6 @@ ruleTester.run(RULE_NAME, rule, {
791791
hookCalls: 0,
792792
},
793793
},
794-
{
795-
messageId: "FUNCTION_COMPONENT",
796-
data: {
797-
name: "anonymous",
798-
memo: false,
799-
forwardRef: false,
800-
hookCalls: 0,
801-
},
802-
},
803794
],
804795
},
805796
{
@@ -877,15 +868,6 @@ ruleTester.run(RULE_NAME, rule, {
877868
hookCalls: 0,
878869
},
879870
},
880-
{
881-
messageId: "FUNCTION_COMPONENT",
882-
data: {
883-
name: "anonymous",
884-
memo: false,
885-
forwardRef: false,
886-
hookCalls: 0,
887-
},
888-
},
889871
],
890872
},
891873
{
@@ -1006,15 +988,6 @@ ruleTester.run(RULE_NAME, rule, {
1006988
hookCalls: 0,
1007989
},
1008990
},
1009-
{
1010-
messageId: "FUNCTION_COMPONENT",
1011-
data: {
1012-
name: "anonymous",
1013-
memo: false,
1014-
forwardRef: false,
1015-
hookCalls: 0,
1016-
},
1017-
},
1018991
],
1019992
},
1020993
{

0 commit comments

Comments
 (0)