Skip to content

Update @eslint-community/regexpp to v4.6 #554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/small-doors-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-regexp": minor
---

Update `@eslint-community/regexpp` to v4.6
2 changes: 2 additions & 0 deletions lib/rules/negation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export default createRule("negation", {
const negatedElementSet = toCharSet(
{
...element,
// FIXME: TS Error
// @ts-expect-error -- FIXME
negate: !element.negate,
},
flags,
Expand Down
4 changes: 3 additions & 1 deletion lib/rules/no-contradiction-with-assertion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ function* getNextElements(
}
}

// FIXME: TS Error
// @ts-expect-error -- FIXME
const elements = parent.elements
const index = elements.indexOf(element)
const index = elements.indexOf(element) as number
const inc = dir === "ltr" ? 1 : -1
for (let i = index + inc; i >= 0 && i < elements.length; i += inc) {
const e = elements[i]
Expand Down
4 changes: 4 additions & 0 deletions lib/rules/no-dupe-characters-character-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ function groupElements(
}

for (const e of elements) {
// FIXME: TS Error
// @ts-expect-error -- FIXME
const charSet = toCharSet(e, flags)

if (e.type === "Character") {
Expand Down Expand Up @@ -324,6 +326,8 @@ export default createRule("no-dupe-characters-character-class", {
.filter((e) => !subsets.has(e) && e !== element)
.filter(
(e) =>
// FIXME: TS Error
// @ts-expect-error -- FIXME
!toCharSet(e, flags).isDisjointWith(
elementCharSet,
),
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/no-dupe-disjunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,8 @@ function fixRemoveNestedAlternative(
}

default:
// FIXME: TS Error
// @ts-expect-error -- FIXME
throw assertNever(alternative)
}
}
Expand Down
6 changes: 6 additions & 0 deletions lib/rules/no-misleading-capturing-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ function* getStartQuantifiers(
}
break
default:
// FIXME: TS Error
// @ts-expect-error -- FIXME
yield assertNever(root)
}
}
Expand Down Expand Up @@ -179,6 +181,8 @@ function uncachedGetSingleRepeatedChar(
return getSingleRepeatedChar(element.element, flags, cache)

default:
// FIXME: TS Error
// @ts-expect-error -- FIXME
return assertNever(element)
}
}
Expand Down Expand Up @@ -232,6 +236,8 @@ function getTradingQuantifiersAfter(
return state

default:
// FIXME: TS Error
// @ts-expect-error -- FIXME
return assertNever(element)
}
},
Expand Down
4 changes: 4 additions & 0 deletions lib/rules/optimal-quantifier-concatenation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,12 @@ function getLoc(
function getCapturingGroupStack(element: Element): string {
let result = ""
for (
// FIXME: TS Error
// @ts-expect-error -- FIXME
let p: Ancestor<Element> = element.parent;
p.type !== "Pattern";
// FIXME: TS Error
// @ts-expect-error -- FIXME
p = p.parent
) {
if (p.type === "CapturingGroup") {
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/prefer-character-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ function elementsToCharacterClass(elements: CharElementArray): string {
break

default:
// FIXME: TS Error
// @ts-expect-error -- FIXME
throw new Error(e)
}
})
Expand Down
4 changes: 4 additions & 0 deletions lib/rules/sort-character-class-elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ export default createRule("sort-character-class-elements", {
if (node.type === "CharacterClassRange") {
return node.min.value
}
// FIXME: TS Error
// @ts-expect-error -- FIXME
return node.value
}

Expand All @@ -257,6 +259,8 @@ function escapeRaw(node: CharacterClassElement, target: CharacterClassElement) {
let raw = node.raw
if (raw.startsWith("-")) {
const parent = target.parent as CharacterClass
// FIXME: TS Error
// @ts-expect-error -- FIXME
const prev = parent.elements[parent.elements.indexOf(target) - 1]
if (
prev &&
Expand Down
8 changes: 8 additions & 0 deletions lib/rules/use-ignore-case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import type {
import type { Rule } from "eslint"
import { UsageOfPattern } from "../utils/get-usage-of-pattern"

// FIXME: TS Error
// @ts-expect-error -- FIXME
const ELEMENT_ORDER: Record<CharacterClassElement["type"], number> = {
Character: 1,
CharacterClassRange: 2,
Expand Down Expand Up @@ -179,6 +181,8 @@ export default createRule("use-ignore-case", {
}

const invariant = Chars.empty(flags).union(
// FIXME: TS Error
// @ts-expect-error -- FIXME
...invariantElement.map((e) => toCharSet(e, flags)),
)

Expand All @@ -191,6 +195,8 @@ export default createRule("use-ignore-case", {
// the i flag
const alwaysUseless = findUseless(
variantElements,
// FIXME: TS Error
// @ts-expect-error -- FIXME
(e) => toCharSet(e, flags),
invariant,
)
Expand All @@ -202,6 +208,8 @@ export default createRule("use-ignore-case", {
const iFlags = getIgnoreCaseFlags(flags)
const useless = findUseless(
variantElements,
// FIXME: TS Error
// @ts-expect-error -- FIXME
(e) => toCharSet(e, iFlags),
invariant,
)
Expand Down
4 changes: 4 additions & 0 deletions lib/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1196,8 +1196,12 @@ export function fixRemoveCharacterClassElement(
}

const elementBefore: CharacterClassElement | undefined =
// FIXME: TS Error
// @ts-expect-error -- FIXME
cc.elements[cc.elements.indexOf(element) - 1]
const elementAfter: CharacterClassElement | undefined =
// FIXME: TS Error
// @ts-expect-error -- FIXME
cc.elements[cc.elements.indexOf(element) + 1]

if (
Expand Down
4 changes: 4 additions & 0 deletions lib/utils/partial-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ export class PartialParser {
}

default:
// FIXME: TS Error
// @ts-expect-error -- FIXME
throw assertNever(element)
}
}
Expand All @@ -207,6 +209,8 @@ export class PartialParser {
characters: JS.createCharSet([range], this.parser.ast.flags),
}
}
// FIXME: TS Error
// @ts-expect-error -- FIXME
return this.nativeParseElement(context.alternative)
}

Expand Down
2 changes: 2 additions & 0 deletions lib/utils/regexp-ast/case-variation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ export function isCaseVariant(

case "CharacterClass":
if (!wholeCharacterClass) {
// FIXME: TS Error
// @ts-expect-error -- FIXME
return d.elements.some(ccElementIsCaseVariant)
}
// just check for equality
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/regexp-ast/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ export function getJSRegexppAst(

return {
pattern: patternAst,
// FIXME: TS Error
// @ts-expect-error -- FIXME
flags: {
type: "Flags",
raw: flagsString ?? "",
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/regexp-ast/is-equals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ export function isEqualNodes<N extends Node>(
}
}
if (/[(*+?[\\{|]/u.test(a.raw) || /[(*+?[\\{|]/u.test(b.raw)) {
// FIXME: TS Error
// @ts-expect-error -- FIXME
return EQUALS_CHECKER[a.type](
a as never,
b as never,
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/regexp-ast/simplify-quantifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ function getTailQuantifiers(
}

default:
// FIXME: TS Error
// @ts-expect-error -- FIXME
return assertNever(element)
}
}
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
},
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.4.0",
"@eslint-community/regexpp": "^4.6.2",
"comment-parser": "^1.1.2",
"grapheme-splitter": "^1.0.4",
"jsdoctypeparser": "^9.0.0",
Expand Down