Skip to content

Commit 68853ae

Browse files
committed
chore: fix lint warnings
1 parent c79d870 commit 68853ae

File tree

9 files changed

+17
-14
lines changed

9 files changed

+17
-14
lines changed

eslint.config.mts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ const config: FlatConfig[] = [
7878
"no-process-exit": "error",
7979
"no-restricted-syntax": [
8080
"error",
81-
{
82-
message: "no let",
83-
selector: "VariableDeclaration[kind=let]",
84-
},
8581
{
8682
message: "no else",
8783
selector: "IfStatement[alternate]",
@@ -90,6 +86,10 @@ const config: FlatConfig[] = [
9086
message: "no optional",
9187
selector: "TSPropertySignature[optional=true]",
9288
},
89+
{
90+
message: "no undefined",
91+
selector: "Identifier[name='undefined']",
92+
},
9393
],
9494
"no-undef": "off",
9595
"one-var": ["error", "never"],

packages/plugins/eslint-plugin-react-hooks-extra/src/rules/no-direct-set-state-in-use-effect.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export default createRule<[], MessageID>({
124124
.otherwise(() => "other");
125125
}
126126
const functionStack = MutList.make<[node: TSESTreeFunction, kind: FunctionKind]>();
127-
const effectFunctionRef = MutRef.make<TSESTreeFunction | null>(null);
127+
const effectFunctionRef = MutRef.make<null | TSESTreeFunction>(null);
128128
const effectFunctionIdentifiers: TSESTree.Identifier[] = [];
129129
const indirectFunctionCalls: TSESTree.CallExpression[] = [];
130130
const indirectSetStateCalls = new WeakMap<TSESTreeFunction, TSESTree.CallExpression[]>();
@@ -179,7 +179,7 @@ export default createRule<[], MessageID>({
179179
.otherwise(F.constVoid);
180180
},
181181
"Program:exit"() {
182-
const getSetStateCalls = (id: TSESTree.Identifier | string, initialScope: Scope.Scope) => {
182+
const getSetStateCalls = (id: string | TSESTree.Identifier, initialScope: Scope.Scope) => {
183183
return F.pipe(
184184
findVariable(id, initialScope),
185185
O.flatMap(getVariableNode(0)),

packages/plugins/eslint-plugin-react-hooks-extra/src/rules/no-direct-set-state-in-use-layout-effect.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export default createRule<[], MessageID>({
125125
.otherwise(() => "other");
126126
}
127127
const functionStack = MutList.make<[node: TSESTreeFunction, kind: FunctionKind]>();
128-
const effectFunctionRef = MutRef.make<TSESTreeFunction | null>(null);
128+
const effectFunctionRef = MutRef.make<null | TSESTreeFunction>(null);
129129
const effectFunctionIdentifiers: TSESTree.Identifier[] = [];
130130
const indirectFunctionCalls: TSESTree.CallExpression[] = [];
131131
const indirectSetStateCalls = new WeakMap<TSESTreeFunction, TSESTree.CallExpression[]>();
@@ -180,7 +180,7 @@ export default createRule<[], MessageID>({
180180
.otherwise(F.constVoid);
181181
},
182182
"Program:exit"() {
183-
const getSetStateCalls = (id: TSESTree.Identifier | string, initialScope: Scope.Scope) => {
183+
const getSetStateCalls = (id: string | TSESTree.Identifier, initialScope: Scope.Scope) => {
184184
return F.pipe(
185185
findVariable(id, initialScope),
186186
O.flatMap(getVariableNode(0)),

packages/plugins/eslint-plugin-react-naming-convention/src/rules/filename.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export type MessageID =
1515
| "FILENAME_CASE_MISMATCH_SUGGESTION"
1616
| "FILENAME_EMPTY";
1717

18-
type Case = "PascalCase" | "camelCase" | "kebab-case" | "snake_case";
18+
type Case = "camelCase" | "kebab-case" | "PascalCase" | "snake_case";
1919

2020
/* eslint-disable no-restricted-syntax */
2121
type Options = readonly [

packages/plugins/eslint-plugin-react-x/src/rules/no-missing-key.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ export default createRule<[], MessageID>({
119119
}
120120
O.map(checkExpression(fn.body), context.report);
121121
},
122+
[childrenToArraySelector]() {
123+
MutRef.set(isWithinChildrenToArrayRef, true);
124+
},
122125
JSXFragment(node) {
123126
if (MutRef.get(isWithinChildrenToArrayRef)) return;
124127
if (node.parent.type === NodeType.ArrayExpression) {
@@ -128,9 +131,6 @@ export default createRule<[], MessageID>({
128131
});
129132
}
130133
},
131-
[childrenToArraySelector]() {
132-
MutRef.set(isWithinChildrenToArrayRef, true);
133-
},
134134
};
135135
},
136136
defaultOptions: [],

packages/tools/src/helpers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export type Narrow<TType> =
1616
| { [K in keyof TType]: Narrow<TType[K]> }
1717
| (TType extends [] ? [] : never)
1818
| (TType extends Function ? TType : never)
19+
// eslint-disable-next-line perfectionist/sort-union-types
1920
| (TType extends bigint | boolean | number | string ? TType : never);
2021

2122
/**

packages/utilities/ast/src/get-nested-return-statements.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Pred } from "@eslint-react/tools";
12
import type { TSESTree } from "@typescript-eslint/types";
23

34
import { NodeType } from "./types";
@@ -12,7 +13,7 @@ export function getNestedReturnStatements(node: TSESTree.Node): readonly TSESTre
1213
if (node.type === NodeType.ReturnStatement) {
1314
returnStatements.push(node);
1415
}
15-
if ("body" in node && node.body !== undefined && node.body !== null) {
16+
if ("body" in node && !Pred.isNullable(node.body)) {
1617
const chunk = Array.isArray(node.body)
1718
? node.body.map(getNestedReturnStatements).flat(1)
1819
: getNestedReturnStatements(node.body);

packages/utilities/ast/typings/eslint-community-eslint-utils.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable perfectionist/sort-object-types */
12
declare module "@eslint-community/eslint-utils" {
23
export const findVariable: unknown;
34
export const getFunctionHeadLocation: unknown;

packages/utilities/jsx/src/is-jsx-value.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const DEFAULT_JSX_VALUE_HINT = 0n
4646
* @returns boolean
4747
*/
4848
export function isJSXValue(
49-
node: TSESTree.Node | null | undefined,
49+
node: null | TSESTree.Node | undefined,
5050
context: RuleContext,
5151
hint: bigint = DEFAULT_JSX_VALUE_HINT,
5252
): boolean {

0 commit comments

Comments
 (0)