Skip to content

Commit 9441d76

Browse files
Disable complexity rule (#575)
* Disable `complexity` rule * one last error * Removed useless comment
1 parent 36b8e73 commit 9441d76

13 files changed

+7
-43
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ module.exports = {
2020
"require-jsdoc": "error",
2121
"no-warning-comments": "warn",
2222
"no-lonely-if": "off",
23+
complexity: "off",
2324
"@typescript-eslint/no-non-null-assertion": "off",
2425

2526
"no-shadow": "off",

lib/rules/no-dupe-characters-character-class.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ export default createRule("no-dupe-characters-character-class", {
255255
const { flags } = regexpContext
256256

257257
return {
258-
// eslint-disable-next-line complexity -- X
259258
onCharacterClassEnter(ccNode: CharacterClass) {
260259
const {
261260
duplicates,

lib/rules/no-misleading-capturing-group.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable eslint-comments/disable-enable-pair -- x */
2-
/* eslint-disable complexity -- x */
2+
33
import type { RegExpVisitor } from "@eslint-community/regexpp/visitor"
44
import type {
55
Alternative,

lib/rules/no-useless-character-class.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ export default createRule("no-useless-character-class", {
4545
getRegexpLocation,
4646
}: RegExpContext): RegExpVisitor.Handlers {
4747
return {
48-
// eslint-disable-next-line complexity -- X(
4948
onCharacterClassEnter(ccNode) {
5049
if (ccNode.elements.length !== 1) {
5150
return

lib/rules/optimal-quantifier-concatenation.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// eslint-disable-next-line eslint-comments/disable-enable-pair -- x
2-
/* eslint-disable complexity -- x */
31
import type { RegExpVisitor } from "@eslint-community/regexpp/visitor"
42
import type {
53
Alternative,

lib/rules/sort-character-class-elements.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,10 @@ export default createRule("sort-character-class-elements", {
141141
}
142142
}
143143

144-
/* eslint-disable complexity -- X( */
145144
/**
146145
* Check that the two given CharacterClassElements are in a valid order.
147146
*/
148147
function isValidOrder(
149-
/* eslint-enable complexity -- X( */
150148
prev: CharacterClassElement,
151149
next: CharacterClassElement,
152150
) {

lib/rules/strict.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ export default createRule("strict", {
133133
}
134134

135135
return {
136-
// eslint-disable-next-line complexity -- x
137136
onCharacterEnter(cNode) {
138137
if (cNode.raw === "\\") {
139138
// e.g. \c5 or \c

lib/utils/ast-utils/extract-expression-references.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,8 @@ export function* extractExpressionReferencesForVariable(
9494
})
9595
}
9696

97-
/* eslint-disable complexity -- ignore */
9897
/** Iterate references from the given expression */
9998
function* iterateReferencesForExpression(
100-
/* eslint-enable complexity -- ignore */
10199
expression: Expression,
102100
context: Rule.RuleContext,
103101
alreadyChecked: AlreadyChecked,

lib/utils/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,16 +1103,11 @@ export function toCharSetSource(
11031103
).source
11041104
}
11051105

1106-
/* eslint-disable complexity -- X( */
11071106
/**
11081107
* Returns whether the concatenation of the two string might create new escape
11091108
* sequences or elements.
11101109
*/
1111-
export function mightCreateNewElement(
1112-
/* eslint-enable complexity -- X( */
1113-
before: string,
1114-
after: string,
1115-
): boolean {
1110+
export function mightCreateNewElement(before: string, after: string): boolean {
11161111
// control
11171112
// \cA
11181113
if (before.endsWith("\\c") && /^[a-z]/iu.test(after)) {

lib/utils/regexp-ast/is-covered.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,8 @@ export function isCoveredNode(
335335
return isCoveredForNormalizedNode(leftNode, rightNode, options)
336336
}
337337

338-
/* eslint-disable complexity -- X( */
339338
/** Checks whether the right node is covered by the left node. */
340339
function isCoveredForNormalizedNode(
341-
/* eslint-enable complexity -- X( */
342340
left: NormalizedNode,
343341
right: NormalizedNode,
344342
options: Options,
@@ -478,10 +476,8 @@ function isCoveredAnyNode(
478476
return false
479477
}
480478

481-
/* eslint-disable complexity -- X( */
482479
/** Check whether the right nodes is covered by the left nodes. */
483480
function isCoveredAltNodes(
484-
/* eslint-enable complexity -- X( */
485481
leftNodes: NormalizedNode[],
486482
rightNodes: NormalizedNode[],
487483
options: Options,

0 commit comments

Comments
 (0)