• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lo1tuma / eslint-plugin-mocha / 14683019602

26 Apr 2025 04:23PM UTC coverage: 98.456% (-1.5%) from 100.0%
14683019602

push

github

web-flow
Merge pull request #372 from lo1tuma/typescript

Migrate codebase to typescript

637 of 670 branches covered (95.07%)

1918 of 1971 new or added lines in 42 files covered. (97.31%)

3571 of 3627 relevant lines covered (98.46%)

1338.3 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

97.73
/source/ast/node-types.ts
1
import type { Rule } from 'eslint';
2✔
2
import type { Except } from 'type-fest';
2✔
3

2✔
4
type NodeType<T extends keyof Rule.NodeListener> = Parameters<Exclude<Rule.NodeListener[T], undefined>>[0];
2✔
5

2✔
6
export type MemberExpression = NodeType<'MemberExpression'>;
2✔
7

2✔
8
export function isMemberExpression(node: Except<Rule.Node, 'parent'>): node is MemberExpression {
2✔
9
    return node.type === 'MemberExpression';
3,368✔
10
}
3,368✔
11

2✔
12
export type CallExpression = NodeType<'CallExpression'>;
2✔
13

2✔
14
export function isCallExpression(node: Except<Rule.Node, 'parent'>): node is CallExpression {
2✔
15
    return node.type === 'CallExpression';
12,532✔
16
}
12,532✔
17

2✔
18
export type BlockStatement = NodeType<'BlockStatement'>;
2✔
19

2✔
20
export function isBlockStatement(node: Except<Rule.Node, 'parent'>): node is BlockStatement {
2✔
21
    return node.type === 'BlockStatement';
92✔
22
}
92✔
23

2✔
24
export type ReturnStatement = NodeType<'ReturnStatement'>;
2✔
25

2✔
26
export function isReturnStatement(node: Except<Rule.Node, 'parent'>): node is ReturnStatement {
2✔
27
    return node.type === 'ReturnStatement';
108✔
28
}
108✔
29

2✔
30
export type Identifier = NodeType<'Identifier'>;
2✔
31

2✔
32
export function isIdentifier(node: Except<Rule.Node, 'parent'>): node is Identifier {
2✔
33
    return node.type === 'Identifier';
3,310✔
34
}
3,310✔
35

2✔
36
export type VariableDeclarator = NodeType<'VariableDeclarator'>;
2✔
37

2✔
38
export function isVariableDeclarator(node: Rule.Node): node is VariableDeclarator {
2✔
39
    return node.type === 'VariableDeclarator';
2,608✔
40
}
2,608✔
41

2✔
42
export type Pattern = VariableDeclarator['id'];
2✔
43
export type ObjectPattern = Extract<Pattern, { type: 'ObjectPattern'; }>;
2✔
44
export type IdentifierPattern = Extract<Pattern, { type: 'Identifier'; }>;
2✔
45

2✔
46
export function isObjectPattern(pattern: Pattern): pattern is ObjectPattern {
2✔
47
    return pattern.type === 'ObjectPattern';
56✔
48
}
56✔
49

2✔
50
export function isIdentifierPattern(pattern: Pattern): pattern is IdentifierPattern {
2✔
51
    return pattern.type === 'Identifier';
100✔
52
}
100✔
53

2✔
54
export type AssignmentProperty = Extract<ObjectPattern['properties'][number], { type: 'Property'; }>;
2✔
55

2✔
56
export function isAssignmentProperty(property: ObjectPattern['properties'][number]): property is AssignmentProperty {
2✔
57
    return property.type === 'Property';
66✔
58
}
66✔
59

2✔
60
export type FunctionExpression = NodeType<'FunctionExpression'>;
2✔
61
export type FunctionDeclaration = NodeType<'FunctionDeclaration'>;
2✔
62
export type ArrowFunctionExpression = NodeType<'ArrowFunctionExpression'>;
2✔
63

2✔
64
export function isArrowFunctionExpression(node: Except<Rule.Node, 'parent'>): node is ArrowFunctionExpression {
2✔
65
    return node.type === 'ArrowFunctionExpression';
124✔
66
}
124✔
67

2✔
68
export function isFunctionExpression(node: Except<Rule.Node, 'parent'>): node is FunctionExpression {
2✔
69
    return node.type === 'FunctionExpression';
368✔
70
}
368✔
71

2✔
72
export function isFunctionDeclaration(node: Except<Rule.Node, 'parent'>): node is FunctionDeclaration {
2✔
NEW
73
    return node.type === 'FunctionDeclaration';
×
NEW
74
}
×
75

2✔
76
export type AnyFunction = ArrowFunctionExpression | FunctionDeclaration | FunctionExpression;
2✔
77

2✔
78
export function isFunction(node: Except<Rule.Node, 'parent'>): node is AnyFunction {
2✔
79
    return isFunctionExpression(node) || isArrowFunctionExpression(node) || isFunctionDeclaration(node);
368!
80
}
368✔
81

2✔
82
export type MetaProperty = NodeType<'MetaProperty'>;
2✔
83

2✔
84
export type Literal = NodeType<'Literal'>;
2✔
85

2✔
86
export function isLiteral(node: Except<Rule.Node, 'parent'>): node is Literal {
2✔
87
    return node.type === 'Literal';
130✔
88
}
130✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc