@typescript-eslint/utils 6.0.0-alpha.99 → 6.0.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 (96) hide show
  1. package/README.md +3 -1
  2. package/{_ts4.2 → _ts4.3}/dist/ast-utils/eslint-utils/ReferenceTracker.d.ts +2 -2
  3. package/{_ts4.2 → _ts4.3}/dist/ast-utils/eslint-utils/astUtilities.d.ts +3 -3
  4. package/{_ts4.2 → _ts4.3}/dist/ast-utils/eslint-utils/scopeAnalysis.d.ts +1 -1
  5. package/{_ts4.2 → _ts4.3}/dist/ast-utils/helpers.d.ts +3 -3
  6. package/{_ts4.2 → _ts4.3}/dist/ast-utils/predicates.d.ts +16 -16
  7. package/{_ts4.2 → _ts4.3}/dist/eslint-utils/RuleCreator.d.ts +2 -2
  8. package/{_ts4.2 → _ts4.3}/dist/eslint-utils/deepMerge.d.ts +1 -1
  9. package/_ts4.3/dist/eslint-utils/getParserServices.d.ts +24 -0
  10. package/{_ts4.2 → _ts4.3}/dist/eslint-utils/index.d.ts +0 -2
  11. package/_ts4.3/dist/json-schema.d.ts +392 -0
  12. package/{_ts4.2 → _ts4.3}/dist/ts-eslint/CLIEngine.d.ts +1 -1
  13. package/{_ts4.2 → _ts4.3}/dist/ts-eslint/ESLint.d.ts +3 -3
  14. package/{_ts4.2 → _ts4.3}/dist/ts-eslint/Linter.d.ts +22 -17
  15. package/{_ts4.2 → _ts4.3}/dist/ts-eslint/Rule.d.ts +20 -9
  16. package/{_ts4.2 → _ts4.3}/dist/ts-eslint/RuleTester.d.ts +5 -5
  17. package/{_ts4.2 → _ts4.3}/dist/ts-eslint/Scope.d.ts +1 -1
  18. package/{_ts4.2 → _ts4.3}/dist/ts-eslint/SourceCode.d.ts +3 -3
  19. package/dist/ast-utils/eslint-utils/PatternMatcher.d.ts.map +1 -1
  20. package/dist/ast-utils/eslint-utils/PatternMatcher.js.map +1 -1
  21. package/dist/ast-utils/eslint-utils/ReferenceTracker.d.ts +2 -2
  22. package/dist/ast-utils/eslint-utils/ReferenceTracker.d.ts.map +1 -1
  23. package/dist/ast-utils/eslint-utils/astUtilities.d.ts +3 -3
  24. package/dist/ast-utils/eslint-utils/astUtilities.d.ts.map +1 -1
  25. package/dist/ast-utils/eslint-utils/scopeAnalysis.d.ts +1 -1
  26. package/dist/ast-utils/eslint-utils/scopeAnalysis.d.ts.map +1 -1
  27. package/dist/ast-utils/helpers.d.ts +3 -3
  28. package/dist/ast-utils/predicates.d.ts +16 -16
  29. package/dist/ast-utils/predicates.d.ts.map +1 -1
  30. package/dist/eslint-utils/RuleCreator.d.ts +2 -2
  31. package/dist/eslint-utils/RuleCreator.d.ts.map +1 -1
  32. package/dist/eslint-utils/RuleCreator.js.map +1 -1
  33. package/dist/eslint-utils/deepMerge.d.ts +1 -1
  34. package/dist/eslint-utils/deepMerge.d.ts.map +1 -1
  35. package/dist/eslint-utils/deepMerge.js.map +1 -1
  36. package/dist/eslint-utils/getParserServices.d.ts +18 -3
  37. package/dist/eslint-utils/getParserServices.d.ts.map +1 -1
  38. package/dist/eslint-utils/getParserServices.js +1 -5
  39. package/dist/eslint-utils/getParserServices.js.map +1 -1
  40. package/dist/eslint-utils/index.d.ts +0 -2
  41. package/dist/eslint-utils/index.d.ts.map +1 -1
  42. package/dist/eslint-utils/index.js +0 -2
  43. package/dist/eslint-utils/index.js.map +1 -1
  44. package/dist/json-schema.d.ts +391 -1
  45. package/dist/json-schema.d.ts.map +1 -1
  46. package/dist/json-schema.js +6 -3
  47. package/dist/json-schema.js.map +1 -1
  48. package/dist/ts-eslint/CLIEngine.d.ts +1 -1
  49. package/dist/ts-eslint/CLIEngine.d.ts.map +1 -1
  50. package/dist/ts-eslint/ESLint.d.ts +3 -3
  51. package/dist/ts-eslint/ESLint.d.ts.map +1 -1
  52. package/dist/ts-eslint/Linter.d.ts +21 -17
  53. package/dist/ts-eslint/Linter.d.ts.map +1 -1
  54. package/dist/ts-eslint/Linter.js.map +1 -1
  55. package/dist/ts-eslint/Rule.d.ts +20 -9
  56. package/dist/ts-eslint/Rule.d.ts.map +1 -1
  57. package/dist/ts-eslint/RuleTester.d.ts +5 -5
  58. package/dist/ts-eslint/RuleTester.d.ts.map +1 -1
  59. package/dist/ts-eslint/RuleTester.js.map +1 -1
  60. package/dist/ts-eslint/Scope.d.ts +1 -1
  61. package/dist/ts-eslint/Scope.d.ts.map +1 -1
  62. package/dist/ts-eslint/Scope.js +1 -2
  63. package/dist/ts-eslint/Scope.js.map +1 -1
  64. package/dist/ts-eslint/SourceCode.d.ts +3 -3
  65. package/dist/ts-eslint/SourceCode.d.ts.map +1 -1
  66. package/package.json +14 -14
  67. package/_ts4.2/dist/eslint-utils/batchedSingleLineTests.d.ts +0 -24
  68. package/_ts4.2/dist/eslint-utils/getParserServices.d.ts +0 -9
  69. package/_ts4.2/dist/eslint-utils/rule-tester/RuleTester.d.ts +0 -49
  70. package/_ts4.2/dist/eslint-utils/rule-tester/dependencyConstraints.d.ts +0 -17
  71. package/_ts4.2/dist/json-schema.d.ts +0 -2
  72. package/dist/eslint-utils/batchedSingleLineTests.d.ts +0 -24
  73. package/dist/eslint-utils/batchedSingleLineTests.d.ts.map +0 -1
  74. package/dist/eslint-utils/batchedSingleLineTests.js +0 -36
  75. package/dist/eslint-utils/batchedSingleLineTests.js.map +0 -1
  76. package/dist/eslint-utils/rule-tester/RuleTester.d.ts +0 -49
  77. package/dist/eslint-utils/rule-tester/RuleTester.d.ts.map +0 -1
  78. package/dist/eslint-utils/rule-tester/RuleTester.js +0 -250
  79. package/dist/eslint-utils/rule-tester/RuleTester.js.map +0 -1
  80. package/dist/eslint-utils/rule-tester/dependencyConstraints.d.ts +0 -17
  81. package/dist/eslint-utils/rule-tester/dependencyConstraints.d.ts.map +0 -1
  82. package/dist/eslint-utils/rule-tester/dependencyConstraints.js +0 -53
  83. package/dist/eslint-utils/rule-tester/dependencyConstraints.js.map +0 -1
  84. /package/{_ts4.2 → _ts4.3}/dist/ast-utils/eslint-utils/PatternMatcher.d.ts +0 -0
  85. /package/{_ts4.2 → _ts4.3}/dist/ast-utils/eslint-utils/index.d.ts +0 -0
  86. /package/{_ts4.2 → _ts4.3}/dist/ast-utils/eslint-utils/predicates.d.ts +0 -0
  87. /package/{_ts4.2 → _ts4.3}/dist/ast-utils/index.d.ts +0 -0
  88. /package/{_ts4.2 → _ts4.3}/dist/ast-utils/misc.d.ts +0 -0
  89. /package/{_ts4.2 → _ts4.3}/dist/eslint-utils/InferTypesFromRule.d.ts +0 -0
  90. /package/{_ts4.2 → _ts4.3}/dist/eslint-utils/applyDefault.d.ts +0 -0
  91. /package/{_ts4.2 → _ts4.3}/dist/eslint-utils/nullThrows.d.ts +0 -0
  92. /package/{_ts4.2 → _ts4.3}/dist/index.d.ts +0 -0
  93. /package/{_ts4.2 → _ts4.3}/dist/ts-eslint/AST.d.ts +0 -0
  94. /package/{_ts4.2 → _ts4.3}/dist/ts-eslint/ParserOptions.d.ts +0 -0
  95. /package/{_ts4.2 → _ts4.3}/dist/ts-eslint/index.d.ts +0 -0
  96. /package/{_ts4.2 → _ts4.3}/dist/ts-estree.d.ts +0 -0
package/README.md CHANGED
@@ -5,6 +5,8 @@
5
5
  [![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/utils.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/utils)
6
6
  [![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/utils.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/utils)
7
7
 
8
- 👉 See **https://typescript-eslint.io/architecture/utils** for documentation on this package.
8
+ 👉 See **https://typescript-eslint.io/packages/utils** for documentation on this package.
9
9
 
10
10
  > See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code.
11
+
12
+ <!-- Local path for docs: docs/packages/Utils.mdx -->
@@ -34,7 +34,7 @@ interface ReferenceTrackerStatic {
34
34
  * If this is `"strict"`, the method binds CommonJS modules to the default export. Otherwise, the method binds
35
35
  * CommonJS modules to both the default export and named exports. Optional. Default is `"strict"`.
36
36
  */
37
- mode?: 'strict' | 'legacy';
37
+ mode?: 'legacy' | 'strict';
38
38
  /**
39
39
  * The name list of Global Object. Optional. Default is `["global", "globalThis", "self", "window"]`.
40
40
  */
@@ -50,7 +50,7 @@ declare namespace ReferenceTracker {
50
50
  type CALL = ReferenceTrackerStatic['CALL'];
51
51
  type CONSTRUCT = ReferenceTrackerStatic['CONSTRUCT'];
52
52
  type ESM = ReferenceTrackerStatic['ESM'];
53
- type ReferenceType = READ | CALL | CONSTRUCT;
53
+ type ReferenceType = CALL | CONSTRUCT | READ;
54
54
  type TraceMap<T = any> = Record<string, TraceMapElement<T>>;
55
55
  interface TraceMapElement<T> {
56
56
  [ReferenceTrackerREAD]?: T;
@@ -5,13 +5,13 @@ import type { TSESTree } from '../../ts-estree';
5
5
  *
6
6
  * @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#getfunctionheadlocation}
7
7
  */
8
- declare const getFunctionHeadLocation: (node: TSESTree.FunctionDeclaration | TSESTree.FunctionExpression | TSESTree.ArrowFunctionExpression, sourceCode: TSESLint.SourceCode) => TSESTree.SourceLocation;
8
+ declare const getFunctionHeadLocation: (node: TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, sourceCode: TSESLint.SourceCode) => TSESTree.SourceLocation;
9
9
  /**
10
10
  * Get the name and kind of a given function node.
11
11
  *
12
12
  * @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#getfunctionnamewithkind}
13
13
  */
14
- declare const getFunctionNameWithKind: (node: TSESTree.FunctionDeclaration | TSESTree.FunctionExpression | TSESTree.ArrowFunctionExpression, sourceCode?: TSESLint.SourceCode) => string;
14
+ declare const getFunctionNameWithKind: (node: TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, sourceCode?: TSESLint.SourceCode) => string;
15
15
  /**
16
16
  * Get the property name of a given property node.
17
17
  * If the node is a computed property, this tries to compute the property name by the getStringIfConstant function.
@@ -19,7 +19,7 @@ declare const getFunctionNameWithKind: (node: TSESTree.FunctionDeclaration | TSE
19
19
  * @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#getpropertyname}
20
20
  * @returns The property name of the node. If the property name is not constant then it returns `null`.
21
21
  */
22
- declare const getPropertyName: (node: TSESTree.MemberExpression | TSESTree.Property | TSESTree.MethodDefinition | TSESTree.PropertyDefinition, initialScope?: TSESLint.Scope.Scope) => string | null;
22
+ declare const getPropertyName: (node: TSESTree.MemberExpression | TSESTree.MethodDefinition | TSESTree.Property | TSESTree.PropertyDefinition, initialScope?: TSESLint.Scope.Scope) => string | null;
23
23
  /**
24
24
  * Get the value of a given node if it can decide the value statically.
25
25
  * If the 2nd parameter `initialScope` was given, this function tries to resolve identifier references which are in the
@@ -5,7 +5,7 @@ import type { TSESTree } from '../../ts-estree';
5
5
  *
6
6
  * @see {@link https://eslint-community.github.io/eslint-utils/api/scope-utils.html#findvariable}
7
7
  */
8
- declare const findVariable: (initialScope: TSESLint.Scope.Scope, nameOrNode: string | TSESTree.Identifier) => TSESLint.Scope.Variable | null;
8
+ declare const findVariable: (initialScope: TSESLint.Scope.Scope, nameOrNode: TSESTree.Identifier | string) => TSESLint.Scope.Variable | null;
9
9
  /**
10
10
  * Get the innermost scope which contains a given node.
11
11
  *
@@ -1147,7 +1147,7 @@ export declare const isNodeOfTypeWithConditions: <NodeType extends AST_NODE_TYPE
1147
1147
  type: NodeType;
1148
1148
  }> | Extract<TSESTree.YieldExpression, {
1149
1149
  type: NodeType;
1150
- }>, Conditions extends Partial<ExtractedNode>>(nodeType: NodeType, conditions: Conditions) => (node: TSESTree.Node | null | undefined) => node is ExtractedNode & Conditions;
1150
+ }>, Conditions extends Partial<ExtractedNode>>(nodeType: NodeType, conditions: Conditions) => (node: TSESTree.Node | null | undefined) => node is Conditions & ExtractedNode;
1151
1151
  export declare const isTokenOfTypeWithConditions: <TokenType extends AST_TOKEN_TYPES, ExtractedToken extends Extract<TSESTree.BooleanToken, {
1152
1152
  type: TokenType;
1153
1153
  }> | Extract<TSESTree.BlockComment, {
@@ -1176,7 +1176,7 @@ export declare const isTokenOfTypeWithConditions: <TokenType extends AST_TOKEN_T
1176
1176
  type: TokenType;
1177
1177
  }>, Conditions extends Partial<TSESTree.Token & {
1178
1178
  type: TokenType;
1179
- }>>(tokenType: TokenType, conditions: Conditions) => (token: TSESTree.Token | null | undefined) => token is ExtractedToken & Conditions;
1179
+ }>>(tokenType: TokenType, conditions: Conditions) => (token: TSESTree.Token | null | undefined) => token is Conditions & ExtractedToken;
1180
1180
  export declare const isNotTokenOfTypeWithConditions: <TokenType extends AST_TOKEN_TYPES, ExtractedToken extends Extract<TSESTree.BooleanToken, {
1181
1181
  type: TokenType;
1182
1182
  }> | Extract<TSESTree.BlockComment, {
@@ -1203,5 +1203,5 @@ export declare const isNotTokenOfTypeWithConditions: <TokenType extends AST_TOKE
1203
1203
  type: TokenType;
1204
1204
  }> | Extract<TSESTree.TemplateToken, {
1205
1205
  type: TokenType;
1206
- }>, Conditions extends Partial<ExtractedToken>>(tokenType: TokenType, conditions: Conditions) => (token: TSESTree.Token | null | undefined) => token is Exclude<TSESTree.BooleanToken, ExtractedToken & Conditions> | Exclude<TSESTree.BlockComment, ExtractedToken & Conditions> | Exclude<TSESTree.LineComment, ExtractedToken & Conditions> | Exclude<TSESTree.IdentifierToken, ExtractedToken & Conditions> | Exclude<TSESTree.JSXIdentifierToken, ExtractedToken & Conditions> | Exclude<TSESTree.JSXTextToken, ExtractedToken & Conditions> | Exclude<TSESTree.KeywordToken, ExtractedToken & Conditions> | Exclude<TSESTree.NullToken, ExtractedToken & Conditions> | Exclude<TSESTree.NumericToken, ExtractedToken & Conditions> | Exclude<TSESTree.PunctuatorToken, ExtractedToken & Conditions> | Exclude<TSESTree.RegularExpressionToken, ExtractedToken & Conditions> | Exclude<TSESTree.StringToken, ExtractedToken & Conditions> | Exclude<TSESTree.TemplateToken, ExtractedToken & Conditions>;
1206
+ }>, Conditions extends Partial<ExtractedToken>>(tokenType: TokenType, conditions: Conditions) => (token: TSESTree.Token | null | undefined) => token is Exclude<TSESTree.BooleanToken, Conditions & ExtractedToken> | Exclude<TSESTree.BlockComment, Conditions & ExtractedToken> | Exclude<TSESTree.LineComment, Conditions & ExtractedToken> | Exclude<TSESTree.IdentifierToken, Conditions & ExtractedToken> | Exclude<TSESTree.JSXIdentifierToken, Conditions & ExtractedToken> | Exclude<TSESTree.JSXTextToken, Conditions & ExtractedToken> | Exclude<TSESTree.KeywordToken, Conditions & ExtractedToken> | Exclude<TSESTree.NullToken, Conditions & ExtractedToken> | Exclude<TSESTree.NumericToken, Conditions & ExtractedToken> | Exclude<TSESTree.PunctuatorToken, Conditions & ExtractedToken> | Exclude<TSESTree.RegularExpressionToken, Conditions & ExtractedToken> | Exclude<TSESTree.StringToken, Conditions & ExtractedToken> | Exclude<TSESTree.TemplateToken, Conditions & ExtractedToken>;
1207
1207
  //# sourceMappingURL=helpers.d.ts.map
@@ -1,22 +1,22 @@
1
1
  import type { TSESTree } from '../ts-estree';
2
- declare const isOptionalChainPunctuator: (token: TSESTree.Token | null | undefined) => token is TSESTree.PunctuatorToken & {
2
+ declare const isOptionalChainPunctuator: (token: TSESTree.Token | null | undefined) => token is {
3
3
  value: "?.";
4
- };
4
+ } & TSESTree.PunctuatorToken;
5
5
  declare const isNotOptionalChainPunctuator: (token: TSESTree.Token | null | undefined) => token is TSESTree.BooleanToken | TSESTree.BlockComment | TSESTree.LineComment | TSESTree.IdentifierToken | TSESTree.JSXIdentifierToken | TSESTree.JSXTextToken | TSESTree.KeywordToken | TSESTree.NullToken | TSESTree.NumericToken | TSESTree.PunctuatorToken | TSESTree.RegularExpressionToken | TSESTree.StringToken | TSESTree.TemplateToken;
6
- declare const isNonNullAssertionPunctuator: (token: TSESTree.Token | null | undefined) => token is TSESTree.PunctuatorToken & {
6
+ declare const isNonNullAssertionPunctuator: (token: TSESTree.Token | null | undefined) => token is {
7
7
  value: "!";
8
- };
8
+ } & TSESTree.PunctuatorToken;
9
9
  declare const isNotNonNullAssertionPunctuator: (token: TSESTree.Token | null | undefined) => token is TSESTree.BooleanToken | TSESTree.BlockComment | TSESTree.LineComment | TSESTree.IdentifierToken | TSESTree.JSXIdentifierToken | TSESTree.JSXTextToken | TSESTree.KeywordToken | TSESTree.NullToken | TSESTree.NumericToken | TSESTree.PunctuatorToken | TSESTree.RegularExpressionToken | TSESTree.StringToken | TSESTree.TemplateToken;
10
10
  /**
11
11
  * Returns true if and only if the node represents: foo?.() or foo.bar?.()
12
12
  */
13
- declare const isOptionalCallExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.CallExpression & {
13
+ declare const isOptionalCallExpression: (node: TSESTree.Node | null | undefined) => node is {
14
14
  optional: boolean;
15
- };
15
+ } & TSESTree.CallExpression;
16
16
  /**
17
17
  * Returns true if and only if the node represents logical OR
18
18
  */
19
- declare const isLogicalOrOperator: (node: TSESTree.Node | null | undefined) => node is TSESTree.LogicalExpression & Partial<TSESTree.LogicalExpression>;
19
+ declare const isLogicalOrOperator: (node: TSESTree.Node | null | undefined) => node is Partial<TSESTree.LogicalExpression> & TSESTree.LogicalExpression;
20
20
  /**
21
21
  * Checks if a node is a type assertion:
22
22
  * ```
@@ -35,13 +35,13 @@ declare const isClassOrTypeElement: (node: TSESTree.Node | null | undefined) =>
35
35
  /**
36
36
  * Checks if a node is a constructor method.
37
37
  */
38
- declare const isConstructor: (node: TSESTree.Node | null | undefined) => node is (TSESTree.MethodDefinitionComputedName & Partial<TSESTree.MethodDefinitionComputedName>) | (TSESTree.MethodDefinitionNonComputedName & Partial<TSESTree.MethodDefinitionNonComputedName>);
38
+ declare const isConstructor: (node: TSESTree.Node | null | undefined) => node is (Partial<TSESTree.MethodDefinitionComputedName> & TSESTree.MethodDefinitionComputedName) | (Partial<TSESTree.MethodDefinitionNonComputedName> & TSESTree.MethodDefinitionNonComputedName);
39
39
  /**
40
40
  * Checks if a node is a setter method.
41
41
  */
42
- declare function isSetter(node: TSESTree.Node | undefined): node is (TSESTree.MethodDefinition | TSESTree.Property) & {
42
+ declare function isSetter(node: TSESTree.Node | undefined): node is {
43
43
  kind: 'set';
44
- };
44
+ } & (TSESTree.MethodDefinition | TSESTree.Property);
45
45
  declare const isIdentifier: (node: TSESTree.Node | null | undefined) => node is TSESTree.Identifier;
46
46
  /**
47
47
  * Checks if a node represents an `await …` expression.
@@ -50,21 +50,21 @@ declare const isAwaitExpression: (node: TSESTree.Node | null | undefined) => nod
50
50
  /**
51
51
  * Checks if a possible token is the `await` keyword.
52
52
  */
53
- declare const isAwaitKeyword: (token: TSESTree.Token | null | undefined) => token is TSESTree.IdentifierToken & {
53
+ declare const isAwaitKeyword: (token: TSESTree.Token | null | undefined) => token is {
54
54
  value: "await";
55
- };
55
+ } & TSESTree.IdentifierToken;
56
56
  /**
57
57
  * Checks if a possible token is the `type` keyword.
58
58
  */
59
- declare const isTypeKeyword: (token: TSESTree.Token | null | undefined) => token is TSESTree.IdentifierToken & {
59
+ declare const isTypeKeyword: (token: TSESTree.Token | null | undefined) => token is {
60
60
  value: "type";
61
- };
61
+ } & TSESTree.IdentifierToken;
62
62
  /**
63
63
  * Checks if a possible token is the `import` keyword.
64
64
  */
65
- declare const isImportKeyword: (token: TSESTree.Token | null | undefined) => token is TSESTree.KeywordToken & {
65
+ declare const isImportKeyword: (token: TSESTree.Token | null | undefined) => token is {
66
66
  value: "import";
67
- };
67
+ } & TSESTree.KeywordToken;
68
68
  declare const isLoop: (node: TSESTree.Node | null | undefined) => node is TSESTree.DoWhileStatement | TSESTree.ForInStatement | TSESTree.ForOfStatement | TSESTree.ForStatement | TSESTree.WhileStatement;
69
69
  export { isAwaitExpression, isAwaitKeyword, isConstructor, isClassOrTypeElement, isFunction, isFunctionOrFunctionType, isFunctionType, isIdentifier, isImportKeyword, isLoop, isLogicalOrOperator, isNonNullAssertionPunctuator, isNotNonNullAssertionPunctuator, isNotOptionalChainPunctuator, isOptionalChainPunctuator, isOptionalCallExpression, isSetter, isTSConstructorType, isTSFunctionType, isTypeAssertion, isTypeKeyword, isVariableDeclarator, };
70
70
  //# sourceMappingURL=predicates.d.ts.map
@@ -1,8 +1,8 @@
1
1
  import type { RuleContext, RuleListener, RuleMetaData, RuleMetaDataDocs, RuleModule } from '../ts-eslint/Rule';
2
2
  export type NamedCreateRuleMetaDocs = Omit<RuleMetaDataDocs, 'url'>;
3
- export type NamedCreateRuleMeta<TMessageIds extends string> = {
3
+ export type NamedCreateRuleMeta<TMessageIds extends string> = Omit<RuleMetaData<TMessageIds>, 'docs'> & {
4
4
  docs: NamedCreateRuleMetaDocs;
5
- } & Omit<RuleMetaData<TMessageIds>, 'docs'>;
5
+ };
6
6
  export interface RuleCreateAndOptions<TOptions extends readonly unknown[], TMessageIds extends string> {
7
7
  create: (context: Readonly<RuleContext<TMessageIds, TOptions>>, optionsWithDefault: Readonly<TOptions>) => RuleListener;
8
8
  defaultOptions: Readonly<TOptions>;
@@ -4,7 +4,7 @@ type ObjectLike<T = unknown> = Record<string, T>;
4
4
  * @param obj an object
5
5
  * @returns `true` if obj is an object
6
6
  */
7
- declare function isObjectNotArray<T extends ObjectLike>(obj: unknown | unknown[]): obj is T;
7
+ declare function isObjectNotArray<T extends ObjectLike>(obj: unknown): obj is T;
8
8
  /**
9
9
  * Pure function - doesn't mutate either parameter!
10
10
  * Merges two objects together deeply, overwriting the properties in first with the properties in second
@@ -0,0 +1,24 @@
1
+ import type * as TSESLint from '../ts-eslint';
2
+ import type { ParserServices, ParserServicesWithTypeInformation } from '../ts-estree';
3
+ /**
4
+ * Try to retrieve type-aware parser service from context.
5
+ * This **_will_** throw if it is not available.
6
+ */
7
+ declare function getParserServices<TMessageIds extends string, TOptions extends readonly unknown[]>(context: Readonly<TSESLint.RuleContext<TMessageIds, TOptions>>): ParserServicesWithTypeInformation;
8
+ /**
9
+ * Try to retrieve type-aware parser service from context.
10
+ * This **_will_** throw if it is not available.
11
+ */
12
+ declare function getParserServices<TMessageIds extends string, TOptions extends readonly unknown[]>(context: Readonly<TSESLint.RuleContext<TMessageIds, TOptions>>, allowWithoutFullTypeInformation: false): ParserServicesWithTypeInformation;
13
+ /**
14
+ * Try to retrieve type-aware parser service from context.
15
+ * This **_will not_** throw if it is not available.
16
+ */
17
+ declare function getParserServices<TMessageIds extends string, TOptions extends readonly unknown[]>(context: Readonly<TSESLint.RuleContext<TMessageIds, TOptions>>, allowWithoutFullTypeInformation: true): ParserServices;
18
+ /**
19
+ * Try to retrieve type-aware parser service from context.
20
+ * This may or may not throw if it is not available, depending on if `allowWithoutFullTypeInformation` is `true`
21
+ */
22
+ declare function getParserServices<TMessageIds extends string, TOptions extends readonly unknown[]>(context: Readonly<TSESLint.RuleContext<TMessageIds, TOptions>>, allowWithoutFullTypeInformation: boolean): ParserServices;
23
+ export { getParserServices };
24
+ //# sourceMappingURL=getParserServices.d.ts.map
@@ -1,9 +1,7 @@
1
1
  export * from './applyDefault';
2
- export * from './batchedSingleLineTests';
3
2
  export * from './getParserServices';
4
3
  export * from './InferTypesFromRule';
5
4
  export * from './RuleCreator';
6
- export * from './rule-tester/RuleTester';
7
5
  export * from './deepMerge';
8
6
  export * from './nullThrows';
9
7
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,392 @@
1
+ /**
2
+ * This is a fork of https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13f63c2eb8d7479caf01ab8d72f9e3683368a8f5/types/json-schema/index.d.ts
3
+ * We intentionally fork this because:
4
+ * - ESLint ***ONLY*** supports JSONSchema v4
5
+ * - We want to provide stricter types
6
+ */
7
+ /**
8
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
9
+ */
10
+ export type JSONSchema4TypeName = 'any' | 'array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string';
11
+ /**
12
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
13
+ */
14
+ export type JSONSchema4Type = boolean | number | string | null;
15
+ /**
16
+ * Meta schema
17
+ *
18
+ * Recommended values:
19
+ * - 'http://json-schema.org/schema#'
20
+ * - 'http://json-schema.org/hyper-schema#'
21
+ * - 'http://json-schema.org/draft-04/schema#'
22
+ * - 'http://json-schema.org/draft-04/hyper-schema#'
23
+ * - 'http://json-schema.org/draft-03/schema#'
24
+ * - 'http://json-schema.org/draft-03/hyper-schema#'
25
+ *
26
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
27
+ */
28
+ export type JSONSchema4Version = string;
29
+ /**
30
+ * JSON Schema V4
31
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-04
32
+ */
33
+ export type JSONSchema4 = JSONSchema4AllOfSchema | JSONSchema4AnyOfSchema | JSONSchema4AnySchema | JSONSchema4ArraySchema | JSONSchema4BoleanSchema | JSONSchema4MultiSchema | JSONSchema4NullSchema | JSONSchema4NumberSchema | JSONSchema4ObjectSchema | JSONSchema4OneOfSchema | JSONSchema4RefSchema | JSONSchema4StringSchema;
34
+ interface JSONSchema4Base {
35
+ id?: string | undefined;
36
+ $schema?: JSONSchema4Version | undefined;
37
+ /**
38
+ * A single type, or a union of simple types
39
+ */
40
+ type?: JSONSchema4TypeName | JSONSchema4TypeName[] | undefined;
41
+ /**
42
+ * Path to a schema defined in `definitions`/`$defs` that will form the base
43
+ * for this schema.
44
+ *
45
+ * If you are defining an "array" schema (`schema: [ ... ]`) for your rule
46
+ * then you should prefix this with `items/0` so that the validator can find
47
+ * your definitions.
48
+ *
49
+ * eg: `'#/items/0/definitions/myDef'`
50
+ *
51
+ * Otherwise if you are defining an "object" schema (`schema: { ... }`) for
52
+ * your rule you can directly reference your definitions
53
+ *
54
+ * eg: `'#/definitions/myDef'`
55
+ */
56
+ $ref?: string | undefined;
57
+ /**
58
+ * This attribute is a string that provides a short description of the
59
+ * instance property.
60
+ *
61
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21
62
+ */
63
+ title?: string | undefined;
64
+ /**
65
+ * This attribute is a string that provides a full description of the of
66
+ * purpose the instance property.
67
+ *
68
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22
69
+ */
70
+ description?: string | undefined;
71
+ /**
72
+ * Reusable definitions that can be referenced via `$ref`
73
+ */
74
+ definitions?: {
75
+ [k: string]: JSONSchema4;
76
+ } | undefined;
77
+ /**
78
+ * Reusable definitions that can be referenced via `$ref`
79
+ */
80
+ $defs?: {
81
+ [k: string]: JSONSchema4;
82
+ } | undefined;
83
+ /**
84
+ * The value of this property MUST be another schema which will provide
85
+ * a base schema which the current schema will inherit from. The
86
+ * inheritance rules are such that any instance that is valid according
87
+ * to the current schema MUST be valid according to the referenced
88
+ * schema. This MAY also be an array, in which case, the instance MUST
89
+ * be valid for all the schemas in the array. A schema that extends
90
+ * another schema MAY define additional attributes, constrain existing
91
+ * attributes, or add other constraints.
92
+ *
93
+ * Conceptually, the behavior of extends can be seen as validating an
94
+ * instance against all constraints in the extending schema as well as
95
+ * the extended schema(s).
96
+ *
97
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26
98
+ */
99
+ extends?: string[] | string | undefined;
100
+ /**
101
+ * The default value for the item if not present
102
+ */
103
+ default?: JSONSchema4Type | undefined;
104
+ /**
105
+ * This attribute indicates if the instance must have a value, and not
106
+ * be undefined. This is false by default, making the instance
107
+ * optional.
108
+ *
109
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7
110
+ */
111
+ required?: string[] | boolean | undefined;
112
+ /**
113
+ * (NOT) Must not be valid against the given schema
114
+ */
115
+ not?: JSONSchema4 | undefined;
116
+ /**
117
+ * (AND) Must be valid against all of the sub-schemas
118
+ */
119
+ allOf?: JSONSchema4[] | undefined;
120
+ /**
121
+ * (OR) Must be valid against any of the sub-schemas
122
+ */
123
+ anyOf?: JSONSchema4[] | undefined;
124
+ /**
125
+ * (XOR) Must be valid against exactly one of the sub-schemas
126
+ */
127
+ oneOf?: JSONSchema4[] | undefined;
128
+ }
129
+ export interface JSONSchema4RefSchema extends JSONSchema4Base {
130
+ type?: undefined;
131
+ $ref: string;
132
+ }
133
+ export interface JSONSchema4AllOfSchema extends JSONSchema4Base {
134
+ type?: undefined;
135
+ allOf: JSONSchema4[];
136
+ }
137
+ export interface JSONSchema4AnyOfSchema extends JSONSchema4Base {
138
+ type?: undefined;
139
+ anyOf: JSONSchema4[];
140
+ }
141
+ export interface JSONSchema4OneOfSchema extends JSONSchema4Base {
142
+ type?: undefined;
143
+ oneOf: JSONSchema4[];
144
+ }
145
+ export interface JSONSchema4MultiSchema extends Omit<JSONSchema4ObjectSchema, 'enum' | 'type'>, Omit<JSONSchema4ArraySchema, 'enum' | 'type'>, Omit<JSONSchema4StringSchema, 'enum' | 'type'>, Omit<JSONSchema4NumberSchema, 'enum' | 'type'>, Omit<JSONSchema4BoleanSchema, 'enum' | 'type'>, Omit<JSONSchema4NullSchema, 'enum' | 'type'>, Omit<JSONSchema4AnySchema, 'enum' | 'type'> {
146
+ type: JSONSchema4TypeName[];
147
+ /**
148
+ * This provides an enumeration of all possible values that are valid
149
+ * for the instance property. This MUST be an array, and each item in
150
+ * the array represents a possible value for the instance value. If
151
+ * this attribute is defined, the instance value MUST be one of the
152
+ * values in the array in order for the schema to be valid.
153
+ *
154
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
155
+ */
156
+ enum?: JSONSchema4Type[];
157
+ }
158
+ /**
159
+ * @see https://json-schema.org/understanding-json-schema/reference/object.html
160
+ */
161
+ export interface JSONSchema4ObjectSchema extends JSONSchema4Base {
162
+ type: 'object';
163
+ /**
164
+ * This attribute defines a schema for all properties that are not
165
+ * explicitly defined in an object type definition. If specified, the
166
+ * value MUST be a schema or a boolean. If false is provided, no
167
+ * additional properties are allowed beyond the properties defined in
168
+ * the schema. The default value is an empty schema which allows any
169
+ * value for additional properties.
170
+ *
171
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4
172
+ */
173
+ additionalProperties?: JSONSchema4 | boolean | undefined;
174
+ /**
175
+ * This attribute is an object with property definitions that define the
176
+ * valid values of instance object property values. When the instance
177
+ * value is an object, the property values of the instance object MUST
178
+ * conform to the property definitions in this object. In this object,
179
+ * each property definition's value MUST be a schema, and the property's
180
+ * name MUST be the name of the instance property that it defines. The
181
+ * instance property value MUST be valid according to the schema from
182
+ * the property definition. Properties are considered unordered, the
183
+ * order of the instance properties MAY be in any order.
184
+ *
185
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2
186
+ */
187
+ properties?: {
188
+ [k: string]: JSONSchema4;
189
+ } | undefined;
190
+ /**
191
+ * This attribute is an object that defines the schema for a set of
192
+ * property names of an object instance. The name of each property of
193
+ * this attribute's object is a regular expression pattern in the ECMA
194
+ * 262/Perl 5 format, while the value is a schema. If the pattern
195
+ * matches the name of a property on the instance object, the value of
196
+ * the instance's property MUST be valid against the pattern name's
197
+ * schema value.
198
+ *
199
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3
200
+ */
201
+ patternProperties?: {
202
+ [k: string]: JSONSchema4;
203
+ } | undefined;
204
+ /**
205
+ * The `dependencies` keyword conditionally applies a sub-schema when a given
206
+ * property is present. This schema is applied in the same way `allOf` applies
207
+ * schemas. Nothing is merged or extended. Both schemas apply independently.
208
+ */
209
+ dependencies?: {
210
+ [k: string]: JSONSchema4 | string[];
211
+ } | undefined;
212
+ /**
213
+ * The maximum number of properties allowed for record-style schemas
214
+ */
215
+ maxProperties?: number | undefined;
216
+ /**
217
+ * The minimum number of properties required for record-style schemas
218
+ */
219
+ minProperties?: number | undefined;
220
+ }
221
+ /**
222
+ * @see https://json-schema.org/understanding-json-schema/reference/array.html
223
+ */
224
+ export interface JSONSchema4ArraySchema extends JSONSchema4Base {
225
+ type: 'array';
226
+ /**
227
+ * May only be defined when "items" is defined, and is a tuple of JSONSchemas.
228
+ *
229
+ * This provides a definition for additional items in an array instance
230
+ * when tuple definitions of the items is provided. This can be false
231
+ * to indicate additional items in the array are not allowed, or it can
232
+ * be a schema that defines the schema of the additional items.
233
+ *
234
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6
235
+ */
236
+ additionalItems?: JSONSchema4 | boolean | undefined;
237
+ /**
238
+ * This attribute defines the allowed items in an instance array, and
239
+ * MUST be a schema or an array of schemas. The default value is an
240
+ * empty schema which allows any value for items in the instance array.
241
+ *
242
+ * When this attribute value is a schema and the instance value is an
243
+ * array, then all the items in the array MUST be valid according to the
244
+ * schema.
245
+ *
246
+ * When this attribute value is an array of schemas and the instance
247
+ * value is an array, each position in the instance array MUST conform
248
+ * to the schema in the corresponding position for this array. This
249
+ * called tuple typing. When tuple typing is used, additional items are
250
+ * allowed, disallowed, or constrained by the "additionalItems"
251
+ * (Section 5.6) attribute using the same rules as
252
+ * "additionalProperties" (Section 5.4) for objects.
253
+ *
254
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5
255
+ */
256
+ items?: JSONSchema4 | JSONSchema4[] | undefined;
257
+ /**
258
+ * Defines the maximum length of an array
259
+ */
260
+ maxItems?: number | undefined;
261
+ /**
262
+ * Defines the minimum length of an array
263
+ */
264
+ minItems?: number | undefined;
265
+ /**
266
+ * Enforces that all items in the array are unique
267
+ */
268
+ uniqueItems?: boolean | undefined;
269
+ }
270
+ /**
271
+ * @see https://json-schema.org/understanding-json-schema/reference/string.html
272
+ */
273
+ export interface JSONSchema4StringSchema extends JSONSchema4Base {
274
+ type: 'string';
275
+ /**
276
+ * The maximum allowed length for the string
277
+ */
278
+ maxLength?: number | undefined;
279
+ /**
280
+ * The minimum allowed length for the string
281
+ */
282
+ minLength?: number | undefined;
283
+ /**
284
+ * The `pattern` keyword is used to restrict a string to a particular regular
285
+ * expression. The regular expression syntax is the one defined in JavaScript
286
+ * (ECMA 262 specifically) with Unicode support.
287
+ *
288
+ * When defining the regular expressions, it’s important to note that the
289
+ * string is considered valid if the expression matches anywhere within the
290
+ * string. For example, the regular expression "p" will match any string with
291
+ * a p in it, such as "apple" not just a string that is simply "p". Therefore,
292
+ * it is usually less confusing, as a matter of course, to surround the
293
+ * regular expression in ^...$, for example, "^p$", unless there is a good
294
+ * reason not to do so.
295
+ */
296
+ pattern?: string | undefined;
297
+ /**
298
+ * The `format` keyword allows for basic semantic identification of certain
299
+ * kinds of string values that are commonly used.
300
+ *
301
+ * For example, because JSON doesn’t have a “DateTime” type, dates need to be
302
+ * encoded as strings. `format` allows the schema author to indicate that the
303
+ * string value should be interpreted as a date.
304
+ *
305
+ * ajv v6 provides a few built-in formats - all other strings will cause AJV
306
+ * to throw during schema compilation
307
+ */
308
+ format?: 'date-time' | 'date' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'json-pointer-uri-fragment' | 'json-pointer' | 'regex' | 'relative-json-pointer' | 'time' | 'uri-reference' | 'uri-template' | 'uri' | 'url' | 'uuid' | undefined;
309
+ enum?: string[] | undefined;
310
+ }
311
+ /**
312
+ * @see https://json-schema.org/understanding-json-schema/reference/numeric.html
313
+ */
314
+ export interface JSONSchema4NumberSchema extends JSONSchema4Base {
315
+ type: 'integer' | 'number';
316
+ /**
317
+ * Numbers can be restricted to a multiple of a given number, using the
318
+ * `multipleOf` keyword. It may be set to any positive number.
319
+ */
320
+ multipleOf?: number | undefined;
321
+ /**
322
+ * The maximum allowed value for the number
323
+ */
324
+ maximum?: number | undefined;
325
+ /**
326
+ * The minimum allowed value for the number
327
+ */
328
+ minimum?: number | undefined;
329
+ /**
330
+ * The exclusive minimum allowed value for the number
331
+ * - `true` = `x < maximum`
332
+ * - `false` = `x <= maximum`
333
+ *
334
+ * Default is `false`
335
+ */
336
+ exclusiveMaximum?: boolean | undefined;
337
+ /**
338
+ * Indicates whether or not `minimum` is the inclusive or exclusive minimum
339
+ * - `true` = `x > minimum`
340
+ * - `false` = `x ≥ minimum`
341
+ *
342
+ * Default is `false`
343
+ */
344
+ exclusiveMinimum?: boolean | undefined;
345
+ /**
346
+ * This provides an enumeration of all possible values that are valid
347
+ * for the instance property. This MUST be an array, and each item in
348
+ * the array represents a possible value for the instance value. If
349
+ * this attribute is defined, the instance value MUST be one of the
350
+ * values in the array in order for the schema to be valid.
351
+ *
352
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
353
+ */
354
+ enum?: number[] | undefined;
355
+ }
356
+ /**
357
+ * @see https://json-schema.org/understanding-json-schema/reference/boolean.html
358
+ */
359
+ export interface JSONSchema4BoleanSchema extends JSONSchema4Base {
360
+ type: 'boolean';
361
+ /**
362
+ * This provides an enumeration of all possible values that are valid
363
+ * for the instance property. This MUST be an array, and each item in
364
+ * the array represents a possible value for the instance value. If
365
+ * this attribute is defined, the instance value MUST be one of the
366
+ * values in the array in order for the schema to be valid.
367
+ *
368
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
369
+ */
370
+ enum?: boolean[] | undefined;
371
+ }
372
+ /**
373
+ * @see https://json-schema.org/understanding-json-schema/reference/null.html
374
+ */
375
+ export interface JSONSchema4NullSchema extends JSONSchema4Base {
376
+ type: 'null';
377
+ /**
378
+ * This provides an enumeration of all possible values that are valid
379
+ * for the instance property. This MUST be an array, and each item in
380
+ * the array represents a possible value for the instance value. If
381
+ * this attribute is defined, the instance value MUST be one of the
382
+ * values in the array in order for the schema to be valid.
383
+ *
384
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
385
+ */
386
+ enum?: null[] | undefined;
387
+ }
388
+ export interface JSONSchema4AnySchema extends JSONSchema4Base {
389
+ type: 'any';
390
+ }
391
+ export {};
392
+ //# sourceMappingURL=json-schema.d.ts.map
@@ -18,7 +18,7 @@ declare namespace CLIEngine {
18
18
  globals?: string[];
19
19
  ignore?: boolean;
20
20
  ignorePath?: string;
21
- ignorePattern?: string | string[];
21
+ ignorePattern?: string[] | string;
22
22
  useEslintrc?: boolean;
23
23
  parser?: string;
24
24
  parserOptions?: Linter.ParserOptions;