Skip to content

Commit 85ba140

Browse files
authored
refactor(kit): improve readability (#1071)
1 parent 8e172e0 commit 85ba140

Some content is hidden

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

54 files changed

+299
-145
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { ComponentDetectionHint } from "./component-detection-hint";
44
import type { FunctionComponent } from "./component-semantic-node";
55
import * as AST from "@eslint-react/ast";
66
import { _ } from "@eslint-react/eff";
7-
import { type RuleContext, SEL } from "@eslint-react/kit";
7+
import { type RuleContext, Selector as SEL } from "@eslint-react/kit";
88
import { getId } from "@eslint-react/shared";
99
import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
1010

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type * as AST from "@eslint-react/ast";
22
import type { RuleContext } from "@eslint-react/kit";
33
import type { TSESTree } from "@typescript-eslint/types";
44
import { _ } from "@eslint-react/eff";
5-
import { RE } from "@eslint-react/kit";
5+
import { RegExp as RE } from "@eslint-react/kit";
66

77
import { getFunctionComponentId } from "./component-id";
88

packages/plugins/eslint-plugin-react-debug/src/rules/jsx.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { RuleListener } from "@typescript-eslint/utils/ts-eslint";
22
import type { CamelCase } from "string-ts";
33
import * as ER from "@eslint-react/core";
44
import { flow } from "@eslint-react/eff";
5-
import { JsxConfig, Report, type RuleContext, type RuleFeature } from "@eslint-react/kit";
5+
import { JsxConfig, Reporter as RPT, type RuleContext, type RuleFeature } from "@eslint-react/kit";
66
import { AST_NODE_TYPES as T, type TSESTree } from "@typescript-eslint/types";
77
import { match, P } from "ts-pattern";
88
import { JsxEmit } from "typescript";
@@ -71,6 +71,6 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
7171
} as const);
7272
}
7373
return {
74-
"JSXElement, JSXFragment": flow(getReportDescriptor(context), Report.make(context).send),
74+
"JSXElement, JSXFragment": flow(getReportDescriptor(context), RPT.make(context).send),
7575
};
7676
}

packages/plugins/eslint-plugin-react-dom/src/rules/no-script-url.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { RuleContext, RuleFeature } from "@eslint-react/kit";
22
import type { RuleListener } from "@typescript-eslint/utils/ts-eslint";
33
import type { CamelCase } from "string-ts";
44
import * as ER from "@eslint-react/core";
5-
import { RE } from "@eslint-react/kit";
5+
import { RegExp as RE } from "@eslint-react/kit";
66
import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
77

88
import { createRule } from "../utils";

packages/plugins/eslint-plugin-react-dom/src/rules/no-unknown-property.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import { getSettingsFromContext } from "@eslint-react/shared";
66
import { createRule } from "../utils";
77
import { compare } from "compare-versions";
8-
import { Report } from "@eslint-react/kit";
8+
import { Reporter as RPT } from "@eslint-react/kit";
99
import type { RuleContext, RuleFeature } from "@eslint-react/kit";
1010
import type { RuleListener } from "@typescript-eslint/utils/ts-eslint";
1111

@@ -1090,7 +1090,7 @@ export default createRule({
10901090
});
10911091

10921092
export function create(context: RuleContext<MessageID, unknown[]>): RuleListener {
1093-
const report = Report.make(context);
1093+
const report = RPT.make(context);
10941094
function getIgnoreConfig() {
10951095
return context.options[0]?.ignore || DEFAULTS.ignore;
10961096
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { JSONSchema4 } from "@typescript-eslint/utils/json-schema";
44
import type { RuleListener } from "@typescript-eslint/utils/ts-eslint";
55
import * as AST from "@eslint-react/ast";
66
import * as ER from "@eslint-react/core";
7-
import { RE } from "@eslint-react/kit";
7+
import { RegExp as RE } from "@eslint-react/kit";
88

99
import { createRule } from "../utils";
1010

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
@@ -3,7 +3,7 @@ import type { RuleContext, RuleFeature } from "@eslint-react/kit";
33
import type { JSONSchema4 } from "@typescript-eslint/utils/json-schema";
44
import type { RuleListener } from "@typescript-eslint/utils/ts-eslint";
55
import path from "node:path";
6-
import { RE } from "@eslint-react/kit";
6+
import { RegExp as RE } from "@eslint-react/kit";
77
import { camelCase, kebabCase, pascalCase, snakeCase } from "string-ts";
88
import { match } from "ts-pattern";
99

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { CamelCase } from "string-ts";
44
import * as AST from "@eslint-react/ast";
55
import * as ER from "@eslint-react/core";
66
import { _ } from "@eslint-react/eff";
7-
import { Report, type RuleContext, type RuleFeature } from "@eslint-react/kit";
7+
import { Reporter as RPT, type RuleContext, type RuleFeature } from "@eslint-react/kit";
88
import { unsafeDecodeSettings } from "@eslint-react/shared";
99
import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
1010
import { isMatching } from "ts-pattern";
@@ -109,7 +109,7 @@ export default createRule<[], MessageID>({
109109
});
110110

111111
export function create(context: RuleContext<MessageID, []>): RuleListener {
112-
const report = Report.make(context);
112+
const report = RPT.make(context);
113113
const indexParamNames: Array<string | _> = [];
114114

115115
function isArrayIndex(node: TSESTree.Node): node is TSESTree.Identifier {

packages/plugins/eslint-plugin-react-x/src/rules/no-leaked-conditional-rendering.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { ReportDescriptor, RuleListener } from "@typescript-eslint/utils/ts
33
import type { CamelCase } from "string-ts";
44
import * as AST from "@eslint-react/ast";
55
import { _, flow } from "@eslint-react/eff";
6-
import { Report, type RuleContext, type RuleFeature } from "@eslint-react/kit";
6+
import { Reporter as RPT, type RuleContext, type RuleFeature } from "@eslint-react/kit";
77
import { getSettingsFromContext } from "@eslint-react/shared";
88
import * as VAR from "@eslint-react/var";
99
import { getConstrainedTypeAtLocation } from "@typescript-eslint/type-utils";
@@ -268,7 +268,7 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
268268
.otherwise(() => _);
269269
}
270270
return {
271-
JSXExpressionContainer: flow(getReportDescriptor, Report.make(context).send),
271+
JSXExpressionContainer: flow(getReportDescriptor, RPT.make(context).send),
272272
};
273273
}
274274

packages/plugins/eslint-plugin-react-x/src/rules/no-missing-context-display-name.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { TSESTree } from "@typescript-eslint/types";
22
import type { RuleListener } from "@typescript-eslint/utils/ts-eslint";
33
import type { CamelCase } from "string-ts";
44
import * as ER from "@eslint-react/core";
5-
import { type RuleContext, type RuleFeature, SEL } from "@eslint-react/kit";
5+
import { type RuleContext, type RuleFeature, Selector as SEL } from "@eslint-react/kit";
66
import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
77

88
import { createRule } from "../utils";

0 commit comments

Comments
 (0)