xo 0.46.1 → 0.47.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 (106) hide show
  1. package/config/plugins.cjs +2 -7
  2. package/index.js +12 -11
  3. package/lib/options-manager.js +108 -86
  4. package/node_modules/@typescript-eslint/eslint-plugin/README.md +2 -2
  5. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-member-accessibility.js +3 -0
  6. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-member-accessibility.js.map +1 -1
  7. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-module-boundary-types.js +4 -2
  8. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-module-boundary-types.js.map +1 -1
  9. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-base-to-string.js +2 -1
  10. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-base-to-string.js.map +1 -1
  11. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-confusing-non-null-assertion.js.map +1 -1
  12. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-floating-promises.js +5 -1
  13. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-floating-promises.js.map +1 -1
  14. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-implied-eval.js +10 -1
  15. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-implied-eval.js.map +1 -1
  16. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js +24 -1
  17. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js.map +1 -1
  18. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-for-of.js.map +1 -1
  19. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-string-starts-ends-with.js.map +1 -1
  20. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/restrict-plus-operands.js.map +1 -1
  21. package/node_modules/@typescript-eslint/eslint-plugin/dist/util/collectUnusedVariables.js +5 -24
  22. package/node_modules/@typescript-eslint/eslint-plugin/dist/util/collectUnusedVariables.js.map +1 -1
  23. package/node_modules/@typescript-eslint/eslint-plugin/dist/util/isTypeReadonly.js +6 -4
  24. package/node_modules/@typescript-eslint/eslint-plugin/dist/util/isTypeReadonly.js.map +1 -1
  25. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/README.md +159 -0
  26. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-dangle.md +1 -1
  27. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-indexed-object-style.md +5 -2
  28. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-definitions.md +1 -1
  29. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-module-boundary-types.md +0 -2
  30. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-delimiter-style.md +29 -26
  31. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-inferrable-types.md +2 -2
  32. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/object-curly-spacing.md +1 -1
  33. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/padding-line-between-statements.md +3 -1
  34. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md +2 -2
  35. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/require-array-sort-compare.md +5 -1
  36. package/node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore/index.js +13 -16
  37. package/node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore/legacy.js +12 -15
  38. package/node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore/package.json +6 -5
  39. package/node_modules/@typescript-eslint/eslint-plugin/package.json +4 -4
  40. package/node_modules/@typescript-eslint/experimental-utils/dist/ast-utils/helpers.d.ts +6 -1
  41. package/node_modules/@typescript-eslint/experimental-utils/dist/ast-utils/helpers.d.ts.map +1 -1
  42. package/node_modules/@typescript-eslint/experimental-utils/dist/ast-utils/helpers.js +7 -1
  43. package/node_modules/@typescript-eslint/experimental-utils/dist/ast-utils/helpers.js.map +1 -1
  44. package/node_modules/@typescript-eslint/experimental-utils/dist/ast-utils/predicates.d.ts +25 -19
  45. package/node_modules/@typescript-eslint/experimental-utils/dist/ast-utils/predicates.d.ts.map +1 -1
  46. package/node_modules/@typescript-eslint/experimental-utils/dist/ast-utils/predicates.js +5 -9
  47. package/node_modules/@typescript-eslint/experimental-utils/dist/ast-utils/predicates.js.map +1 -1
  48. package/node_modules/@typescript-eslint/experimental-utils/dist/eslint-utils/RuleCreator.d.ts +30 -8
  49. package/node_modules/@typescript-eslint/experimental-utils/dist/eslint-utils/RuleCreator.d.ts.map +1 -1
  50. package/node_modules/@typescript-eslint/experimental-utils/dist/eslint-utils/RuleCreator.js +36 -8
  51. package/node_modules/@typescript-eslint/experimental-utils/dist/eslint-utils/RuleCreator.js.map +1 -1
  52. package/node_modules/@typescript-eslint/experimental-utils/dist/ts-eslint/Rule.d.ts +2 -2
  53. package/node_modules/@typescript-eslint/experimental-utils/dist/ts-eslint/Rule.d.ts.map +1 -1
  54. package/node_modules/@typescript-eslint/experimental-utils/dist/ts-eslint/RuleTester.d.ts +4 -0
  55. package/node_modules/@typescript-eslint/experimental-utils/dist/ts-eslint/RuleTester.d.ts.map +1 -1
  56. package/node_modules/@typescript-eslint/experimental-utils/dist/ts-eslint/RuleTester.js.map +1 -1
  57. package/node_modules/@typescript-eslint/experimental-utils/package.json +5 -5
  58. package/node_modules/@typescript-eslint/parser/package.json +6 -6
  59. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/PatternVisitor.d.ts +1 -1
  60. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/PatternVisitor.d.ts.map +1 -1
  61. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/PatternVisitor.js +2 -2
  62. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/PatternVisitor.js.map +1 -1
  63. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.d.ts +1 -0
  64. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.d.ts.map +1 -1
  65. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.js +3 -0
  66. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.js.map +1 -1
  67. package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
  68. package/node_modules/@typescript-eslint/types/dist/ast-spec.d.ts +21 -7
  69. package/node_modules/@typescript-eslint/types/dist/ast-spec.d.ts.map +1 -1
  70. package/node_modules/@typescript-eslint/types/dist/ast-spec.js +1 -0
  71. package/node_modules/@typescript-eslint/types/dist/ast-spec.js.map +1 -1
  72. package/node_modules/@typescript-eslint/types/package.json +2 -2
  73. package/node_modules/@typescript-eslint/typescript-estree/dist/convert.d.ts +1 -0
  74. package/node_modules/@typescript-eslint/typescript-estree/dist/convert.d.ts.map +1 -1
  75. package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js +23 -2
  76. package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js.map +1 -1
  77. package/node_modules/@typescript-eslint/typescript-estree/dist/parser.js +2 -2
  78. package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/estree-to-ts-node-types.d.ts +1 -0
  79. package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/estree-to-ts-node-types.d.ts.map +1 -1
  80. package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/ts-nodes.d.ts +1 -1
  81. package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/ts-nodes.d.ts.map +1 -1
  82. package/node_modules/@typescript-eslint/typescript-estree/node_modules/ignore/index.js +13 -16
  83. package/node_modules/@typescript-eslint/typescript-estree/node_modules/ignore/legacy.js +12 -15
  84. package/node_modules/@typescript-eslint/typescript-estree/node_modules/ignore/package.json +6 -5
  85. package/node_modules/@typescript-eslint/typescript-estree/package.json +6 -6
  86. package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.d.ts.map +1 -1
  87. package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js +2 -0
  88. package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js.map +1 -1
  89. package/node_modules/@typescript-eslint/visitor-keys/package.json +3 -3
  90. package/node_modules/eslint-config-xo-typescript/index.js +1 -1
  91. package/node_modules/eslint-config-xo-typescript/package.json +1 -1
  92. package/node_modules/eslint-visitor-keys/README.md +3 -2
  93. package/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs +3 -0
  94. package/node_modules/eslint-visitor-keys/lib/visitor-keys.js +3 -0
  95. package/node_modules/eslint-visitor-keys/package.json +2 -2
  96. package/package.json +16 -16
  97. package/node_modules/@typescript-eslint/eslint-plugin/CHANGELOG.md +0 -2277
  98. package/node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore/CHANGELOG.md +0 -32
  99. package/node_modules/@typescript-eslint/experimental-utils/CHANGELOG.md +0 -1253
  100. package/node_modules/@typescript-eslint/parser/CHANGELOG.md +0 -1283
  101. package/node_modules/@typescript-eslint/scope-manager/CHANGELOG.md +0 -673
  102. package/node_modules/@typescript-eslint/types/CHANGELOG.md +0 -653
  103. package/node_modules/@typescript-eslint/typescript-estree/CHANGELOG.md +0 -1484
  104. package/node_modules/@typescript-eslint/typescript-estree/node_modules/ignore/CHANGELOG.md +0 -32
  105. package/node_modules/@typescript-eslint/visitor-keys/CHANGELOG.md +0 -622
  106. package/node_modules/eslint-visitor-keys/CHANGELOG.md +0 -42
@@ -9,7 +9,7 @@ See the [ESLint documentation](https://eslint.org/docs/rules/comma-dangle) for m
9
9
 
10
10
  ## Rule Changes
11
11
 
12
- ```cjson
12
+ ```jsonc
13
13
  {
14
14
  // note you must disable the base rule as it can report incorrect errors
15
15
  "comma-dangle": "off",
@@ -20,9 +20,12 @@ type Foo = Record<string, unknown>;
20
20
 
21
21
  For example:
22
22
 
23
- ```CJSON
23
+ ```json
24
24
  {
25
- "@typescript-eslint/consistent-indexed-object-style": ["error", "index-signature"]
25
+ "@typescript-eslint/consistent-indexed-object-style": [
26
+ "error",
27
+ "index-signature"
28
+ ]
26
29
  }
27
30
  ```
28
31
 
@@ -59,7 +59,7 @@ interface T {
59
59
  }
60
60
  ```
61
61
 
62
- Examples of **correct** code with `interface` option.
62
+ Examples of **correct** code with `type` option.
63
63
 
64
64
  ```ts
65
65
  type T = { x: number };
@@ -2,8 +2,6 @@
2
2
 
3
3
  Explicit types for function return values and arguments makes it clear to any calling code what is the module boundary's input and output.
4
4
 
5
- Consider using this rule in place of [`no-untyped-public-signature`](./no-untyped-public-signature.md) which has been deprecated.
6
-
7
5
  ## Rule Details
8
6
 
9
7
  This rule aims to ensure that the values returned from a module are of the expected type.
@@ -78,17 +78,17 @@ type Config = BaseConfig & {
78
78
 
79
79
  Default config:
80
80
 
81
- ```JSON
81
+ ```json
82
82
  {
83
- "multiline": {
84
- "delimiter": "semi",
85
- "requireLast": true
86
- },
87
- "singleline": {
88
- "delimiter": "semi",
89
- "requireLast": false
90
- },
91
- "multilineDetection": "brackets"
83
+ "multiline": {
84
+ "delimiter": "semi",
85
+ "requireLast": true
86
+ },
87
+ "singleline": {
88
+ "delimiter": "semi",
89
+ "requireLast": false
90
+ },
91
+ "multilineDetection": "brackets"
92
92
  }
93
93
  ```
94
94
 
@@ -108,7 +108,10 @@ Accepts three values (or two for `singleline`):
108
108
  - `comma` - each member should be delimited with a comma (`,`).
109
109
  - `semi` - each member should be delimited with a semicolon (`;`).
110
110
  - `none` - each member should be delimited with nothing.
111
- - NOTE - this is not an option for `singleline` because having no delimiter between members on a single line is a syntax error in TS.
111
+
112
+ :::note
113
+ `none` is not an option for `singleline` because having no delimiter between members on a single line is a syntax error in TS.
114
+ :::
112
115
 
113
116
  ### `requireLast`
114
117
 
@@ -123,24 +126,24 @@ Allows you to specify options specifically for either `interface`s or `type` def
123
126
 
124
127
  For example, to require commas for `type`s, and semicolons for multiline `interface`s:
125
128
 
126
- ```JSON
129
+ ```json
127
130
  {
128
- "multiline": {
129
- "delimiter": "comma",
130
- "requireLast": true
131
- },
132
- "singleline": {
133
- "delimiter": "comma",
131
+ "multiline": {
132
+ "delimiter": "comma",
133
+ "requireLast": true
134
+ },
135
+ "singleline": {
136
+ "delimiter": "comma",
137
+ "requireLast": true
138
+ },
139
+ "overrides": {
140
+ "interface": {
141
+ "multiline": {
142
+ "delimiter": "semi",
134
143
  "requireLast": true
135
- },
136
- "overrides": {
137
- "interface": {
138
- "multiline": {
139
- "delimiter": "semi",
140
- "requireLast": true
141
- }
142
- }
144
+ }
143
145
  }
146
+ }
144
147
  }
145
148
  ```
146
149
 
@@ -22,10 +22,10 @@ interface Options {
22
22
 
23
23
  The default options are:
24
24
 
25
- ```JSON
25
+ ```json
26
26
  {
27
27
  "ignoreParameters": false,
28
- "ignoreProperties": false,
28
+ "ignoreProperties": false
29
29
  }
30
30
  ```
31
31
 
@@ -7,7 +7,7 @@ It adds support for TypeScript's object types.
7
7
 
8
8
  ## How to use
9
9
 
10
- ```cjson
10
+ ```jsonc
11
11
  {
12
12
  // note you must disable the base rule as it can report incorrect errors
13
13
  "object-curly-spacing": "off",
@@ -43,7 +43,9 @@ This rule extends the base [`eslint/padding-line-between-statements`](https://es
43
43
 
44
44
  See [`eslint/padding-line-between-statements` options](https://eslint.org/docs/rules/padding-line-between-statements#options).
45
45
 
46
- **Note** - In addition to options provided by ESLint, we have also added options for `interface` and `type`.
46
+ In addition to options provided by ESLint, `interface` and `type` can be used as statement types.
47
+
48
+ **Note:** ESLint `cjs-export` and `cjs-import` statement types are renamed to `exports` and `require` respectively.
47
49
 
48
50
  <sup>Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/padding-line-between-statements.md)</sup>
49
51
 
@@ -43,9 +43,9 @@ foo.endsWith('bar');
43
43
 
44
44
  There are no options.
45
45
 
46
- ```JSON
46
+ ```json
47
47
  {
48
- "@typescript-eslint/prefer-string-starts-ends-with": "error"
48
+ "@typescript-eslint/prefer-string-starts-ends-with": "error"
49
49
  }
50
50
  ```
51
51
 
@@ -13,7 +13,11 @@ When sorting numbers, this results in the classic "10 before 2" order:
13
13
 
14
14
  This also means that `Array#sort` does not always sort consistently, as elements may have custom `#toString` implementations that are not deterministic; this trap is noted in the language specification thusly:
15
15
 
16
- > NOTE 2: Method calls performed by the `ToString` abstract operations in steps 5 and 7 have the potential to cause `SortCompare` to not behave as a consistent comparison function.<br> > https://www.ecma-international.org/ecma-262/9.0/#sec-sortcompare
16
+ :::note
17
+ Method calls performed by the `ToString` abstract operations in steps 5 and 7 have the potential to cause `SortCompare` to not behave as a consistent comparison function.
18
+
19
+ https://www.ecma-international.org/ecma-262/9.0/#sec-sortcompare
20
+ :::
17
21
 
18
22
  ## Rule Details
19
23
 
@@ -288,22 +288,18 @@ const REPLACERS = [
288
288
  const regexCache = Object.create(null)
289
289
 
290
290
  // @param {pattern}
291
- const makeRegex = (pattern, negative, ignorecase) => {
292
- const r = regexCache[pattern]
293
- if (r) {
294
- return r
295
- }
296
-
297
- // const replacers = negative
298
- // ? NEGATIVE_REPLACERS
299
- // : POSITIVE_REPLACERS
291
+ const makeRegex = (pattern, ignorecase) => {
292
+ let source = regexCache[pattern]
300
293
 
301
- const source = REPLACERS.reduce(
302
- (prev, current) => prev.replace(current[0], current[1].bind(pattern)),
303
- pattern
304
- )
294
+ if (!source) {
295
+ source = REPLACERS.reduce(
296
+ (prev, current) => prev.replace(current[0], current[1].bind(pattern)),
297
+ pattern
298
+ )
299
+ regexCache[pattern] = source
300
+ }
305
301
 
306
- return regexCache[pattern] = ignorecase
302
+ return ignorecase
307
303
  ? new RegExp(source, 'i')
308
304
  : new RegExp(source)
309
305
  }
@@ -352,7 +348,7 @@ const createRule = (pattern, ignorecase) => {
352
348
  // > begin with a hash.
353
349
  .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#')
354
350
 
355
- const regex = makeRegex(pattern, negative, ignorecase)
351
+ const regex = makeRegex(pattern, ignorecase)
356
352
 
357
353
  return new IgnoreRule(
358
354
  origin,
@@ -400,9 +396,10 @@ class Ignore {
400
396
  constructor ({
401
397
  ignorecase = true
402
398
  } = {}) {
399
+ define(this, KEY_IGNORE, true)
400
+
403
401
  this._rules = []
404
402
  this._ignorecase = ignorecase
405
- define(this, KEY_IGNORE, true)
406
403
  this._initCache()
407
404
  }
408
405
 
@@ -205,20 +205,17 @@ function (match) {
205
205
 
206
206
  var regexCache = Object.create(null); // @param {pattern}
207
207
 
208
- var makeRegex = function makeRegex(pattern, negative, ignorecase) {
209
- var r = regexCache[pattern];
210
-
211
- if (r) {
212
- return r;
213
- } // const replacers = negative
214
- // ? NEGATIVE_REPLACERS
215
- // : POSITIVE_REPLACERS
216
-
208
+ var makeRegex = function makeRegex(pattern, ignorecase) {
209
+ var source = regexCache[pattern];
210
+
211
+ if (!source) {
212
+ source = REPLACERS.reduce(function (prev, current) {
213
+ return prev.replace(current[0], current[1].bind(pattern));
214
+ }, pattern);
215
+ regexCache[pattern] = source;
216
+ }
217
217
 
218
- var source = REPLACERS.reduce(function (prev, current) {
219
- return prev.replace(current[0], current[1].bind(pattern));
220
- }, pattern);
221
- return regexCache[pattern] = ignorecase ? new RegExp(source, 'i') : new RegExp(source);
218
+ return ignorecase ? new RegExp(source, 'i') : new RegExp(source);
222
219
  };
223
220
 
224
221
  var isString = function isString(subject) {
@@ -258,7 +255,7 @@ var createRule = function createRule(pattern, ignorecase) {
258
255
  .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!') // > Put a backslash ("\") in front of the first hash for patterns that
259
256
  // > begin with a hash.
260
257
  .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#');
261
- var regex = makeRegex(pattern, negative, ignorecase);
258
+ var regex = makeRegex(pattern, ignorecase);
262
259
  return new IgnoreRule(origin, pattern, negative, regex);
263
260
  };
264
261
 
@@ -303,9 +300,9 @@ var Ignore = /*#__PURE__*/function () {
303
300
 
304
301
  _classCallCheck(this, Ignore);
305
302
 
303
+ define(this, KEY_IGNORE, true);
306
304
  this._rules = [];
307
305
  this._ignorecase = ignorecase;
308
- define(this, KEY_IGNORE, true);
309
306
 
310
307
  this._initCache();
311
308
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ignore",
3
- "version": "5.1.8",
3
+ "version": "5.1.9",
4
4
  "description": "Ignore is a manager and filter for .gitignore rules, the one used by eslint, gitbook and many others.",
5
5
  "files": [
6
6
  "legacy.js",
@@ -14,10 +14,11 @@
14
14
  "test:lint": "eslint .",
15
15
  "test:tsc": "tsc ./test/ts/simple.ts --lib ES6",
16
16
  "test:ts": "node ./test/ts/simple.js",
17
- "test:git": "tap test/git-check-ignore.js",
18
- "test:ignore": "tap test/ignore.js",
19
- "test:others": "tap test/others.js",
20
- "test:cases": "tap test/*.js --coverage",
17
+ "tap": "tap --reporter classic",
18
+ "test:git": "npm run tap test/git-check-ignore.js",
19
+ "test:ignore": "npm run tap test/ignore.js",
20
+ "test:others": "npm run tap test/others.js",
21
+ "test:cases": "npm run tap test/*.js -- --coverage",
21
22
  "test:only": "npm run test:lint && npm run test:tsc && npm run test:ts && npm run test:cases",
22
23
  "test": "npm run test:only",
23
24
  "test:win32": "IGNORE_TEST_WIN32=1 npm run test",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typescript-eslint/eslint-plugin",
3
- "version": "5.2.0",
3
+ "version": "5.4.0",
4
4
  "description": "TypeScript plugin for ESLint",
5
5
  "keywords": [
6
6
  "eslint",
@@ -44,8 +44,8 @@
44
44
  "typecheck": "tsc -p tsconfig.json --noEmit"
45
45
  },
46
46
  "dependencies": {
47
- "@typescript-eslint/experimental-utils": "5.2.0",
48
- "@typescript-eslint/scope-manager": "5.2.0",
47
+ "@typescript-eslint/experimental-utils": "5.4.0",
48
+ "@typescript-eslint/scope-manager": "5.4.0",
49
49
  "debug": "^4.3.2",
50
50
  "functional-red-black-tree": "^1.0.1",
51
51
  "ignore": "^5.1.8",
@@ -75,5 +75,5 @@
75
75
  "type": "opencollective",
76
76
  "url": "https://opencollective.com/typescript-eslint"
77
77
  },
78
- "gitHead": "9c8f9a89c098e0ebb7bebf88a4a0f07165275fa6"
78
+ "gitHead": "0060a74413a3efb7872a3c8e2f4d45a733f3d149"
79
79
  }
@@ -1,4 +1,4 @@
1
- import { AST_NODE_TYPES, TSESTree } from '../ts-estree';
1
+ import { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree } from '../ts-estree';
2
2
  export declare const isNodeOfType: <NodeType extends AST_NODE_TYPES>(nodeType: NodeType) => (node: TSESTree.Node | null | undefined) => node is TSESTree.Node & {
3
3
  type: NodeType;
4
4
  };
@@ -10,4 +10,9 @@ export declare const isNodeOfTypeWithConditions: <NodeType extends AST_NODE_TYPE
10
10
  }>>(nodeType: NodeType, conditions: Conditions) => (node: TSESTree.Node | null | undefined) => node is TSESTree.Node & {
11
11
  type: NodeType;
12
12
  } & Conditions;
13
+ export declare const isTokenOfTypeWithConditions: <TokenType extends AST_TOKEN_TYPES, Conditions extends Partial<TSESTree.Token & {
14
+ type: TokenType;
15
+ }>>(tokenType: TokenType, conditions: Conditions) => (token: TSESTree.Token | null | undefined) => token is TSESTree.Token & {
16
+ type: TokenType;
17
+ } & Conditions;
13
18
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/ast-utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExD,eAAO,MAAM,YAAY,kEAGf,SAAS,IAAI,GAAG,IAAI,GAAG,SAAS;;CAEf,CAAC;AAE5B,eAAO,MAAM,aAAa,gFAGhB,SAAS,IAAI,GAAG,IAAI,GAAG,SAAS;;CAEC,CAAC;AAI5C,eAAO,MAAM,0BAA0B;;0DAO/B,SAAS,IAAI,GAAG,IAAI,GAAG,SAAS;;cAWvC,CAAC"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/ast-utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKzE,eAAO,MAAM,YAAY,kEAGf,SAAS,IAAI,GAAG,IAAI,GAAG,SAAS;;CAEf,CAAC;AAE5B,eAAO,MAAM,aAAa,gFAGhB,SAAS,IAAI,GAAG,IAAI,GAAG,SAAS;;CAEC,CAAC;AAE5C,eAAO,MAAM,0BAA0B;;0DAO/B,SAAS,IAAI,GAAG,IAAI,GAAG,SAAS;;cAWvC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;6DAO/B,SAAS,KAAK,GAAG,IAAI,GAAG,SAAS;;cAWzC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isNodeOfTypeWithConditions = exports.isNodeOfTypes = exports.isNodeOfType = void 0;
3
+ exports.isTokenOfTypeWithConditions = exports.isNodeOfTypeWithConditions = exports.isNodeOfTypes = exports.isNodeOfType = void 0;
4
4
  const isNodeOfType = (nodeType) => (node) => (node === null || node === void 0 ? void 0 : node.type) === nodeType;
5
5
  exports.isNodeOfType = isNodeOfType;
6
6
  const isNodeOfTypes = (nodeTypes) => (node) => !!node && nodeTypes.includes(node.type);
@@ -11,4 +11,10 @@ const isNodeOfTypeWithConditions = (nodeType, conditions) => {
11
11
  entries.every(([key, value]) => node[key] === value);
12
12
  };
13
13
  exports.isNodeOfTypeWithConditions = isNodeOfTypeWithConditions;
14
+ const isTokenOfTypeWithConditions = (tokenType, conditions) => {
15
+ const entries = Object.entries(conditions);
16
+ return (token) => (token === null || token === void 0 ? void 0 : token.type) === tokenType &&
17
+ entries.every(([key, value]) => token[key] === value);
18
+ };
19
+ exports.isTokenOfTypeWithConditions = isTokenOfTypeWithConditions;
14
20
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/ast-utils/helpers.ts"],"names":[],"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C;AAL/B,QAAA,aAAa,iBAKkB;AAErC,MAAM,0BAA0B,GAAG,CAIxC,QAAkB,EAClB,UAAsB,EAGsC,EAAE;IAC9D,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAExC,CAAC;IAEF,OAAO,CACL,IAAsC,EACmB,EAAE,CAC3D,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,MAAK,QAAQ;QACvB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC;AACzD,CAAC,CAAC;AAlBW,QAAA,0BAA0B,8BAkBrC;AAEK,MAAM,2BAA2B,GAAG,CAIzC,SAAoB,EACpB,UAAsB,EAGyC,EAAE;IACjE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAExC,CAAC;IAEF,OAAO,CACL,KAAwC,EACoB,EAAE,CAC9D,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,SAAS;QACzB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC;AAC1D,CAAC,CAAC;AAlBW,QAAA,2BAA2B,+BAkBtC"}
@@ -1,12 +1,16 @@
1
- import { AST_NODE_TYPES, TSESTree } from '../ts-estree';
2
- declare function isOptionalChainPunctuator(token: TSESTree.Token): token is TSESTree.PunctuatorToken & {
3
- value: '?.';
1
+ import { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree } from '../ts-estree';
2
+ declare const isOptionalChainPunctuator: (token: TSESTree.Token | null | undefined) => token is TSESTree.PunctuatorToken & {
3
+ type: AST_TOKEN_TYPES.Punctuator;
4
+ } & {
5
+ value: "?.";
4
6
  };
5
7
  declare function isNotOptionalChainPunctuator(token: TSESTree.Token): token is Exclude<TSESTree.Token, TSESTree.PunctuatorToken & {
6
8
  value: '?.';
7
9
  }>;
8
- declare function isNonNullAssertionPunctuator(token: TSESTree.Token): token is TSESTree.PunctuatorToken & {
9
- value: '!';
10
+ declare const isNonNullAssertionPunctuator: (token: TSESTree.Token | null | undefined) => token is TSESTree.PunctuatorToken & {
11
+ type: AST_TOKEN_TYPES.Punctuator;
12
+ } & {
13
+ value: "!";
10
14
  };
11
15
  declare function isNotNonNullAssertionPunctuator(token: TSESTree.Token): token is Exclude<TSESTree.Token, TSESTree.PunctuatorToken & {
12
16
  value: '!';
@@ -44,19 +48,19 @@ declare const isVariableDeclarator: (node: TSESTree.Node | null | undefined) =>
44
48
  };
45
49
  declare const isFunction: (node: TSESTree.Node | null | undefined) => node is (TSESTree.ArrowFunctionExpression & {
46
50
  type: AST_NODE_TYPES.ArrowFunctionExpression | AST_NODE_TYPES.FunctionDeclaration | AST_NODE_TYPES.FunctionExpression;
47
- }) | (TSESTree.FunctionExpression & {
48
- type: AST_NODE_TYPES.ArrowFunctionExpression | AST_NODE_TYPES.FunctionDeclaration | AST_NODE_TYPES.FunctionExpression;
49
51
  }) | (TSESTree.FunctionDeclaration & {
50
52
  type: AST_NODE_TYPES.ArrowFunctionExpression | AST_NODE_TYPES.FunctionDeclaration | AST_NODE_TYPES.FunctionExpression;
53
+ }) | (TSESTree.FunctionExpression & {
54
+ type: AST_NODE_TYPES.ArrowFunctionExpression | AST_NODE_TYPES.FunctionDeclaration | AST_NODE_TYPES.FunctionExpression;
51
55
  });
52
- declare const isFunctionType: (node: TSESTree.Node | null | undefined) => node is (TSESTree.TSEmptyBodyFunctionExpression & {
53
- type: AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructorType | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSFunctionType | AST_NODE_TYPES.TSMethodSignature;
54
- }) | (TSESTree.TSCallSignatureDeclaration & {
56
+ declare const isFunctionType: (node: TSESTree.Node | null | undefined) => node is (TSESTree.TSCallSignatureDeclaration & {
55
57
  type: AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructorType | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSFunctionType | AST_NODE_TYPES.TSMethodSignature;
56
58
  }) | (TSESTree.TSConstructorType & {
57
59
  type: AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructorType | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSFunctionType | AST_NODE_TYPES.TSMethodSignature;
58
60
  }) | (TSESTree.TSConstructSignatureDeclaration & {
59
61
  type: AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructorType | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSFunctionType | AST_NODE_TYPES.TSMethodSignature;
62
+ }) | (TSESTree.TSEmptyBodyFunctionExpression & {
63
+ type: AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructorType | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSFunctionType | AST_NODE_TYPES.TSMethodSignature;
60
64
  }) | (TSESTree.TSFunctionType & {
61
65
  type: AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructorType | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSFunctionType | AST_NODE_TYPES.TSMethodSignature;
62
66
  }) | (TSESTree.TSMethodSignatureComputedName & {
@@ -66,11 +70,9 @@ declare const isFunctionType: (node: TSESTree.Node | null | undefined) => node i
66
70
  });
67
71
  declare const isFunctionOrFunctionType: (node: TSESTree.Node | null | undefined) => node is (TSESTree.ArrowFunctionExpression & {
68
72
  type: AST_NODE_TYPES.ArrowFunctionExpression | AST_NODE_TYPES.FunctionDeclaration | AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructorType | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSFunctionType | AST_NODE_TYPES.TSMethodSignature;
69
- }) | (TSESTree.FunctionExpression & {
70
- type: AST_NODE_TYPES.ArrowFunctionExpression | AST_NODE_TYPES.FunctionDeclaration | AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructorType | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSFunctionType | AST_NODE_TYPES.TSMethodSignature;
71
73
  }) | (TSESTree.FunctionDeclaration & {
72
74
  type: AST_NODE_TYPES.ArrowFunctionExpression | AST_NODE_TYPES.FunctionDeclaration | AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructorType | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSFunctionType | AST_NODE_TYPES.TSMethodSignature;
73
- }) | (TSESTree.TSEmptyBodyFunctionExpression & {
75
+ }) | (TSESTree.FunctionExpression & {
74
76
  type: AST_NODE_TYPES.ArrowFunctionExpression | AST_NODE_TYPES.FunctionDeclaration | AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructorType | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSFunctionType | AST_NODE_TYPES.TSMethodSignature;
75
77
  }) | (TSESTree.TSCallSignatureDeclaration & {
76
78
  type: AST_NODE_TYPES.ArrowFunctionExpression | AST_NODE_TYPES.FunctionDeclaration | AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructorType | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSFunctionType | AST_NODE_TYPES.TSMethodSignature;
@@ -78,6 +80,8 @@ declare const isFunctionOrFunctionType: (node: TSESTree.Node | null | undefined)
78
80
  type: AST_NODE_TYPES.ArrowFunctionExpression | AST_NODE_TYPES.FunctionDeclaration | AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructorType | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSFunctionType | AST_NODE_TYPES.TSMethodSignature;
79
81
  }) | (TSESTree.TSConstructSignatureDeclaration & {
80
82
  type: AST_NODE_TYPES.ArrowFunctionExpression | AST_NODE_TYPES.FunctionDeclaration | AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructorType | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSFunctionType | AST_NODE_TYPES.TSMethodSignature;
83
+ }) | (TSESTree.TSEmptyBodyFunctionExpression & {
84
+ type: AST_NODE_TYPES.ArrowFunctionExpression | AST_NODE_TYPES.FunctionDeclaration | AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructorType | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSFunctionType | AST_NODE_TYPES.TSMethodSignature;
81
85
  }) | (TSESTree.TSFunctionType & {
82
86
  type: AST_NODE_TYPES.ArrowFunctionExpression | AST_NODE_TYPES.FunctionDeclaration | AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructorType | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSFunctionType | AST_NODE_TYPES.TSMethodSignature;
83
87
  }) | (TSESTree.TSMethodSignatureComputedName & {
@@ -109,14 +113,14 @@ declare const isClassOrTypeElement: (node: TSESTree.Node | null | undefined) =>
109
113
  type: AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.MethodDefinition | AST_NODE_TYPES.PropertyDefinition | AST_NODE_TYPES.TSAbstractMethodDefinition | AST_NODE_TYPES.TSAbstractPropertyDefinition | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSIndexSignature | AST_NODE_TYPES.TSMethodSignature | AST_NODE_TYPES.TSPropertySignature;
110
114
  }) | (TSESTree.TSAbstractPropertyDefinitionNonComputedName & {
111
115
  type: AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.MethodDefinition | AST_NODE_TYPES.PropertyDefinition | AST_NODE_TYPES.TSAbstractMethodDefinition | AST_NODE_TYPES.TSAbstractPropertyDefinition | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSIndexSignature | AST_NODE_TYPES.TSMethodSignature | AST_NODE_TYPES.TSPropertySignature;
112
- }) | (TSESTree.TSIndexSignature & {
113
- type: AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.MethodDefinition | AST_NODE_TYPES.PropertyDefinition | AST_NODE_TYPES.TSAbstractMethodDefinition | AST_NODE_TYPES.TSAbstractPropertyDefinition | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSIndexSignature | AST_NODE_TYPES.TSMethodSignature | AST_NODE_TYPES.TSPropertySignature;
114
- }) | (TSESTree.TSEmptyBodyFunctionExpression & {
115
- type: AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.MethodDefinition | AST_NODE_TYPES.PropertyDefinition | AST_NODE_TYPES.TSAbstractMethodDefinition | AST_NODE_TYPES.TSAbstractPropertyDefinition | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSIndexSignature | AST_NODE_TYPES.TSMethodSignature | AST_NODE_TYPES.TSPropertySignature;
116
116
  }) | (TSESTree.TSCallSignatureDeclaration & {
117
117
  type: AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.MethodDefinition | AST_NODE_TYPES.PropertyDefinition | AST_NODE_TYPES.TSAbstractMethodDefinition | AST_NODE_TYPES.TSAbstractPropertyDefinition | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSIndexSignature | AST_NODE_TYPES.TSMethodSignature | AST_NODE_TYPES.TSPropertySignature;
118
118
  }) | (TSESTree.TSConstructSignatureDeclaration & {
119
119
  type: AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.MethodDefinition | AST_NODE_TYPES.PropertyDefinition | AST_NODE_TYPES.TSAbstractMethodDefinition | AST_NODE_TYPES.TSAbstractPropertyDefinition | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSIndexSignature | AST_NODE_TYPES.TSMethodSignature | AST_NODE_TYPES.TSPropertySignature;
120
+ }) | (TSESTree.TSEmptyBodyFunctionExpression & {
121
+ type: AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.MethodDefinition | AST_NODE_TYPES.PropertyDefinition | AST_NODE_TYPES.TSAbstractMethodDefinition | AST_NODE_TYPES.TSAbstractPropertyDefinition | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSIndexSignature | AST_NODE_TYPES.TSMethodSignature | AST_NODE_TYPES.TSPropertySignature;
122
+ }) | (TSESTree.TSIndexSignature & {
123
+ type: AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.MethodDefinition | AST_NODE_TYPES.PropertyDefinition | AST_NODE_TYPES.TSAbstractMethodDefinition | AST_NODE_TYPES.TSAbstractPropertyDefinition | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSIndexSignature | AST_NODE_TYPES.TSMethodSignature | AST_NODE_TYPES.TSPropertySignature;
120
124
  }) | (TSESTree.TSMethodSignatureComputedName & {
121
125
  type: AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.MethodDefinition | AST_NODE_TYPES.PropertyDefinition | AST_NODE_TYPES.TSAbstractMethodDefinition | AST_NODE_TYPES.TSAbstractPropertyDefinition | AST_NODE_TYPES.TSCallSignatureDeclaration | AST_NODE_TYPES.TSConstructSignatureDeclaration | AST_NODE_TYPES.TSEmptyBodyFunctionExpression | AST_NODE_TYPES.TSIndexSignature | AST_NODE_TYPES.TSMethodSignature | AST_NODE_TYPES.TSPropertySignature;
122
126
  }) | (TSESTree.TSMethodSignatureNonComputedName & {
@@ -156,8 +160,10 @@ declare const isAwaitExpression: (node: TSESTree.Node | null | undefined) => nod
156
160
  /**
157
161
  * Checks if a possible token is the `await` keyword.
158
162
  */
159
- declare function isAwaitKeyword(node: TSESTree.Token | undefined | null): node is TSESTree.IdentifierToken & {
160
- value: 'await';
163
+ declare const isAwaitKeyword: (token: TSESTree.Token | null | undefined) => token is TSESTree.IdentifierToken & {
164
+ type: AST_TOKEN_TYPES.Identifier;
165
+ } & {
166
+ value: "await";
161
167
  };
162
168
  declare const isLoop: (node: TSESTree.Node | null | undefined) => node is (TSESTree.DoWhileStatement & {
163
169
  type: AST_NODE_TYPES.DoWhileStatement | AST_NODE_TYPES.ForInStatement | AST_NODE_TYPES.ForOfStatement | AST_NODE_TYPES.ForStatement | AST_NODE_TYPES.WhileStatement;
@@ -1 +1 @@
1
- {"version":3,"file":"predicates.d.ts","sourceRoot":"","sources":["../../src/ast-utils/predicates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAmB,QAAQ,EAAE,MAAM,cAAc,CAAC;AAQzE,iBAAS,yBAAyB,CAChC,KAAK,EAAE,QAAQ,CAAC,KAAK,GACpB,KAAK,IAAI,QAAQ,CAAC,eAAe,GAAG;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,CAErD;AACD,iBAAS,4BAA4B,CACnC,KAAK,EAAE,QAAQ,CAAC,KAAK,GACpB,KAAK,IAAI,OAAO,CACjB,QAAQ,CAAC,KAAK,EACd,QAAQ,CAAC,eAAe,GAAG;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,CAC3C,CAEA;AAED,iBAAS,4BAA4B,CACnC,KAAK,EAAE,QAAQ,CAAC,KAAK,GACpB,KAAK,IAAI,QAAQ,CAAC,eAAe,GAAG;IAAE,KAAK,EAAE,GAAG,CAAA;CAAE,CAEpD;AACD,iBAAS,+BAA+B,CACtC,KAAK,EAAE,QAAQ,CAAC,KAAK,GACpB,KAAK,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,eAAe,GAAG;IAAE,KAAK,EAAE,GAAG,CAAA;CAAE,CAAC,CAE7E;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AiD,CAAC;AAE3E,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAef,CAAC;AAEZ;;GAEG;AACH,QAAA,MAAM,aAAa;;;;;;;;EAGlB,CAAC;AAEF;;GAEG;AACH,iBAAS,QAAQ,CACf,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,GAC9B,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAO3E;AAED,QAAA,MAAM,YAAY;;CAA0C,CAAC;AAE7D;;GAEG;AACH,QAAA,MAAM,iBAAiB;;CAA+C,CAAC;AAEvE;;GAEG;AACH,QAAA,MAAM,cAAc;;;;CAElB,CAAC;AAEH,QAAA,MAAM,MAAM;;;;;;;;;;EAMD,CAAC;AAEZ,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,UAAU,EACV,wBAAwB,EACxB,cAAc,EACd,YAAY,EACZ,MAAM,EACN,mBAAmB,EACnB,4BAA4B,EAC5B,+BAA+B,EAC/B,4BAA4B,EAC5B,yBAAyB,EACzB,wBAAwB,EACxB,QAAQ,EACR,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,GACrB,CAAC"}
@@ -3,17 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isVariableDeclarator = exports.isTypeAssertion = exports.isTSFunctionType = exports.isTSConstructorType = exports.isSetter = exports.isOptionalCallExpression = exports.isOptionalChainPunctuator = exports.isNotOptionalChainPunctuator = exports.isNotNonNullAssertionPunctuator = exports.isNonNullAssertionPunctuator = exports.isLogicalOrOperator = exports.isLoop = exports.isIdentifier = exports.isFunctionType = exports.isFunctionOrFunctionType = exports.isFunction = exports.isClassOrTypeElement = exports.isConstructor = exports.isAwaitKeyword = exports.isAwaitExpression = void 0;
4
4
  const ts_estree_1 = require("../ts-estree");
5
5
  const helpers_1 = require("./helpers");
6
- function isOptionalChainPunctuator(token) {
7
- return token.type === ts_estree_1.AST_TOKEN_TYPES.Punctuator && token.value === '?.';
8
- }
6
+ const isOptionalChainPunctuator = (0, helpers_1.isTokenOfTypeWithConditions)(ts_estree_1.AST_TOKEN_TYPES.Punctuator, { value: '?.' });
9
7
  exports.isOptionalChainPunctuator = isOptionalChainPunctuator;
10
8
  function isNotOptionalChainPunctuator(token) {
11
9
  return !isOptionalChainPunctuator(token);
12
10
  }
13
11
  exports.isNotOptionalChainPunctuator = isNotOptionalChainPunctuator;
14
- function isNonNullAssertionPunctuator(token) {
15
- return token.type === ts_estree_1.AST_TOKEN_TYPES.Punctuator && token.value === '!';
16
- }
12
+ const isNonNullAssertionPunctuator = (0, helpers_1.isTokenOfTypeWithConditions)(ts_estree_1.AST_TOKEN_TYPES.Punctuator, { value: '!' });
17
13
  exports.isNonNullAssertionPunctuator = isNonNullAssertionPunctuator;
18
14
  function isNotNonNullAssertionPunctuator(token) {
19
15
  return !isNonNullAssertionPunctuator(token);
@@ -114,9 +110,9 @@ exports.isAwaitExpression = isAwaitExpression;
114
110
  /**
115
111
  * Checks if a possible token is the `await` keyword.
116
112
  */
117
- function isAwaitKeyword(node) {
118
- return (node === null || node === void 0 ? void 0 : node.type) === ts_estree_1.AST_TOKEN_TYPES.Identifier && node.value === 'await';
119
- }
113
+ const isAwaitKeyword = (0, helpers_1.isTokenOfTypeWithConditions)(ts_estree_1.AST_TOKEN_TYPES.Identifier, {
114
+ value: 'await',
115
+ });
120
116
  exports.isAwaitKeyword = isAwaitKeyword;
121
117
  const isLoop = (0, helpers_1.isNodeOfTypes)([
122
118
  ts_estree_1.AST_NODE_TYPES.DoWhileStatement,
@@ -1 +1 @@
1
- {"version":3,"file":"predicates.js","sourceRoot":"","sources":["../../src/ast-utils/predicates.ts"],"names":[],"mappings":";;;AAAA,4CAAyE;AAEzE,uCAImB;AAEnB,SAAS,yBAAyB,CAChC,KAAqB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C;AAwCC,4BAAQ;AAtCV,MAAM,YAAY,GAAG,IAAA,sBAAY,EAAC,0BAAc,CAAC,UAAU,CAAC,CAAC;AA8B3D,oCAAY;AA5Bd;;GAEG;AACH,MAAM,iBAAiB,GAAG,IAAA,sBAAY,EAAC,0BAAc,CAAC,eAAe,CAAC,CAAC;AAkBrE,8CAAiB;AAhBnB;;GAEG;AACH,MAAM,cAAc,GAAG,IAAA,qCAA2B,EAAC,2BAAe,CAAC,UAAU,EAAE;IAC7E,KAAK,EAAE,OAAO;CACf,CAAC,CAAC;AAYD,wCAAc;AAVhB,MAAM,MAAM,GAAG,IAAA,uBAAa,EAAC;IAC3B,0BAAc,CAAC,gBAAgB;IAC/B,0BAAc,CAAC,YAAY;IAC3B,0BAAc,CAAC,cAAc;IAC7B,0BAAc,CAAC,cAAc;IAC7B,0BAAc,CAAC,cAAc;CACrB,CAAC,CAAC;AAWV,wBAAM"}
@@ -1,13 +1,35 @@
1
1
  import { RuleMetaData, RuleMetaDataDocs, RuleListener, RuleContext, RuleModule } from '../ts-eslint/Rule';
2
- declare type CreateRuleMetaDocs = Omit<RuleMetaDataDocs, 'url'>;
3
- declare type CreateRuleMeta<TMessageIds extends string> = {
4
- docs: CreateRuleMetaDocs;
2
+ declare type NamedCreateRuleMetaDocs = Omit<RuleMetaDataDocs, 'url'>;
3
+ declare type NamedCreateRuleMeta<TMessageIds extends string> = {
4
+ docs: NamedCreateRuleMetaDocs;
5
5
  } & Omit<RuleMetaData<TMessageIds>, 'docs'>;
6
- declare function RuleCreator(urlCreator: (ruleName: string) => string): <TOptions extends readonly unknown[], TMessageIds extends string, TRuleListener extends RuleListener = RuleListener>({ name, meta, defaultOptions, create, }: Readonly<{
7
- name: string;
8
- meta: CreateRuleMeta<TMessageIds>;
9
- defaultOptions: Readonly<TOptions>;
6
+ interface CreateAndOptions<TOptions extends readonly unknown[], TMessageIds extends string, TRuleListener extends RuleListener> {
10
7
  create: (context: Readonly<RuleContext<TMessageIds, TOptions>>, optionsWithDefault: Readonly<TOptions>) => TRuleListener;
11
- }>) => RuleModule<TMessageIds, TOptions, TRuleListener>;
8
+ defaultOptions: Readonly<TOptions>;
9
+ }
10
+ interface RuleWithMeta<TOptions extends readonly unknown[], TMessageIds extends string, TRuleListener extends RuleListener> extends CreateAndOptions<TOptions, TMessageIds, TRuleListener> {
11
+ meta: RuleMetaData<TMessageIds>;
12
+ }
13
+ interface RuleWithMetaAndName<TOptions extends readonly unknown[], TMessageIds extends string, TRuleListener extends RuleListener> extends CreateAndOptions<TOptions, TMessageIds, TRuleListener> {
14
+ meta: NamedCreateRuleMeta<TMessageIds>;
15
+ name: string;
16
+ }
17
+ /**
18
+ * Creates reusable function to create rules with default options and docs URLs.
19
+ *
20
+ * @param urlCreator Creates a documentation URL for a given rule name.
21
+ * @returns Function to create a rule with the docs URL format.
22
+ */
23
+ declare function RuleCreator(urlCreator: (ruleName: string) => string): <TOptions extends readonly unknown[], TMessageIds extends string, TRuleListener extends RuleListener = RuleListener>({ name, meta, ...rule }: Readonly<RuleWithMetaAndName<TOptions, TMessageIds, TRuleListener>>) => RuleModule<TMessageIds, TOptions, TRuleListener>;
24
+ declare namespace RuleCreator {
25
+ var withoutDocs: typeof createRule;
26
+ }
27
+ /**
28
+ * Creates a well-typed TSESLint custom ESLint rule without a docs URL.
29
+ *
30
+ * @returns Well-typed TSESLint custom ESLint rule.
31
+ * @remarks It is generally better to provide a docs URL function to RuleCreator.
32
+ */
33
+ declare function createRule<TOptions extends readonly unknown[], TMessageIds extends string, TRuleListener extends RuleListener = RuleListener>({ create, defaultOptions, meta, }: Readonly<RuleWithMeta<TOptions, TMessageIds, TRuleListener>>): RuleModule<TMessageIds, TOptions, TRuleListener>;
12
34
  export { RuleCreator };
13
35
  //# sourceMappingURL=RuleCreator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RuleCreator.d.ts","sourceRoot":"","sources":["../../src/eslint-utils/RuleCreator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,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