Skip to content

Commit 95cce6b

Browse files
renovate[bot]renovate-botG-Rath
authored andcommitted
chore(deps): lock file maintenance (#490)
Co-authored-by: WhiteSource Renovate <[email protected]> Co-authored-by: Gareth Jones <[email protected]>
1 parent 735f143 commit 95cce6b

File tree

6 files changed

+1024
-926
lines changed

6 files changed

+1024
-926
lines changed

src/rules/no-focused-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const testFunctions = new Set<string>([
1717
...validTestCaseNames,
1818
]);
1919

20-
interface ConcurrentExpression extends TSESTree.MemberExpression {
20+
interface ConcurrentExpression extends TSESTree.MemberExpressionComputedName {
2121
parent: TSESTree.MemberExpression;
2222
}
2323

src/rules/prefer-to-be-null.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ import {
1313
parseExpectCall,
1414
} from './utils';
1515

16-
interface NullLiteral extends TSESTree.Literal {
17-
value: null;
18-
}
19-
20-
const isNullLiteral = (node: TSESTree.Node): node is NullLiteral =>
16+
const isNullLiteral = (node: TSESTree.Node): node is TSESTree.NullLiteral =>
2117
node.type === AST_NODE_TYPES.Literal && node.value === null;
2218

2319
/**
@@ -30,7 +26,7 @@ const isNullLiteral = (node: TSESTree.Node): node is NullLiteral =>
3026
*/
3127
const isNullEqualityMatcher = (
3228
matcher: ParsedExpectMatcher,
33-
): matcher is ParsedEqualityMatcherCall<MaybeTypeCast<NullLiteral>> =>
29+
): matcher is ParsedEqualityMatcherCall<MaybeTypeCast<TSESTree.NullLiteral>> =>
3430
isParsedEqualityMatcherCall(matcher) &&
3531
isNullLiteral(followTypeAssertionChain(matcher.arguments[0]));
3632

src/rules/prefer-to-contain.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ import {
2020
parseExpectCall,
2121
} from './utils';
2222

23-
interface BooleanLiteral extends TSESTree.Literal {
24-
value: boolean;
25-
}
26-
27-
const isBooleanLiteral = (node: TSESTree.Node): node is BooleanLiteral =>
23+
const isBooleanLiteral = (
24+
node: TSESTree.Node,
25+
): node is TSESTree.BooleanLiteral =>
2826
node.type === AST_NODE_TYPES.Literal && typeof node.value === 'boolean';
2927

3028
type ParsedBooleanEqualityMatcherCall = ParsedEqualityMatcherCall<
31-
MaybeTypeCast<BooleanLiteral>
29+
MaybeTypeCast<TSESTree.BooleanLiteral>
3230
>;
3331

3432
/**

src/rules/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const followTypeAssertionChain = <
5353
* A `Literal` with a `value` of type `string`.
5454
*/
5555
interface StringLiteral<Value extends string = string>
56-
extends TSESTree.Literal {
56+
extends TSESTree.StringLiteral {
5757
value: Value;
5858
}
5959

@@ -145,7 +145,7 @@ export const getStringValue = <S extends string>(node: StringNode<S>): S =>
145145
* Represents a `MemberExpression` with a "known" `property`.
146146
*/
147147
interface KnownMemberExpression<Name extends string = string>
148-
extends TSESTree.MemberExpression {
148+
extends TSESTree.MemberExpressionComputedName {
149149
property: AccessorNode<Name>;
150150
}
151151

src/rules/valid-title.ts

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
} from '@typescript-eslint/experimental-utils';
55
import {
66
DescribeAlias,
7+
StringNode,
78
TestCaseName,
89
createRule,
910
getJestFunctionArguments,
@@ -31,6 +32,11 @@ const doesBinaryExpressionContainStringNode = (
3132
return isStringNode(binaryExp.left);
3233
};
3334

35+
const quoteStringValue = (node: StringNode): string =>
36+
node.type === AST_NODE_TYPES.TemplateLiteral
37+
? `\`${node.quasis[0].value.raw}\``
38+
: node.raw;
39+
3440
export default createRule({
3541
name: __filename,
3642
meta: {
@@ -111,21 +117,14 @@ export default createRule({
111117
context.report({
112118
messageId: 'accidentalSpace',
113119
node: argument,
114-
fix(fixer) {
115-
const stringValue =
116-
argument.type === AST_NODE_TYPES.TemplateLiteral
117-
? `\`${argument.quasis[0].value.raw}\``
118-
: argument.raw;
119-
120-
return [
121-
fixer.replaceTextRange(
122-
argument.range,
123-
stringValue
124-
.replace(/^([`'"]) +?/u, '$1')
125-
.replace(/ +?([`'"])$/u, '$1'),
126-
),
127-
];
128-
},
120+
fix: fixer => [
121+
fixer.replaceTextRange(
122+
argument.range,
123+
quoteStringValue(argument)
124+
.replace(/^([`'"]) +?/u, '$1')
125+
.replace(/ +?([`'"])$/u, '$1'),
126+
),
127+
],
129128
});
130129
}
131130

@@ -136,19 +135,12 @@ export default createRule({
136135
context.report({
137136
messageId: 'duplicatePrefix',
138137
node: argument,
139-
fix(fixer) {
140-
const stringValue =
141-
argument.type === AST_NODE_TYPES.TemplateLiteral
142-
? `\`${argument.quasis[0].value.raw}\``
143-
: argument.raw;
144-
145-
return [
146-
fixer.replaceTextRange(
147-
argument.range,
148-
stringValue.replace(/^([`'"]).+? /u, '$1'),
149-
),
150-
];
151-
},
138+
fix: fixer => [
139+
fixer.replaceTextRange(
140+
argument.range,
141+
quoteStringValue(argument).replace(/^([`'"]).+? /u, '$1'),
142+
),
143+
],
152144
});
153145
}
154146
},

0 commit comments

Comments
 (0)