-
-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathtypes.ts
More file actions
74 lines (66 loc) · 1.63 KB
/
types.ts
File metadata and controls
74 lines (66 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { APIKind } from "ast-metadata-inferer/lib/types";
import { Rule } from "eslint";
import { TargetNameMappings } from "./constants";
export type BrowserListConfig =
| string
| Array<string>
| {
production?: Array<string>;
development?: Array<string>;
}
| {
ignoreBrowserslistTargets?: boolean;
query: string | Array<string>;
}
| null;
// @TODO Replace with types from ast-metadata-inferer
// Types from ast-metadata-inferer
type AstMetadataApi = {
type?: string;
name?: string;
object: string;
astNodeType: "MemberExpression" | "CallExpression" | "NewExpression";
property?: string;
protoChainId: string;
protoChain: Array<string>;
};
export interface Target {
target: keyof TargetNameMappings;
parsedVersion: number;
version: number | string | "all";
}
export type HandleFailingRule = (
node: AstMetadataApiWithTargetsResolver,
eslintNode: ESLintNode
) => void;
export type TargetNames = Array<string>;
export type ESLintNode = {
name: string;
type: string;
value?: unknown;
object?: ESLintNode;
parent?: ESLintNode;
expression?: ESLintNode;
property?: ESLintNode;
callee?: ESLintNode & {
name: string;
type?: string;
};
};
export interface AstMetadataApiWithTargetsResolver extends AstMetadataApi {
id: string;
caniuseId?: string;
kind?: APIKind;
getUnsupportedTargets: (
node: AstMetadataApiWithTargetsResolver,
targets: Target[]
) => Array<string>;
}
export interface Context extends Rule.RuleContext {
settings: {
targets?: string[];
browsers?: Array<string>;
polyfills?: Array<string>;
lintAllEsApis?: boolean;
};
}