Skip to content

Commit effd266

Browse files
committed
Merge branch 'master' into update-eslint
2 parents f025ac4 + 1dea921 commit effd266

File tree

11 files changed

+542
-115
lines changed

11 files changed

+542
-115
lines changed

.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ module.exports = {
2121
"no-warning-comments": "warn",
2222
"no-lonely-if": "off",
2323
"@typescript-eslint/no-non-null-assertion": "off",
24-
"@typescript-eslint/no-duplicate-imports": "error",
2524

2625
"no-shadow": "off",
2726
"@typescript-eslint/no-shadow": "error",

lib/rules/require-unicode-regexp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function isSyntacticallyCompatible(pattern: Pattern): false | Pattern {
4646
pattern.raw,
4747
undefined,
4848
undefined,
49-
true,
49+
{ unicode: true },
5050
)
5151
} catch (_error) {
5252
return false

lib/rules/strict.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
defineRegexpVisitor,
1313
isEscapeSequence,
1414
} from "../utils"
15+
import type { ReadonlyFlags } from "regexp-ast-analysis"
1516

1617
const validator = new RegExpValidator({ strict: true, ecmaVersion: 2020 })
1718

@@ -21,10 +22,10 @@ const validator = new RegExpValidator({ strict: true, ecmaVersion: 2020 })
2122
*/
2223
function validateRegExpPattern(
2324
pattern: string,
24-
uFlag?: boolean,
25+
flags: ReadonlyFlags,
2526
): string | null {
2627
try {
27-
validator.validatePattern(pattern, undefined, undefined, uFlag)
28+
validator.validatePattern(pattern, undefined, undefined, flags)
2829
return null
2930
} catch (err) {
3031
return err instanceof Error ? err.message : null
@@ -272,10 +273,7 @@ export default createRule("strict", {
272273
// our own logic couldn't find any problems,
273274
// so let's use a real parser to do the job.
274275

275-
const message = validateRegExpPattern(
276-
pattern,
277-
flags.unicode,
278-
)
276+
const message = validateRegExpPattern(pattern, flags)
279277

280278
if (message) {
281279
context.report({

lib/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ function buildRegexpVisitor(
329329
patternSource.value,
330330
0,
331331
patternSource.value.length,
332-
flags.unicode,
332+
flags,
333333
)
334334
} catch (error: unknown) {
335335
if (error instanceof SyntaxError) {

lib/utils/regexp-ast/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ export function getRegExpNodeFromExpression(
4242
node.regex.pattern,
4343
0,
4444
node.regex.pattern.length,
45-
node.regex.flags.includes("u"),
45+
{
46+
unicode: node.regex.flags.includes("u"),
47+
unicodeSets: node.regex.flags.includes("v"),
48+
},
4649
)
4750
} catch {
4851
return null

lib/utils/type-tracker/jsdoc/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { Rule, SourceCode, AST } from "eslint"
22
import type * as ES from "estree"
33
import { isCommentToken } from "@eslint-community/eslint-utils"
44
import * as commentParser from "comment-parser"
5-
import type { Spec } from "comment-parser/lib/primitives"
5+
import type { Spec } from "comment-parser"
66
// @ts-expect-error -- no type
77
import * as jsdocTypeParser from "jsdoctypeparser"
88
import type { JSDocTypeNode } from "./jsdoctypeparser-ast"

lib/utils/type-tracker/type-data/union-or-intersection.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export class TypeUnionOrIntersection implements ITypeClass {
8484
}
8585

8686
public typeNames(): string[] {
87-
// eslint-disable-next-line @typescript-eslint/require-array-sort-compare -- ignore
8887
return [...this.collection.strings()].sort()
8988
}
9089

0 commit comments

Comments
 (0)