Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Nicol貌 Ribaudo <nicolo.ribaudo@gmail.com>
  • Loading branch information
liuxingbaoyu and nicolo-ribaudo committed Jan 19, 2024
1 parent c3ee8ac commit 210fc52
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion eslint/babel-eslint-parser/src/convert/convertAST.cts
Expand Up @@ -2,7 +2,7 @@ import type * as t from "@babel/types";
import ESLINT_VERSION = require("../utils/eslint-version.cts");
import type { ParseResult } from "../types.d.cts";

function* it(children: any) {
function* it<T>(children: T | T[]): Generator<T> {
if (Array.isArray(children)) yield* children;
else yield children;
}
Expand Down
5 changes: 1 addition & 4 deletions eslint/babel-eslint-parser/src/convert/convertComments.cts
Expand Up @@ -9,9 +9,6 @@ export = function convertComments(comments: Comment[]) {
// even with options.ranges === true

// @ts-expect-error eslint
if (!comment.range) {
// @ts-expect-error eslint
comment.range = [comment.start, comment.end];
}
comment.range ||= [comment.start, comment.end];
}
};
7 changes: 2 additions & 5 deletions eslint/babel-eslint-parser/src/convert/convertTokens.cts
Expand Up @@ -101,11 +101,8 @@ function convertToken(
pattern: string;
flags: string;
};
} = {
...token,
type: "",
range: [token.start, token.end],
};
} = token as any;
newToken.range = [token.start, token.end];

if (label === tl.name) {
if (token.value === "static") {
Expand Down

0 comments on commit 210fc52

Please sign in to comment.