Skip to content

Commit 20838bb

Browse files
committed
refactor: remove unused code
1 parent f24572b commit 20838bb

File tree

7 files changed

+7
-143
lines changed

7 files changed

+7
-143
lines changed

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import type { RuleContext, RuleFeature } from "@eslint-react/kit";
2-
import type { TSESTree } from "@typescript-eslint/utils";
32
import type { RuleListener } from "@typescript-eslint/utils/ts-eslint";
43
import type { CamelCase } from "string-ts";
5-
import * as AST from "@eslint-react/ast";
64
import * as ER from "@eslint-react/core";
75
import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
86

@@ -14,12 +12,6 @@ export const RULE_FEATURES = [] as const satisfies RuleFeature[];
1412

1513
export type MessageID = CamelCase<typeof RULE_NAME>;
1614

17-
function isUnsafeComponentWillMount(node: TSESTree.ClassElement) {
18-
return AST.isMethodOrProperty(node)
19-
&& node.key.type === T.Identifier
20-
&& node.key.name === "UNSAFE_componentWillMount";
21-
}
22-
2315
export default createRule<[], MessageID>({
2416
meta: {
2517
type: "problem",
@@ -50,7 +42,7 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
5042
const { body } = component.body;
5143

5244
for (const member of body) {
53-
if (isUnsafeComponentWillMount(member)) {
45+
if (ER.isUnsafeComponentWillMount(member)) {
5446
context.report({
5547
messageId: "noUnsafeComponentWillMount",
5648
node: member,

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import type { RuleContext, RuleFeature } from "@eslint-react/kit";
2-
import type { TSESTree } from "@typescript-eslint/utils";
32
import type { RuleListener } from "@typescript-eslint/utils/ts-eslint";
43
import type { CamelCase } from "string-ts";
5-
import * as AST from "@eslint-react/ast";
64
import * as ER from "@eslint-react/core";
7-
import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
85

96
import { createRule } from "../utils";
107

@@ -14,12 +11,6 @@ export const RULE_FEATURES = [] as const satisfies RuleFeature[];
1411

1512
export type MessageID = CamelCase<typeof RULE_NAME>;
1613

17-
function isUnsafeComponentWillReceiveProps(node: TSESTree.ClassElement) {
18-
return AST.isMethodOrProperty(node)
19-
&& node.key.type === T.Identifier
20-
&& node.key.name === "UNSAFE_componentWillReceiveProps";
21-
}
22-
2314
export default createRule<[], MessageID>({
2415
meta: {
2516
type: "problem",
@@ -52,7 +43,7 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
5243
const { body } = component.body;
5344

5445
for (const member of body) {
55-
if (isUnsafeComponentWillReceiveProps(member)) {
46+
if (ER.isUnsafeComponentWillReceiveProps(member)) {
5647
context.report({
5748
messageId: "noUnsafeComponentWillReceiveProps",
5849
node: member,

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import type { RuleContext, RuleFeature } from "@eslint-react/kit";
2-
import type { TSESTree } from "@typescript-eslint/utils";
32
import type { RuleListener } from "@typescript-eslint/utils/ts-eslint";
43
import type { CamelCase } from "string-ts";
5-
import * as AST from "@eslint-react/ast";
64
import * as ER from "@eslint-react/core";
7-
import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
85

96
import { createRule } from "../utils";
107

@@ -14,12 +11,6 @@ export const RULE_FEATURES = [] as const satisfies RuleFeature[];
1411

1512
export type MessageID = CamelCase<typeof RULE_NAME>;
1613

17-
function isUnsafeComponentWillUpdate(node: TSESTree.ClassElement) {
18-
return AST.isMethodOrProperty(node)
19-
&& node.key.type === T.Identifier
20-
&& node.key.name === "UNSAFE_componentWillUpdate";
21-
}
22-
2314
export default createRule<[], MessageID>({
2415
meta: {
2516
type: "problem",
@@ -50,7 +41,7 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
5041
const { body } = component.body;
5142

5243
for (const member of body) {
53-
if (isUnsafeComponentWillUpdate(member)) {
44+
if (ER.isUnsafeComponentWillUpdate(member)) {
5445
context.report({
5546
messageId: "noUnsafeComponentWillUpdate",
5647
node: member,

packages/shared/docs/functions/coerceSettings.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -144,34 +144,6 @@ This allows to specify a custom import location for React when not using the off
144144
`"@pika/react"`
145145
```
146146

147-
### ~~jsxPragma?~~
148-
149-
> `optional` **jsxPragma**: `string`
150-
151-
The identifier that's used for JSX Element creation.
152-
153-
#### Default
154-
155-
`"createElement"`
156-
157-
#### Deprecated
158-
159-
### ~~jsxPragmaFrag?~~
160-
161-
> `optional` **jsxPragmaFrag**: `string`
162-
163-
The identifier that's used for JSX fragment elements.
164-
165-
#### Description
166-
167-
This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
168-
169-
#### Default
170-
171-
`"Fragment"`
172-
173-
#### Deprecated
174-
175147
### polymorphicPropName?
176148

177149
> `optional` **polymorphicPropName**: `string`

packages/shared/docs/functions/decodeSettings.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -144,34 +144,6 @@ This allows to specify a custom import location for React when not using the off
144144
`"@pika/react"`
145145
```
146146

147-
### ~~jsxPragma?~~
148-
149-
> `optional` **jsxPragma**: `string`
150-
151-
The identifier that's used for JSX Element creation.
152-
153-
#### Default
154-
155-
`"createElement"`
156-
157-
#### Deprecated
158-
159-
### ~~jsxPragmaFrag?~~
160-
161-
> `optional` **jsxPragmaFrag**: `string`
162-
163-
The identifier that's used for JSX fragment elements.
164-
165-
#### Description
166-
167-
This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
168-
169-
#### Default
170-
171-
`"Fragment"`
172-
173-
#### Deprecated
174-
175147
### polymorphicPropName?
176148

177149
> `optional` **polymorphicPropName**: `string`

packages/shared/docs/functions/isESLintReactSettings.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Function: isESLintReactSettings()
88

9-
> **isESLintReactSettings**(`settings`): `settings is { additionalComponents?: { as?: string; attributes?: { as?: string; defaultValue?: string; name: string }[]; name: string }[]; additionalHooks?: { use?: string[]; useActionState?: string[]; useCallback?: string[]; useContext?: string[]; useDebugValue?: string[]; useDeferredValue?: string[]; useEffect?: string[]; useFormStatus?: string[]; useId?: string[]; useImperativeHandle?: string[]; useInsertionEffect?: string[]; useLayoutEffect?: string[]; useMemo?: string[]; useOptimistic?: string[]; useReducer?: string[]; useRef?: string[]; useState?: string[]; useSyncExternalStore?: string[]; useTransition?: string[] }; importSource?: string; jsxPragma?: string; jsxPragmaFrag?: string; polymorphicPropName?: string; version?: string }`
9+
> **isESLintReactSettings**(`settings`): `settings is { additionalComponents?: { as?: string; attributes?: { as?: string; defaultValue?: string; name: string }[]; name: string }[]; additionalHooks?: { use?: string[]; useActionState?: string[]; useCallback?: string[]; useContext?: string[]; useDebugValue?: string[]; useDeferredValue?: string[]; useEffect?: string[]; useFormStatus?: string[]; useId?: string[]; useImperativeHandle?: string[]; useInsertionEffect?: string[]; useLayoutEffect?: string[]; useMemo?: string[]; useOptimistic?: string[]; useReducer?: string[]; useRef?: string[]; useState?: string[]; useSyncExternalStore?: string[]; useTransition?: string[] }; importSource?: string; polymorphicPropName?: string; version?: string }`
1010
1111
## Parameters
1212

@@ -16,4 +16,4 @@
1616

1717
## Returns
1818

19-
`settings is { additionalComponents?: { as?: string; attributes?: { as?: string; defaultValue?: string; name: string }[]; name: string }[]; additionalHooks?: { use?: string[]; useActionState?: string[]; useCallback?: string[]; useContext?: string[]; useDebugValue?: string[]; useDeferredValue?: string[]; useEffect?: string[]; useFormStatus?: string[]; useId?: string[]; useImperativeHandle?: string[]; useInsertionEffect?: string[]; useLayoutEffect?: string[]; useMemo?: string[]; useOptimistic?: string[]; useReducer?: string[]; useRef?: string[]; useState?: string[]; useSyncExternalStore?: string[]; useTransition?: string[] }; importSource?: string; jsxPragma?: string; jsxPragmaFrag?: string; polymorphicPropName?: string; version?: string }`
19+
`settings is { additionalComponents?: { as?: string; attributes?: { as?: string; defaultValue?: string; name: string }[]; name: string }[]; additionalHooks?: { use?: string[]; useActionState?: string[]; useCallback?: string[]; useContext?: string[]; useDebugValue?: string[]; useDeferredValue?: string[]; useEffect?: string[]; useFormStatus?: string[]; useId?: string[]; useImperativeHandle?: string[]; useInsertionEffect?: string[]; useLayoutEffect?: string[]; useMemo?: string[]; useOptimistic?: string[]; useReducer?: string[]; useRef?: string[]; useState?: string[]; useSyncExternalStore?: string[]; useTransition?: string[] }; importSource?: string; polymorphicPropName?: string; version?: string }`

packages/shared/docs/functions/normalizeSettings.md

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -140,34 +140,6 @@ This allows to specify a custom import location for React when not using the off
140140
`"@pika/react"`
141141
```
142142

143-
#### jsxPragma?
144-
145-
`string` = `...`
146-
147-
The identifier that's used for JSX Element creation.
148-
149-
**Default**
150-
151-
`"createElement"`
152-
153-
**Deprecated**
154-
155-
#### jsxPragmaFrag?
156-
157-
`string` = `...`
158-
159-
The identifier that's used for JSX fragment elements.
160-
161-
**Description**
162-
163-
This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
164-
165-
**Default**
166-
167-
`"Fragment"`
168-
169-
**Deprecated**
170-
171143
#### polymorphicPropName?
172144

173145
`string` = `"as"`
@@ -203,6 +175,8 @@ If `importSource` is specified, an equivalent version of React should be provide
203175

204176
## Returns
205177

178+
`object`
179+
206180
### additionalHooks
207181

208182
> **additionalHooks**: `object`
@@ -291,34 +265,6 @@ If `importSource` is specified, an equivalent version of React should be provide
291265

292266
> **importSource**: `string`
293267
294-
### ~~jsxPragma?~~
295-
296-
> `readonly` `optional` **jsxPragma**: `string`
297-
298-
The identifier that's used for JSX Element creation.
299-
300-
#### Default
301-
302-
`"createElement"`
303-
304-
#### Deprecated
305-
306-
### ~~jsxPragmaFrag?~~
307-
308-
> `readonly` `optional` **jsxPragmaFrag**: `string`
309-
310-
The identifier that's used for JSX fragment elements.
311-
312-
#### Description
313-
314-
This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
315-
316-
#### Default
317-
318-
`"Fragment"`
319-
320-
#### Deprecated
321-
322268
### polymorphicPropName
323269

324270
> **polymorphicPropName**: `string`

0 commit comments

Comments
 (0)