Skip to content

Commit bc89f35

Browse files
authored
Merge branch 'main' into context-name
2 parents fb00e8f + c798e62 commit bc89f35

12 files changed

+13
-13
lines changed

packages/plugins/eslint-plugin-react-x/src/rules/no-component-will-mount.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const RULE_FEATURES = [
1717
export type MessageID = CamelCase<typeof RULE_NAME>;
1818

1919
function isComponentWillMount(node: TSESTree.ClassElement) {
20-
return AST.isOneOf([T.MethodDefinition, T.PropertyDefinition])(node)
20+
return AST.isMethodOrProperty(node)
2121
&& node.key.type === T.Identifier
2222
&& node.key.name === "componentWillMount";
2323
}

packages/plugins/eslint-plugin-react-x/src/rules/no-component-will-receive-props.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const RULE_FEATURES = [
1717
export type MessageID = CamelCase<typeof RULE_NAME>;
1818

1919
function isComponentWillUpdate(node: TSESTree.ClassElement) {
20-
return AST.isOneOf([T.MethodDefinition, T.PropertyDefinition])(node)
20+
return AST.isMethodOrProperty(node)
2121
&& node.key.type === T.Identifier
2222
&& node.key.name === "componentWillReceiveProps";
2323
}

packages/plugins/eslint-plugin-react-x/src/rules/no-component-will-update.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const RULE_FEATURES = [
1717
export type MessageID = CamelCase<typeof RULE_NAME>;
1818

1919
function isComponentWillUpdate(node: TSESTree.ClassElement) {
20-
return AST.isOneOf([T.MethodDefinition, T.PropertyDefinition])(node)
20+
return AST.isMethodOrProperty(node)
2121
&& node.key.type === T.Identifier
2222
&& node.key.name === "componentWillUpdate";
2323
}

packages/plugins/eslint-plugin-react-x/src/rules/no-direct-mutation-state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function isConstructorFunction(
4747
node: TSESTree.Node,
4848
): node is TSESTree.FunctionDeclaration | TSESTree.FunctionExpression {
4949
return AST.isOneOf([T.FunctionDeclaration, T.FunctionExpression])(node)
50-
&& AST.isOneOf([T.MethodDefinition, T.PropertyDefinition])(node.parent)
50+
&& AST.isMethodOrProperty(node.parent)
5151
&& node.parent.key.type === T.Identifier
5252
&& node.parent.key.name === "constructor";
5353
}

packages/plugins/eslint-plugin-react-x/src/rules/no-redundant-should-component-update.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const RULE_FEATURES = [
1616
export type MessageID = CamelCase<typeof RULE_NAME>;
1717

1818
function isShouldComponentUpdate(node: TSESTree.ClassElement) {
19-
return AST.isOneOf([T.MethodDefinition, T.PropertyDefinition])(node)
19+
return AST.isMethodOrProperty(node)
2020
&& node.key.type === T.Identifier
2121
&& node.key.name === "shouldComponentUpdate";
2222
}

packages/plugins/eslint-plugin-react-x/src/rules/no-set-state-in-component-did-mount.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const RULE_FEATURES = [
1616
export type MessageID = CamelCase<typeof RULE_NAME>;
1717

1818
function isComponentDidMount(node: TSESTree.Node) {
19-
return AST.isOneOf([T.MethodDefinition, T.PropertyDefinition])(node)
19+
return AST.isMethodOrProperty(node)
2020
&& node.key.type === T.Identifier
2121
&& node.key.name === "componentDidMount";
2222
}

packages/plugins/eslint-plugin-react-x/src/rules/no-set-state-in-component-did-update.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const RULE_FEATURES = [
1616
export type MessageID = CamelCase<typeof RULE_NAME>;
1717

1818
function isComponentDidUpdate(node: TSESTree.Node) {
19-
return AST.isOneOf([T.MethodDefinition, T.PropertyDefinition])(node)
19+
return AST.isMethodOrProperty(node)
2020
&& node.key.type === T.Identifier
2121
&& node.key.name === "componentDidUpdate";
2222
}

packages/plugins/eslint-plugin-react-x/src/rules/no-set-state-in-component-will-update.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const RULE_FEATURES = [
1616
export type MessageID = CamelCase<typeof RULE_NAME>;
1717

1818
function isComponentWillUpdate(node: TSESTree.Node) {
19-
return AST.isOneOf([T.MethodDefinition, T.PropertyDefinition])(node)
19+
return AST.isMethodOrProperty(node)
2020
&& node.key.type === T.Identifier
2121
&& node.key.name === "componentWillUpdate";
2222
}

packages/plugins/eslint-plugin-react-x/src/rules/no-unsafe-component-will-mount.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const RULE_FEATURES = [
1616
export type MessageID = CamelCase<typeof RULE_NAME>;
1717

1818
function isUnsafeComponentWillMount(node: TSESTree.ClassElement) {
19-
return AST.isOneOf([T.MethodDefinition, T.PropertyDefinition])(node)
19+
return AST.isMethodOrProperty(node)
2020
&& node.key.type === T.Identifier
2121
&& node.key.name === "UNSAFE_componentWillMount";
2222
}

packages/plugins/eslint-plugin-react-x/src/rules/no-unsafe-component-will-receive-props.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const RULE_FEATURES = [
1616
export type MessageID = CamelCase<typeof RULE_NAME>;
1717

1818
function isUnsafeComponentWillReceiveProps(node: TSESTree.ClassElement) {
19-
return AST.isOneOf([T.MethodDefinition, T.PropertyDefinition])(node)
19+
return AST.isMethodOrProperty(node)
2020
&& node.key.type === T.Identifier
2121
&& node.key.name === "UNSAFE_componentWillReceiveProps";
2222
}

0 commit comments

Comments
 (0)