@typescript-eslint/utils 6.0.1-alpha.0 → 7.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/package.json +5 -5
  2. package/_ts4.3/dist/ast-utils/eslint-utils/PatternMatcher.d.ts +0 -48
  3. package/_ts4.3/dist/ast-utils/eslint-utils/ReferenceTracker.d.ts +0 -76
  4. package/_ts4.3/dist/ast-utils/eslint-utils/astUtilities.d.ts +0 -76
  5. package/_ts4.3/dist/ast-utils/eslint-utils/index.d.ts +0 -6
  6. package/_ts4.3/dist/ast-utils/eslint-utils/predicates.d.ts +0 -32
  7. package/_ts4.3/dist/ast-utils/eslint-utils/scopeAnalysis.d.ts +0 -18
  8. package/_ts4.3/dist/ast-utils/helpers.d.ts +0 -1207
  9. package/_ts4.3/dist/ast-utils/index.d.ts +0 -5
  10. package/_ts4.3/dist/ast-utils/misc.d.ts +0 -8
  11. package/_ts4.3/dist/ast-utils/predicates.d.ts +0 -70
  12. package/_ts4.3/dist/eslint-utils/InferTypesFromRule.d.ts +0 -11
  13. package/_ts4.3/dist/eslint-utils/RuleCreator.d.ts +0 -35
  14. package/_ts4.3/dist/eslint-utils/applyDefault.d.ts +0 -10
  15. package/_ts4.3/dist/eslint-utils/deepMerge.d.ts +0 -17
  16. package/_ts4.3/dist/eslint-utils/getParserServices.d.ts +0 -24
  17. package/_ts4.3/dist/eslint-utils/index.d.ts +0 -7
  18. package/_ts4.3/dist/eslint-utils/nullThrows.d.ts +0 -14
  19. package/_ts4.3/dist/index.d.ts +0 -7
  20. package/_ts4.3/dist/json-schema.d.ts +0 -392
  21. package/_ts4.3/dist/ts-eslint/AST.d.ts +0 -9
  22. package/_ts4.3/dist/ts-eslint/CLIEngine.d.ts +0 -137
  23. package/_ts4.3/dist/ts-eslint/ESLint.d.ts +0 -376
  24. package/_ts4.3/dist/ts-eslint/Linter.d.ts +0 -331
  25. package/_ts4.3/dist/ts-eslint/ParserOptions.d.ts +0 -2
  26. package/_ts4.3/dist/ts-eslint/Rule.d.ts +0 -400
  27. package/_ts4.3/dist/ts-eslint/RuleTester.d.ts +0 -161
  28. package/_ts4.3/dist/ts-eslint/Scope.d.ts +0 -44
  29. package/_ts4.3/dist/ts-eslint/SourceCode.d.ts +0 -346
  30. package/_ts4.3/dist/ts-eslint/index.d.ts +0 -10
  31. package/_ts4.3/dist/ts-estree.d.ts +0 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typescript-eslint/utils",
3
- "version": "6.0.1-alpha.0+6ae1fa74b",
3
+ "version": "7.0.0-alpha.0+6ae1fa74b",
4
4
  "description": "Utilities for working with TypeScript + ESLint together",
5
5
  "files": [
6
6
  "dist",
@@ -68,9 +68,9 @@
68
68
  "@eslint-community/eslint-utils": "^4.3.0",
69
69
  "@types/json-schema": "^7.0.11",
70
70
  "@types/semver": "^7.3.12",
71
- "@typescript-eslint/scope-manager": "6.0.1-alpha.0+6ae1fa74b",
72
- "@typescript-eslint/types": "6.0.1-alpha.0+6ae1fa74b",
73
- "@typescript-eslint/typescript-estree": "6.0.1-alpha.0+6ae1fa74b",
71
+ "@typescript-eslint/scope-manager": "7.0.0-alpha.0+6ae1fa74b",
72
+ "@typescript-eslint/types": "7.0.0-alpha.0+6ae1fa74b",
73
+ "@typescript-eslint/typescript-estree": "7.0.0-alpha.0+6ae1fa74b",
74
74
  "eslint-scope": "^5.1.1",
75
75
  "semver": "^7.5.0"
76
76
  },
@@ -78,7 +78,7 @@
78
78
  "eslint": "^7.0.0 || ^8.0.0"
79
79
  },
80
80
  "devDependencies": {
81
- "@typescript-eslint/parser": "6.0.1-alpha.0+6ae1fa74b",
81
+ "@typescript-eslint/parser": "7.0.0-alpha.0+6ae1fa74b",
82
82
  "typescript": "*"
83
83
  },
84
84
  "funding": {
@@ -1,48 +0,0 @@
1
- interface PatternMatcher {
2
- /**
3
- * Iterate all matched parts in a given string.
4
- *
5
- * @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#matcher-execall}
6
- */
7
- execAll(str: string): IterableIterator<RegExpExecArray>;
8
- /**
9
- * Check whether this pattern matches a given string or not.
10
- *
11
- * @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#matcher-test}
12
- */
13
- test(str: string): boolean;
14
- /**
15
- * Replace all matched parts by a given replacer.
16
- *
17
- * @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#matcher-symbol-replace}
18
- * @example
19
- * const { PatternMatcher } = require("eslint-utils")
20
- * const matcher = new PatternMatcher(/\\p{Script=Greek}/g)
21
- *
22
- * module.exports = {
23
- * meta: {},
24
- * create(context) {
25
- * return {
26
- * "Literal[regex]"(node) {
27
- * const replacedPattern = node.regex.pattern.replace(
28
- * matcher,
29
- * "[\\u0370-\\u0373\\u0375-\\u0377\\u037A-\\u037D\\u037F\\u0384\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03E1\\u03F0-\\u03FF\\u1D26-\\u1D2A\\u1D5D-\\u1D61\\u1D66-\\u1D6A\\u1DBF\\u1F00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FC4\\u1FC6-\\u1FD3\\u1FD6-\\u1FDB\\u1FDD-\\u1FEF\\u1FF2-\\u1FF4\\u1FF6-\\u1FFE\\u2126\\uAB65]|\\uD800[\\uDD40-\\uDD8E\\uDDA0]|\\uD834[\\uDE00-\\uDE45]"
30
- * )
31
- * },
32
- * }
33
- * },
34
- * }
35
- */
36
- [Symbol.replace](str: string, replacer: string | ((...strs: string[]) => string)): string;
37
- }
38
- /**
39
- * The class to find a pattern in strings as handling escape sequences.
40
- * It ignores the found pattern if it's escaped with `\`.
41
- *
42
- * @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#patternmatcher-class}
43
- */
44
- declare const PatternMatcher: new (pattern: RegExp, options?: {
45
- escaped?: boolean;
46
- }) => PatternMatcher;
47
- export { PatternMatcher };
48
- //# sourceMappingURL=PatternMatcher.d.ts.map
@@ -1,76 +0,0 @@
1
- import type * as TSESLint from '../../ts-eslint';
2
- import type { TSESTree } from '../../ts-estree';
3
- declare const ReferenceTrackerREAD: unique symbol;
4
- declare const ReferenceTrackerCALL: unique symbol;
5
- declare const ReferenceTrackerCONSTRUCT: unique symbol;
6
- declare const ReferenceTrackerESM: unique symbol;
7
- interface ReferenceTracker {
8
- /**
9
- * Iterate the references that the given `traceMap` determined.
10
- * This method starts to search from global variables.
11
- *
12
- * @see {@link https://eslint-community.github.io/eslint-utils/api/scope-utils.html#tracker-iterateglobalreferences}
13
- */
14
- iterateGlobalReferences<T>(traceMap: ReferenceTracker.TraceMap<T>): IterableIterator<ReferenceTracker.FoundReference<T>>;
15
- /**
16
- * Iterate the references that the given `traceMap` determined.
17
- * This method starts to search from `require()` expression.
18
- *
19
- * @see {@link https://eslint-community.github.io/eslint-utils/api/scope-utils.html#tracker-iteratecjsreferences}
20
- */
21
- iterateCjsReferences<T>(traceMap: ReferenceTracker.TraceMap<T>): IterableIterator<ReferenceTracker.FoundReference<T>>;
22
- /**
23
- * Iterate the references that the given `traceMap` determined.
24
- * This method starts to search from `import`/`export` declarations.
25
- *
26
- * @see {@link https://eslint-community.github.io/eslint-utils/api/scope-utils.html#tracker-iterateesmreferences}
27
- */
28
- iterateEsmReferences<T>(traceMap: ReferenceTracker.TraceMap<T>): IterableIterator<ReferenceTracker.FoundReference<T>>;
29
- }
30
- interface ReferenceTrackerStatic {
31
- new (globalScope: TSESLint.Scope.Scope, options?: {
32
- /**
33
- * The mode which determines how the `tracker.iterateEsmReferences()` method scans CommonJS modules.
34
- * If this is `"strict"`, the method binds CommonJS modules to the default export. Otherwise, the method binds
35
- * CommonJS modules to both the default export and named exports. Optional. Default is `"strict"`.
36
- */
37
- mode?: 'legacy' | 'strict';
38
- /**
39
- * The name list of Global Object. Optional. Default is `["global", "globalThis", "self", "window"]`.
40
- */
41
- globalObjectNames?: readonly string[];
42
- }): ReferenceTracker;
43
- readonly READ: typeof ReferenceTrackerREAD;
44
- readonly CALL: typeof ReferenceTrackerCALL;
45
- readonly CONSTRUCT: typeof ReferenceTrackerCONSTRUCT;
46
- readonly ESM: typeof ReferenceTrackerESM;
47
- }
48
- declare namespace ReferenceTracker {
49
- type READ = ReferenceTrackerStatic['READ'];
50
- type CALL = ReferenceTrackerStatic['CALL'];
51
- type CONSTRUCT = ReferenceTrackerStatic['CONSTRUCT'];
52
- type ESM = ReferenceTrackerStatic['ESM'];
53
- type ReferenceType = CALL | CONSTRUCT | READ;
54
- type TraceMap<T = any> = Record<string, TraceMapElement<T>>;
55
- interface TraceMapElement<T> {
56
- [ReferenceTrackerREAD]?: T;
57
- [ReferenceTrackerCALL]?: T;
58
- [ReferenceTrackerCONSTRUCT]?: T;
59
- [ReferenceTrackerESM]?: true;
60
- [key: string]: TraceMapElement<T>;
61
- }
62
- interface FoundReference<T = any> {
63
- node: TSESTree.Node;
64
- path: readonly string[];
65
- type: ReferenceType;
66
- info: T;
67
- }
68
- }
69
- /**
70
- * The tracker for references. This provides reference tracking for global variables, CommonJS modules, and ES modules.
71
- *
72
- * @see {@link https://eslint-community.github.io/eslint-utils/api/scope-utils.html#referencetracker-class}
73
- */
74
- declare const ReferenceTracker: ReferenceTrackerStatic;
75
- export { ReferenceTracker };
76
- //# sourceMappingURL=ReferenceTracker.d.ts.map
@@ -1,76 +0,0 @@
1
- import type * as TSESLint from '../../ts-eslint';
2
- import type { TSESTree } from '../../ts-estree';
3
- /**
4
- * Get the proper location of a given function node to report.
5
- *
6
- * @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#getfunctionheadlocation}
7
- */
8
- declare const getFunctionHeadLocation: (node: TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, sourceCode: TSESLint.SourceCode) => TSESTree.SourceLocation;
9
- /**
10
- * Get the name and kind of a given function node.
11
- *
12
- * @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#getfunctionnamewithkind}
13
- */
14
- declare const getFunctionNameWithKind: (node: TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, sourceCode?: TSESLint.SourceCode) => string;
15
- /**
16
- * Get the property name of a given property node.
17
- * If the node is a computed property, this tries to compute the property name by the getStringIfConstant function.
18
- *
19
- * @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#getpropertyname}
20
- * @returns The property name of the node. If the property name is not constant then it returns `null`.
21
- */
22
- declare const getPropertyName: (node: TSESTree.MemberExpression | TSESTree.MethodDefinition | TSESTree.Property | TSESTree.PropertyDefinition, initialScope?: TSESLint.Scope.Scope) => string | null;
23
- /**
24
- * Get the value of a given node if it can decide the value statically.
25
- * If the 2nd parameter `initialScope` was given, this function tries to resolve identifier references which are in the
26
- * given node as much as possible. In the resolving way, it does on the assumption that built-in global objects have
27
- * not been modified.
28
- * For example, it considers `Symbol.iterator`, ` String.raw``hello`` `, and `Object.freeze({a: 1}).a` as static.
29
- *
30
- * @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#getstaticvalue}
31
- * @returns The `{ value: any }` shaped object. The `value` property is the static value. If it couldn't compute the
32
- * static value of the node, it returns `null`.
33
- */
34
- declare const getStaticValue: (node: TSESTree.Node, initialScope?: TSESLint.Scope.Scope) => {
35
- value: unknown;
36
- } | null;
37
- /**
38
- * Get the string value of a given node.
39
- * This function is a tiny wrapper of the getStaticValue function.
40
- *
41
- * @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#getstringifconstant}
42
- */
43
- declare const getStringIfConstant: (node: TSESTree.Node, initialScope?: TSESLint.Scope.Scope) => string | null;
44
- /**
45
- * Check whether a given node has any side effect or not.
46
- * The side effect means that it may modify a certain variable or object member. This function considers the node which
47
- * contains the following types as the node which has side effects:
48
- * - `AssignmentExpression`
49
- * - `AwaitExpression`
50
- * - `CallExpression`
51
- * - `ImportExpression`
52
- * - `NewExpression`
53
- * - `UnaryExpression([operator = "delete"])`
54
- * - `UpdateExpression`
55
- * - `YieldExpression`
56
- * - When `options.considerGetters` is `true`:
57
- * - `MemberExpression`
58
- * - When `options.considerImplicitTypeConversion` is `true`:
59
- * - `BinaryExpression([operator = "==" | "!=" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "|" | "^" | "&" | "in"])`
60
- * - `MemberExpression([computed = true])`
61
- * - `MethodDefinition([computed = true])`
62
- * - `Property([computed = true])`
63
- * - `UnaryExpression([operator = "-" | "+" | "!" | "~"])`
64
- *
65
- * @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#hassideeffect}
66
- */
67
- declare const hasSideEffect: (node: TSESTree.Node, sourceCode: TSESLint.SourceCode, options?: {
68
- considerGetters?: boolean;
69
- considerImplicitTypeConversion?: boolean;
70
- }) => boolean;
71
- declare const isParenthesized: {
72
- (node: TSESTree.Node, sourceCode: TSESLint.SourceCode): boolean;
73
- (times: number, node: TSESTree.Node, sourceCode: TSESLint.SourceCode): boolean;
74
- };
75
- export { getFunctionHeadLocation, getFunctionNameWithKind, getPropertyName, getStaticValue, getStringIfConstant, hasSideEffect, isParenthesized, };
76
- //# sourceMappingURL=astUtilities.d.ts.map
@@ -1,6 +0,0 @@
1
- export * from './astUtilities';
2
- export * from './PatternMatcher';
3
- export * from './predicates';
4
- export * from './ReferenceTracker';
5
- export * from './scopeAnalysis';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1,32 +0,0 @@
1
- import type { TSESTree } from '../../ts-estree';
2
- type IsSpecificTokenFunction<SpecificToken extends TSESTree.Token> = (token: TSESTree.Token) => token is SpecificToken;
3
- type IsNotSpecificTokenFunction<SpecificToken extends TSESTree.Token> = (token: TSESTree.Token) => token is Exclude<TSESTree.Token, SpecificToken>;
4
- type PunctuatorTokenWithValue<Value extends string> = TSESTree.PunctuatorToken & {
5
- value: Value;
6
- };
7
- type IsPunctuatorTokenWithValueFunction<Value extends string> = IsSpecificTokenFunction<PunctuatorTokenWithValue<Value>>;
8
- type IsNotPunctuatorTokenWithValueFunction<Value extends string> = IsNotSpecificTokenFunction<PunctuatorTokenWithValue<Value>>;
9
- declare const isArrowToken: IsPunctuatorTokenWithValueFunction<"=>">;
10
- declare const isNotArrowToken: IsNotPunctuatorTokenWithValueFunction<"=>">;
11
- declare const isClosingBraceToken: IsPunctuatorTokenWithValueFunction<"}">;
12
- declare const isNotClosingBraceToken: IsNotPunctuatorTokenWithValueFunction<"}">;
13
- declare const isClosingBracketToken: IsPunctuatorTokenWithValueFunction<"]">;
14
- declare const isNotClosingBracketToken: IsNotPunctuatorTokenWithValueFunction<"]">;
15
- declare const isClosingParenToken: IsPunctuatorTokenWithValueFunction<")">;
16
- declare const isNotClosingParenToken: IsNotPunctuatorTokenWithValueFunction<")">;
17
- declare const isColonToken: IsPunctuatorTokenWithValueFunction<":">;
18
- declare const isNotColonToken: IsNotPunctuatorTokenWithValueFunction<":">;
19
- declare const isCommaToken: IsPunctuatorTokenWithValueFunction<",">;
20
- declare const isNotCommaToken: IsNotPunctuatorTokenWithValueFunction<",">;
21
- declare const isCommentToken: IsSpecificTokenFunction<TSESTree.Comment>;
22
- declare const isNotCommentToken: IsNotSpecificTokenFunction<TSESTree.Comment>;
23
- declare const isOpeningBraceToken: IsPunctuatorTokenWithValueFunction<"{">;
24
- declare const isNotOpeningBraceToken: IsNotPunctuatorTokenWithValueFunction<"{">;
25
- declare const isOpeningBracketToken: IsPunctuatorTokenWithValueFunction<"[">;
26
- declare const isNotOpeningBracketToken: IsNotPunctuatorTokenWithValueFunction<"[">;
27
- declare const isOpeningParenToken: IsPunctuatorTokenWithValueFunction<"(">;
28
- declare const isNotOpeningParenToken: IsNotPunctuatorTokenWithValueFunction<"(">;
29
- declare const isSemicolonToken: IsPunctuatorTokenWithValueFunction<";">;
30
- declare const isNotSemicolonToken: IsNotPunctuatorTokenWithValueFunction<";">;
31
- export { isArrowToken, isClosingBraceToken, isClosingBracketToken, isClosingParenToken, isColonToken, isCommaToken, isCommentToken, isNotArrowToken, isNotClosingBraceToken, isNotClosingBracketToken, isNotClosingParenToken, isNotColonToken, isNotCommaToken, isNotCommentToken, isNotOpeningBraceToken, isNotOpeningBracketToken, isNotOpeningParenToken, isNotSemicolonToken, isOpeningBraceToken, isOpeningBracketToken, isOpeningParenToken, isSemicolonToken, };
32
- //# sourceMappingURL=predicates.d.ts.map
@@ -1,18 +0,0 @@
1
- import type * as TSESLint from '../../ts-eslint';
2
- import type { TSESTree } from '../../ts-estree';
3
- /**
4
- * Get the variable of a given name.
5
- *
6
- * @see {@link https://eslint-community.github.io/eslint-utils/api/scope-utils.html#findvariable}
7
- */
8
- declare const findVariable: (initialScope: TSESLint.Scope.Scope, nameOrNode: TSESTree.Identifier | string) => TSESLint.Scope.Variable | null;
9
- /**
10
- * Get the innermost scope which contains a given node.
11
- *
12
- * @see {@link https://eslint-community.github.io/eslint-utils/api/scope-utils.html#getinnermostscope}
13
- * @returns The innermost scope which contains the given node.
14
- * If such scope doesn't exist then it returns the 1st argument `initialScope`.
15
- */
16
- declare const getInnermostScope: (initialScope: TSESLint.Scope.Scope, node: TSESTree.Node) => TSESLint.Scope.Scope;
17
- export { findVariable, getInnermostScope };
18
- //# sourceMappingURL=scopeAnalysis.d.ts.map