Skip to content

Commit f4db6f4

Browse files
committed
style(samples,docs): unify comment markers by removing leading arrow
1 parent 4bfc86c commit f4db6f4

17 files changed

Lines changed: 69 additions & 69 deletions

.pkgs/samples/src/booleanPropNaming.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ export function booleanPropNaming(options?: BooleanPropNamingOptions): RuleFunct
4444
for (const prop of declaredProps) {
4545
const propType = chk.getTypeOfSymbolAtLocation(prop, tsNode);
4646

47-
// Filter: must be boolean
47+
// Filter: must be boolean
4848
if (!isBooleanLikeType(propType)) continue;
4949

50-
// Filter: must match naming pattern
50+
// Filter: must match naming pattern
5151
if (regex.test(prop.name)) continue;
5252

5353
const decls = prop.getDeclarations();
@@ -61,7 +61,7 @@ export function booleanPropNaming(options?: BooleanPropNamingOptions): RuleFunct
6161

6262
const node = "key" in declNode ? declNode.key : declNode;
6363

64-
// Report violation
64+
// Report violation
6565
context.report({
6666
data: { name: prop.name, rule },
6767
message: `Boolean prop "{{name}}" should match "{{rule}}".`,

.pkgs/samples/src/checkedRequiresOnchangeOrReadonly.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ import type { RuleFunction } from "@eslint-react/kit";
44
export function checkedRequiresOnchangeOrReadonly(): RuleFunction {
55
return (context) => ({
66
JSXOpeningElement(node) {
7-
// Verify this is an <input> element
7+
// Verify this is an <input> element
88
const name = node.name.type === "JSXIdentifier" ? node.name.name : null;
99
if (name !== "input") return;
1010

11-
// Collect all attribute names
11+
// Collect all attribute names
1212
const attrs = new Set<string>();
1313
for (const attr of node.attributes) {
1414
if (attr.type === "JSXAttribute" && attr.name.type === "JSXIdentifier") {
1515
attrs.add(attr.name.name);
1616
}
1717
}
1818

19-
// Guard: must have checked attribute
19+
// Guard: must have checked attribute
2020
if (!attrs.has("checked")) return;
2121

22-
// Validate: requires onChange or readOnly
22+
// Validate: requires onChange or readOnly
2323
if (!attrs.has("onChange") && !attrs.has("readOnly")) {
2424
context.report({
2525
node,

.pkgs/samples/src/forbidComponentProps.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ export function forbidComponentProps(options: ForbidComponentPropsOptions): Rule
1111
const { forbidden } = options;
1212
return (context) => ({
1313
JSXAttribute(node) {
14-
// Extract prop name
14+
// Extract prop name
1515
const propName = node.name.type === "JSXIdentifier" ? node.name.name : null;
1616
if (propName == null || !forbidden.includes(propName)) return;
1717

18-
// Verify context is JSX opening element
18+
// Verify context is JSX opening element
1919
const parent = node.parent;
2020
if (parent?.type !== "JSXOpeningElement") return;
2121

22-
// Extract element name
22+
// Extract element name
2323
const elemName = parent.name.type === "JSXIdentifier" ? parent.name.name : null;
2424

25-
// Guard: only check components (PascalCase), not DOM elements
25+
// Guard: only check components (PascalCase), not DOM elements
2626
if (elemName == null || elemName[0] !== elemName[0]?.toUpperCase()) return;
2727

2828
context.report({

.pkgs/samples/src/forbidDomProps.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ export function forbidDomProps(options: ForbidDomPropsOptions): RuleFunction {
1111
const { forbidden } = options;
1212
return (context) => ({
1313
JSXAttribute(node) {
14-
// Extract prop name
14+
// Extract prop name
1515
const propName = node.name.type === "JSXIdentifier" ? node.name.name : null;
1616
if (propName == null || !forbidden.includes(propName)) return;
1717

18-
// Verify context is JSX opening element
18+
// Verify context is JSX opening element
1919
const parent = node.parent;
2020
if (parent?.type !== "JSXOpeningElement") return;
2121

22-
// Extract element name
22+
// Extract element name
2323
const elemName = parent.name.type === "JSXIdentifier" ? parent.name.name : null;
2424

25-
// Guard: only check DOM elements (lowercase), not components
25+
// Guard: only check DOM elements (lowercase), not components
2626
if (elemName == null || elemName[0] !== elemName[0]?.toLowerCase()) return;
2727

2828
context.report({

.pkgs/samples/src/forbidElements.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ export function forbidElements(options: ForbidElementsOptions): RuleFunction {
1111
const { forbidden } = options;
1212
return (context) => ({
1313
JSXOpeningElement(node) {
14-
// Extract element identifier
14+
// Extract element identifier
1515
const name = node.name.type === "JSXIdentifier" ? node.name.name : null;
1616

17-
// Guard: must be in forbidden map
17+
// Guard: must be in forbidden map
1818
if (name == null || !forbidden.has(name)) return;
1919

20-
// Report violation with custom message
20+
// Report violation with custom message
2121
context.report({ node, message: forbidden.get(name)! });
2222
},
2323
});

.pkgs/samples/src/functionComponentDefinition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function functionComponentDefinition(): RuleFunction {
1313
"Program:exit"(program) {
1414
// ─── Iterate all components ────────────────────
1515
for (const { node } of query.all(program)) {
16-
// Guard: must not already be arrow function
16+
// Guard: must not already be arrow function
1717
if (node.type === "ArrowFunctionExpression") continue;
1818

1919
context.report({

.pkgs/samples/src/jsxBooleanValue.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ export function jsxBooleanValue(): RuleFunction {
66
JSXAttribute(node) {
77
const { value } = node;
88

9-
// Guard: must have expression value
9+
// Guard: must have expression value
1010
if (value?.type !== "JSXExpressionContainer") return;
1111

12-
// Guard: must be literal true
12+
// Guard: must be literal true
1313
const expression = ast.unwrap(value.expression);
1414
if (expression.type !== "Literal" || expression.value !== true) return;
1515

16-
// Report: prefer shorthand form
16+
// Report: prefer shorthand form
1717
context.report({
1818
node,
1919
message: "Omit the value for boolean attributes.",

.pkgs/samples/src/jsxFragments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function jsxFragments(options: JsxsFragmentsOptions = {}): RuleFunction {
1414
// ── Helpers ─────────────────────────────────────
1515

1616
function reportSyntaxPreferred(node: TSESTree.JSXOpeningElement, pattern: "React.Fragment" | "Fragment") {
17-
// Guard: has key prop (legitimate use of standard form)
17+
// Guard: has key prop (legitimate use of standard form)
1818
const hasAttributes = node.attributes.length > 0;
1919
if (hasAttributes) return;
2020

.pkgs/samples/src/jsxHandlerNames.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function jsxHandlerNames(options: JsxHandlerNamesOptions = {}): RuleFunct
2222

2323
return (context, { ast }) => ({
2424
JSXAttribute(node) {
25-
// Guard: must be event handler prop (onXxx)
25+
// Guard: must be event handler prop (onXxx)
2626
if (node.name.type !== "JSXIdentifier") return;
2727
const propName = node.name.name;
2828
if (!EVENT_HANDLER_REGEX.test(propName)) return;

.pkgs/samples/src/jsxMaxDepth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function jsxMaxDepth(options: JsxMaxDepthOptions): RuleFunction {
2323
parent = parent.parent;
2424
}
2525

26-
// Check depth limit
26+
// Check depth limit
2727
if (depth > max) {
2828
context.report({
2929
node,

0 commit comments

Comments
 (0)