forked from amilajack/eslint-plugin-compat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
88 lines (79 loc) · 2.01 KB
/
types.ts
File metadata and controls
88 lines (79 loc) · 2.01 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import { APIKind } from "ast-metadata-inferer/lib/types";
import type { Options as DefaultBrowsersListOpts } from "browserslist";
import { Rule } from "eslint";
import { TargetNameMappings } from "./constants";
export type BrowserListConfig =
| string
| Array<string>
| {
production?: Array<string>;
development?: 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"
| "Literal";
property?: string;
syntaxes?: 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;
};
regex?: {
flags: string;
pattern: string;
};
raw: string;
};
export type SourceCode = import("eslint").SourceCode;
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;
ignoreConditionalChecks?: boolean;
browserslistOpts?: BrowsersListOpts;
};
}
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface BrowsersListOpts
extends Exclude<DefaultBrowsersListOpts, "path"> {}