oxlint-appsync 0.3.1 → 0.4.1

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.
package/README.md CHANGED
@@ -71,30 +71,49 @@ export default [
71
71
 
72
72
  ## Rules
73
73
 
74
- | Rule | Description |
75
- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
76
- | `appsync/no-global-constructor` | Disallow global constructor calls (`String()`, `Number()`, `Boolean()`, `Date()`, etc.) |
77
- | `appsync/no-async-await` | Disallow `async`/`await` and async functions |
78
- | `appsync/no-classes` | Disallow `class` declarations and expressions |
79
- | `appsync/no-instanceof` | Disallow `instanceof` |
80
- | `appsync/no-for-loop` | Disallow C-style `for` loops (`for-in` / `for-of` allowed) |
81
- | `appsync/no-while` | Disallow `while` loops |
82
- | `appsync/no-do-while` | Disallow `do-while` loops |
83
- | `appsync/no-try` | Disallow `try`/`catch`/`finally` |
84
- | `appsync/no-throw` | Disallow `throw` |
85
- | `appsync/no-continue` | Disallow `continue` |
86
- | `appsync/no-labeled-statement` | Disallow labeled statements |
87
- | `appsync/no-new` | Disallow the `new` operator |
88
- | `appsync/no-generators` | Disallow generator functions |
89
- | `appsync/no-this` | Disallow `this` |
90
- | `appsync/no-update-operators` | Disallow `++` and `--` |
91
- | `appsync/no-bitwise-not` | Disallow bitwise NOT (`~`) |
92
- | `appsync/no-in-operator` | Disallow `in` (use `Object.hasOwn`) |
93
- | `appsync/no-function-arguments` | Disallow passing functions as call arguments (parity with AWS `no-function-passing`; inline arrows allowed only on allowlisted Array methods like `map`, `filter`) |
94
- | `appsync/no-appsync-globals` | Disallow AppSync-only globals (`util`, `extensions`, `runtime`) — opt-in, included in `portable` |
74
+ | Rule | Description |
75
+ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
76
+ | `appsync/no-global-constructor` | Disallow global constructor calls (`String()`, `Number()`, `Boolean()`, `Date()`, etc.) |
77
+ | `appsync/no-async-await` | Disallow `async`/`await` and async functions |
78
+ | `appsync/no-classes` | Disallow `class` declarations and expressions |
79
+ | `appsync/no-context-reassignment` | Disallow reassigning `context` and its base properties |
80
+ | `appsync/no-instanceof` | Disallow `instanceof` |
81
+ | `appsync/no-for-loop` | Disallow C-style `for` loops (`for-in` / `for-of` allowed) |
82
+ | `appsync/no-while` | Disallow `while` loops |
83
+ | `appsync/no-do-while` | Disallow `do-while` loops |
84
+ | `appsync/no-disallowed-methods` | Disallow unsupported methods (`call`, `apply`, `bind`) |
85
+ | `appsync/no-try` | Disallow `try`/`catch`/`finally` |
86
+ | `appsync/no-throw` | Disallow `throw` |
87
+ | `appsync/no-continue` | Disallow `continue` |
88
+ | `appsync/no-labeled-statement` | Disallow labeled statements |
89
+ | `appsync/no-new` | Disallow the `new` operator |
90
+ | `appsync/no-regex` | Disallow regex literals (`/pattern/`) |
91
+ | `appsync/no-promise` | Disallow `Promise` usage |
92
+ | `appsync/no-recursion` | Disallow recursive function calls |
93
+ | `appsync/no-generators` | Disallow generator functions |
94
+ | `appsync/no-this` | Disallow `this` |
95
+ | `appsync/no-update-operators` | Disallow `++` and `--` |
96
+ | `appsync/no-bitwise-not` | Disallow bitwise NOT (`~`) |
97
+ | `appsync/no-in-operator` | Disallow `in` (use `Object.hasOwn`) |
98
+ | `appsync/no-function-arguments` | Disallow passing functions as call arguments (parity with AWS `no-function-passing`; inline arrows allowed only on allowlisted Array methods like `map`, `filter`) |
99
+ | `appsync/no-function-reassign` | Disallow reassigning function variables |
100
+ | `appsync/no-function-return` | Disallow returning functions from functions |
101
+ | `appsync/no-appsync-globals` | Disallow AppSync-only globals (`util`, `extensions`, `runtime`) — opt-in, included in `portable` |
95
102
 
96
103
  ## Migration
97
104
 
105
+ ### 0.3.1 → 0.4.0
106
+
107
+ Seven new rules are enabled in the `recommended` and `portable` presets for parity with `@aws-appsync/eslint-plugin`:
108
+
109
+ - `appsync/no-regex` — regex literals (`/pattern/`) are not supported; use string patterns for `replace`, `split`, etc.
110
+ - `appsync/no-promise` — `Promise` usage is not supported.
111
+ - `appsync/no-context-reassignment` — reassigning `context` or its base properties is not supported.
112
+ - `appsync/no-disallowed-methods` — `call`, `apply`, and `bind` are not supported.
113
+ - `appsync/no-recursion` — recursive function calls are not supported.
114
+ - `appsync/no-function-reassign` — reassigning function variables is not supported.
115
+ - `appsync/no-function-return` — returning functions from functions is not supported.
116
+
98
117
  ### 0.3.0 → 0.3.1
99
118
 
100
119
  `appsync/no-function-arguments` now matches AWS `no-function-passing` more closely:
package/dist/index.d.ts CHANGED
@@ -6,15 +6,22 @@ declare const rules: {
6
6
  "no-async-await": _oxlint_plugins0.CreateOnceRule;
7
7
  "no-bitwise-not": _oxlint_plugins0.CreateOnceRule;
8
8
  "no-classes": _oxlint_plugins0.CreateOnceRule;
9
+ "no-context-reassignment": _oxlint_plugins0.CreateOnceRule;
9
10
  "no-continue": _oxlint_plugins0.CreateOnceRule;
10
11
  "no-do-while": _oxlint_plugins0.CreateOnceRule;
12
+ "no-disallowed-methods": _oxlint_plugins0.CreateOnceRule;
11
13
  "no-for-loop": _oxlint_plugins0.CreateOnceRule;
12
14
  "no-function-arguments": _oxlint_plugins0.CreateOnceRule;
15
+ "no-function-reassign": _oxlint_plugins0.CreateOnceRule;
16
+ "no-function-return": _oxlint_plugins0.CreateOnceRule;
13
17
  "no-generators": _oxlint_plugins0.CreateOnceRule;
14
18
  "no-in-operator": _oxlint_plugins0.CreateOnceRule;
15
19
  "no-instanceof": _oxlint_plugins0.CreateOnceRule;
16
20
  "no-labeled-statement": _oxlint_plugins0.CreateOnceRule;
17
21
  "no-new": _oxlint_plugins0.CreateOnceRule;
22
+ "no-promise": _oxlint_plugins0.CreateOnceRule;
23
+ "no-recursion": _oxlint_plugins0.CreateOnceRule;
24
+ "no-regex": _oxlint_plugins0.CreateOnceRule;
18
25
  "no-global-constructor": _oxlint_plugins0.CreateOnceRule;
19
26
  "no-this": _oxlint_plugins0.CreateOnceRule;
20
27
  "no-throw": _oxlint_plugins0.CreateOnceRule;
@@ -31,15 +38,22 @@ declare const portable: {
31
38
  readonly "appsync/no-async-await": "error";
32
39
  readonly "appsync/no-bitwise-not": "error";
33
40
  readonly "appsync/no-classes": "error";
41
+ readonly "appsync/no-context-reassignment": "error";
34
42
  readonly "appsync/no-continue": "error";
35
43
  readonly "appsync/no-do-while": "error";
44
+ readonly "appsync/no-disallowed-methods": "error";
36
45
  readonly "appsync/no-for-loop": "error";
37
46
  readonly "appsync/no-function-arguments": "error";
47
+ readonly "appsync/no-function-reassign": "error";
48
+ readonly "appsync/no-function-return": "error";
38
49
  readonly "appsync/no-generators": "error";
39
50
  readonly "appsync/no-in-operator": "error";
40
51
  readonly "appsync/no-instanceof": "error";
41
52
  readonly "appsync/no-labeled-statement": "error";
42
53
  readonly "appsync/no-new": "error";
54
+ readonly "appsync/no-promise": "error";
55
+ readonly "appsync/no-recursion": "error";
56
+ readonly "appsync/no-regex": "error";
43
57
  readonly "appsync/no-global-constructor": "error";
44
58
  readonly "appsync/no-this": "error";
45
59
  readonly "appsync/no-throw": "error";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/rules/index.ts","../src/plugin.ts"],"mappings":";;;cAqBM;wBAoBuC,gBAAA,CAAA;;EApBvC,gBAoBuC,iCAAA;EAAA,YAAA,iCAAA;EAAA,aAAA,iCAAA;;;;;;;;;;;;;;;;;;cCpChC,QAKX,gBAAA,CALiB;cAON,aAIR,kBAAkB,qBAAqB;ADKtC,cCHO,QDuBgC,EAAA;EAAA,SAAA,4BAAA,EAAA,OAAA;EAAA,SAAA,wBAAA,EAAA,OAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/rules/index.ts","../src/plugin.ts"],"mappings":";;;cA4BM;wBA2BuC,gBAAA,CAAA;;EA3BvC,gBA2BuC,iCAAA;EAAA,YAAA,iCAAA;EAAA,yBAAA,iCAAA;;;;;;;;;;;;;;;;;;;;;;;;;cClDhC,QAKX,gBAAA,CALiB;cAON,aAIR,kBAAkB,qBAAqB;ADYtC,cCVO,QDqCgC,EAAA;EAAA,SAAA,4BAAA,EAAA,OAAA;EAAA,SAAA,wBAAA,EAAA,OAAA"}
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { eslintCompatPlugin } from "@oxlint/plugins";
2
- //#region src/rules/appsync-globals.ts
2
+ //#region src/lib/appsync-globals.ts
3
3
  const APPSYNC_GLOBAL_NAMES = /* @__PURE__ */ new Set([
4
4
  "util",
5
5
  "extensions",
6
6
  "runtime"
7
7
  ]);
8
8
  //#endregion
9
- //#region src/rules/types.ts
9
+ //#region src/lib/rule-types.ts
10
10
  function defineAppsyncRule(rule) {
11
11
  return rule;
12
12
  }
@@ -57,7 +57,10 @@ var no_appsync_globals_default = defineAppsyncRule({
57
57
  }
58
58
  });
59
59
  //#endregion
60
- //#region src/rules/utils.ts
60
+ //#region src/lib/utils.ts
61
+ function isIdentifier(node, name) {
62
+ return node?.type === "Identifier" && node.name === name;
63
+ }
61
64
  function reportDefault(context, node, messageId = "default") {
62
65
  context.report({
63
66
  node,
@@ -123,6 +126,25 @@ var no_classes_default = defineAppsyncRule({
123
126
  }
124
127
  });
125
128
  //#endregion
129
+ //#region src/rules/no-context-reassignment.ts
130
+ function isContextAssignmentTarget(node) {
131
+ if (isIdentifier(node, "context")) return true;
132
+ return node.type === "MemberExpression" && isIdentifier(node.object, "context");
133
+ }
134
+ var no_context_reassignment_default = defineAppsyncRule({
135
+ meta: {
136
+ type: "problem",
137
+ docs: { description: "Disallow reassigning context and its base properties in AppSync resolvers" },
138
+ messages: { default: "Reassigning context and base properties of context is not supported in the AppSync JS runtime" },
139
+ schema: []
140
+ },
141
+ createOnce(context) {
142
+ return { AssignmentExpression(node) {
143
+ if (isContextAssignmentTarget(node.left)) reportDefault(context, node.left);
144
+ } };
145
+ }
146
+ });
147
+ //#endregion
126
148
  //#region src/rules/no-continue.ts
127
149
  var no_continue_default = defineAppsyncRule({
128
150
  meta: {
@@ -138,6 +160,67 @@ var no_continue_default = defineAppsyncRule({
138
160
  }
139
161
  });
140
162
  //#endregion
163
+ //#region src/lib/disallowed-methods.ts
164
+ const DISALLOWED_METHOD_NAMES = /* @__PURE__ */ new Set([
165
+ "apply",
166
+ "bind",
167
+ "call"
168
+ ]);
169
+ //#endregion
170
+ //#region src/lib/function-utils.ts
171
+ function getMemberPropertyName(property) {
172
+ if (property.type === "Identifier") return property.name;
173
+ if (property.type === "Literal" && typeof property.value === "string") return property.value;
174
+ return null;
175
+ }
176
+ function definitionCreatesFunction(def) {
177
+ if (def.type === "FunctionName") return true;
178
+ if (def.type === "Variable" && def.node.type === "VariableDeclarator") {
179
+ const init = def.node.init;
180
+ if (!init) return false;
181
+ return init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression";
182
+ }
183
+ return false;
184
+ }
185
+ function isFunctionNode(node) {
186
+ return node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression";
187
+ }
188
+ function isFunctionLikeNode(node, context) {
189
+ if (node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") return true;
190
+ if (node.type !== "Identifier") return false;
191
+ return variableHoldsFunction(node.name, context, node);
192
+ }
193
+ function variableHoldsFunction(name, context, referenceNode) {
194
+ let scope = context.sourceCode.getScope(referenceNode);
195
+ while (scope) {
196
+ const variable = scope.set.get(name);
197
+ if (variable) return variable.defs.some(definitionCreatesFunction);
198
+ scope = scope.upper;
199
+ }
200
+ return false;
201
+ }
202
+ //#endregion
203
+ //#region src/rules/no-disallowed-methods.ts
204
+ var no_disallowed_methods_default = defineAppsyncRule({
205
+ meta: {
206
+ type: "problem",
207
+ docs: { description: "Disallow unsupported method calls such as call, apply, and bind" },
208
+ messages: { default: "The {{method}}() method is not supported in the AppSync JS runtime" },
209
+ schema: []
210
+ },
211
+ createOnce(context) {
212
+ return { CallExpression(node) {
213
+ if (node.callee.type !== "MemberExpression") return;
214
+ const method = getMemberPropertyName(node.callee.property);
215
+ if (method && DISALLOWED_METHOD_NAMES.has(method)) context.report({
216
+ node,
217
+ messageId: "default",
218
+ data: { method }
219
+ });
220
+ } };
221
+ }
222
+ });
223
+ //#endregion
141
224
  //#region src/rules/no-do-while.ts
142
225
  var no_do_while_default = defineAppsyncRule({
143
226
  meta: {
@@ -168,7 +251,7 @@ var no_for_loop_default = defineAppsyncRule({
168
251
  }
169
252
  });
170
253
  //#endregion
171
- //#region src/rules/no-function-arguments.ts
254
+ //#region src/lib/callback-accepting-methods.ts
172
255
  const CALLBACK_ACCEPTING_METHODS = /* @__PURE__ */ new Set([
173
256
  "map",
174
257
  "find",
@@ -183,32 +266,20 @@ const CALLBACK_ACCEPTING_METHODS = /* @__PURE__ */ new Set([
183
266
  "some",
184
267
  "flatMap"
185
268
  ]);
186
- function getMemberPropertyName(property) {
187
- if (property.type === "Identifier") return property.name;
188
- if (property.type === "Literal" && typeof property.value === "string") return property.value;
189
- return null;
190
- }
269
+ //#endregion
270
+ //#region src/rules/no-function-arguments.ts
191
271
  function isCallbackAcceptingCall(callee) {
192
272
  if (callee.type !== "MemberExpression") return false;
193
273
  const propertyName = getMemberPropertyName(callee.property);
194
274
  return propertyName !== null && CALLBACK_ACCEPTING_METHODS.has(propertyName);
195
275
  }
196
- function definitionCreatesFunction(def) {
197
- if (def.type === "FunctionName") return true;
198
- if (def.type === "Variable" && def.node.type === "VariableDeclarator") {
199
- const init = def.node.init;
200
- if (!init) return false;
201
- return init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression";
202
- }
203
- return false;
204
- }
205
276
  function isFunctionLikeArgument(node, context) {
206
277
  if (node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") return true;
207
278
  if (node.type !== "Identifier") return false;
208
279
  let scope = context.sourceCode.getScope(node);
209
280
  while (scope) {
210
281
  if (scope.set.get(node.name)?.defs.some(definitionCreatesFunction)) return true;
211
- scope = scope.upper;
282
+ scope = scope.upper ?? null;
212
283
  }
213
284
  return false;
214
285
  }
@@ -231,6 +302,38 @@ var no_function_arguments_default = defineAppsyncRule({
231
302
  }
232
303
  });
233
304
  //#endregion
305
+ //#region src/rules/no-function-reassign.ts
306
+ var no_function_reassign_default = defineAppsyncRule({
307
+ meta: {
308
+ type: "problem",
309
+ docs: { description: "Disallow reassigning function variables in AppSync resolvers" },
310
+ messages: { default: "Functions cannot be reassigned in the AppSync JS runtime" },
311
+ schema: []
312
+ },
313
+ createOnce(context) {
314
+ return { AssignmentExpression(node) {
315
+ if (node.left.type !== "Identifier") return;
316
+ if (variableHoldsFunction(node.left.name, context, node.left)) reportDefault(context, node.left);
317
+ } };
318
+ }
319
+ });
320
+ //#endregion
321
+ //#region src/rules/no-function-return.ts
322
+ var no_function_return_default = defineAppsyncRule({
323
+ meta: {
324
+ type: "problem",
325
+ docs: { description: "Disallow returning functions from functions in AppSync resolvers" },
326
+ messages: { default: "Functions cannot be the return value of functions in the AppSync JS runtime" },
327
+ schema: []
328
+ },
329
+ createOnce(context) {
330
+ return { ReturnStatement(node) {
331
+ if (!node.argument) return;
332
+ if (isFunctionLikeNode(node.argument, context)) reportDefault(context, node.argument);
333
+ } };
334
+ }
335
+ });
336
+ //#endregion
234
337
  //#region src/rules/no-generators.ts
235
338
  var no_generators_default = defineAppsyncRule({
236
339
  meta: {
@@ -250,7 +353,7 @@ var no_generators_default = defineAppsyncRule({
250
353
  }
251
354
  });
252
355
  //#endregion
253
- //#region src/rules/global-constructors.ts
356
+ //#region src/lib/global-constructors.ts
254
357
  const GLOBAL_CONSTRUCTOR_NAMES = /* @__PURE__ */ new Set([
255
358
  "String",
256
359
  "Boolean",
@@ -283,67 +386,172 @@ var no_global_constructor_default = defineAppsyncRule({
283
386
  }
284
387
  });
285
388
  //#endregion
389
+ //#region src/rules/no-in-operator.ts
390
+ var no_in_operator_default = defineAppsyncRule({
391
+ meta: {
392
+ type: "problem",
393
+ docs: { description: "Disallow the in operator in AppSync resolvers" },
394
+ messages: { default: "The in operator is not supported in the AppSync JS runtime; use Object.hasOwn instead" },
395
+ schema: []
396
+ },
397
+ createOnce(context) {
398
+ return { BinaryExpression(node) {
399
+ if (node.operator === "in") reportDefault(context, node);
400
+ } };
401
+ }
402
+ });
403
+ //#endregion
404
+ //#region src/rules/no-instanceof.ts
405
+ var no_instanceof_default = defineAppsyncRule({
406
+ meta: {
407
+ type: "problem",
408
+ docs: { description: "Disallow the instanceof operator in AppSync resolvers" },
409
+ messages: { default: "The instanceof operator is not supported in the AppSync JS runtime" },
410
+ schema: []
411
+ },
412
+ createOnce(context) {
413
+ return { BinaryExpression(node) {
414
+ if (node.operator === "instanceof") reportDefault(context, node);
415
+ } };
416
+ }
417
+ });
418
+ //#endregion
419
+ //#region src/rules/no-labeled-statement.ts
420
+ var no_labeled_statement_default = defineAppsyncRule({
421
+ meta: {
422
+ type: "problem",
423
+ docs: { description: "Disallow labeled statements in AppSync resolvers" },
424
+ messages: { default: "Labeled statements are not supported in the AppSync JS runtime" },
425
+ schema: []
426
+ },
427
+ createOnce(context) {
428
+ return { LabeledStatement(node) {
429
+ reportDefault(context, node);
430
+ } };
431
+ }
432
+ });
433
+ //#endregion
434
+ //#region src/rules/no-new.ts
435
+ var no_new_default = defineAppsyncRule({
436
+ meta: {
437
+ type: "problem",
438
+ docs: { description: "Disallow the new operator in AppSync resolvers" },
439
+ messages: { default: "The new operator is not supported in the AppSync JS runtime" },
440
+ schema: []
441
+ },
442
+ createOnce(context) {
443
+ return { NewExpression(node) {
444
+ reportDefault(context, node);
445
+ } };
446
+ }
447
+ });
448
+ //#endregion
449
+ //#region src/rules/no-promise.ts
450
+ var no_promise_default = defineAppsyncRule({
451
+ meta: {
452
+ type: "problem",
453
+ docs: { description: "Disallow Promise usage in AppSync resolvers" },
454
+ messages: { default: "Promises are not supported in the AppSync JS runtime" },
455
+ schema: []
456
+ },
457
+ createOnce(context) {
458
+ return {
459
+ CallExpression(node) {
460
+ const { callee } = node;
461
+ if (isIdentifier(callee, "Promise") || callee.type === "MemberExpression" && isIdentifier(callee.object, "Promise")) reportDefault(context, node);
462
+ },
463
+ NewExpression(node) {
464
+ if (isIdentifier(node.callee, "Promise")) reportDefault(context, node);
465
+ },
466
+ VariableDeclarator(node) {
467
+ if (node.init && isIdentifier(node.init, "Promise")) reportDefault(context, node.init);
468
+ },
469
+ AssignmentExpression(node) {
470
+ if (isIdentifier(node.right, "Promise")) reportDefault(context, node.right);
471
+ }
472
+ };
473
+ }
474
+ });
475
+ //#endregion
476
+ //#region src/rules/no-recursion.ts
477
+ function getEnclosingBindingNames(node, context) {
478
+ const names = /* @__PURE__ */ new Set();
479
+ if ((node.type === "FunctionDeclaration" || node.type === "FunctionExpression") && node.id?.type === "Identifier") names.add(node.id.name);
480
+ let scope = context.sourceCode.getScope(node).upper;
481
+ while (scope) {
482
+ for (const variable of scope.variables) for (const def of variable.defs) if (def.type === "Variable" && def.node.type === "VariableDeclarator" && def.node.init === node) names.add(variable.name);
483
+ scope = scope.upper;
484
+ }
485
+ return names;
486
+ }
487
+ //#endregion
286
488
  //#region src/rules/index.ts
287
489
  const rules = {
288
490
  "no-appsync-globals": no_appsync_globals_default,
289
491
  "no-async-await": no_async_await_default,
290
492
  "no-bitwise-not": no_bitwise_not_default,
291
493
  "no-classes": no_classes_default,
494
+ "no-context-reassignment": no_context_reassignment_default,
292
495
  "no-continue": no_continue_default,
293
496
  "no-do-while": no_do_while_default,
497
+ "no-disallowed-methods": no_disallowed_methods_default,
294
498
  "no-for-loop": no_for_loop_default,
295
499
  "no-function-arguments": no_function_arguments_default,
500
+ "no-function-reassign": no_function_reassign_default,
501
+ "no-function-return": no_function_return_default,
296
502
  "no-generators": no_generators_default,
297
- "no-in-operator": defineAppsyncRule({
503
+ "no-in-operator": no_in_operator_default,
504
+ "no-instanceof": no_instanceof_default,
505
+ "no-labeled-statement": no_labeled_statement_default,
506
+ "no-new": no_new_default,
507
+ "no-promise": no_promise_default,
508
+ "no-recursion": defineAppsyncRule({
298
509
  meta: {
299
510
  type: "problem",
300
- docs: { description: "Disallow the in operator in AppSync resolvers" },
301
- messages: { default: "The in operator is not supported in the AppSync JS runtime; use Object.hasOwn instead" },
511
+ docs: { description: "Disallow recursive function calls in AppSync resolvers" },
512
+ messages: { default: "Recursive function calls are not supported in the AppSync JS runtime" },
302
513
  schema: []
303
514
  },
304
515
  createOnce(context) {
305
- return { BinaryExpression(node) {
306
- if (node.operator === "in") reportDefault(context, node);
307
- } };
308
- }
309
- }),
310
- "no-instanceof": defineAppsyncRule({
311
- meta: {
312
- type: "problem",
313
- docs: { description: "Disallow the instanceof operator in AppSync resolvers" },
314
- messages: { default: "The instanceof operator is not supported in the AppSync JS runtime" },
315
- schema: []
316
- },
317
- createOnce(context) {
318
- return { BinaryExpression(node) {
319
- if (node.operator === "instanceof") reportDefault(context, node);
320
- } };
321
- }
322
- }),
323
- "no-labeled-statement": defineAppsyncRule({
324
- meta: {
325
- type: "problem",
326
- docs: { description: "Disallow labeled statements in AppSync resolvers" },
327
- messages: { default: "Labeled statements are not supported in the AppSync JS runtime" },
328
- schema: []
329
- },
330
- createOnce(context) {
331
- return { LabeledStatement(node) {
332
- reportDefault(context, node);
333
- } };
516
+ const enclosingBindingNames = [];
517
+ const enterFunction = (node) => {
518
+ if (!isFunctionNode(node)) return;
519
+ enclosingBindingNames.push(getEnclosingBindingNames(node, context));
520
+ };
521
+ const exitFunction = (node) => {
522
+ if (!isFunctionNode(node)) return;
523
+ enclosingBindingNames.pop();
524
+ };
525
+ return {
526
+ FunctionDeclaration: enterFunction,
527
+ "FunctionDeclaration:exit": exitFunction,
528
+ FunctionExpression: enterFunction,
529
+ "FunctionExpression:exit": exitFunction,
530
+ ArrowFunctionExpression: enterFunction,
531
+ "ArrowFunctionExpression:exit": exitFunction,
532
+ CallExpression(node) {
533
+ if (node.callee.type !== "Identifier") return;
534
+ if (enclosingBindingNames[enclosingBindingNames.length - 1]?.has(node.callee.name)) reportDefault(context, node);
535
+ }
536
+ };
334
537
  }
335
538
  }),
336
- "no-new": defineAppsyncRule({
539
+ "no-regex": defineAppsyncRule({
337
540
  meta: {
338
541
  type: "problem",
339
- docs: { description: "Disallow the new operator in AppSync resolvers" },
340
- messages: { default: "The new operator is not supported in the AppSync JS runtime" },
542
+ docs: { description: "Disallow regex literals in AppSync resolvers" },
543
+ messages: { default: "Regex literals are not supported in the AppSync JS runtime" },
341
544
  schema: []
342
545
  },
343
546
  createOnce(context) {
344
- return { NewExpression(node) {
345
- reportDefault(context, node);
346
- } };
547
+ return {
548
+ Literal(node) {
549
+ if ("regex" in node && node.regex) reportDefault(context, node);
550
+ },
551
+ RegExpLiteral(node) {
552
+ reportDefault(context, node);
553
+ }
554
+ };
347
555
  }
348
556
  }),
349
557
  "no-global-constructor": no_global_constructor_default,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["member","noAppsyncGlobals","noAsyncAwait","noBitwiseNot","noClasses","noContinue","noDoWhile","noForLoop","noFunctionArguments","noGenerators","noInOperator","noInstanceof","noLabeledStatement","noNew","noGlobalConstructor","noThis","noThrow","noTry","noUpdateOperators","noWhile"],"sources":["../src/rules/appsync-globals.ts","../src/rules/types.ts","../src/rules/no-appsync-globals.ts","../src/rules/utils.ts","../src/rules/no-async-await.ts","../src/rules/no-bitwise-not.ts","../src/rules/no-classes.ts","../src/rules/no-continue.ts","../src/rules/no-do-while.ts","../src/rules/no-for-loop.ts","../src/rules/no-function-arguments.ts","../src/rules/no-generators.ts","../src/rules/global-constructors.ts","../src/rules/no-global-constructor.ts","../src/rules/no-in-operator.ts","../src/rules/no-instanceof.ts","../src/rules/no-labeled-statement.ts","../src/rules/no-new.ts","../src/rules/no-this.ts","../src/rules/no-throw.ts","../src/rules/no-try.ts","../src/rules/no-update-operators.ts","../src/rules/no-while.ts","../src/rules/index.ts","../src/plugin.ts","../src/index.ts"],"sourcesContent":["export const APPSYNC_GLOBAL_NAMES = new Set([\n \"util\",\n \"extensions\",\n \"runtime\",\n]);\n","import type { CreateOnceRule } from \"@oxlint/plugins\";\n\nexport type AppsyncRuleModule = CreateOnceRule;\n\nexport function defineAppsyncRule(rule: AppsyncRuleModule): AppsyncRuleModule {\n return rule;\n}\n","import type { Context, ESTree, Scope } from \"@oxlint/plugins\";\nimport { APPSYNC_GLOBAL_NAMES } from \"./appsync-globals.js\";\nimport { defineAppsyncRule } from \"./types.js\";\n\nfunction isBindingPosition(node: ESTree.Node): boolean {\n const parent = node.parent;\n if (!parent) {\n return false;\n }\n\n if (\n parent.type === \"VariableDeclarator\" ||\n parent.type === \"FunctionDeclaration\" ||\n parent.type === \"FunctionExpression\" ||\n parent.type === \"ClassDeclaration\"\n ) {\n return parent.id === node;\n }\n\n if (\n parent.type === \"ImportSpecifier\" ||\n parent.type === \"ImportDefaultSpecifier\" ||\n parent.type === \"ImportNamespaceSpecifier\"\n ) {\n return parent.local === node;\n }\n\n if (parent.type === \"CatchClause\") {\n return parent.param === node;\n }\n\n return false;\n}\n\nfunction isNonReferencePosition(node: ESTree.Node): boolean {\n const parent = node.parent;\n if (!parent) {\n return false;\n }\n\n if (parent.type === \"Property\" && parent.key === node && !parent.computed) {\n return true;\n }\n\n if (\n parent.type === \"MemberExpression\" &&\n parent.property === node &&\n !parent.computed\n ) {\n return true;\n }\n\n return isBindingPosition(node);\n}\n\nfunction hasLocalBinding(\n node: { name: string },\n context: Context,\n): boolean {\n let scope: Scope | null = context.sourceCode.getScope(\n node as ESTree.IdentifierReference,\n );\n while (scope) {\n const variable = scope.set.get(node.name);\n if (variable && variable.defs.length > 0) {\n return true;\n }\n scope = scope.upper;\n }\n\n return false;\n}\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow AppSync-only globals in code that must run outside the AppSync runtime\",\n },\n messages: {\n default:\n \"AppSync global `{{name}}` is not available outside the AppSync runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n Identifier(node) {\n if (!APPSYNC_GLOBAL_NAMES.has(node.name)) {\n return;\n }\n\n if (isNonReferencePosition(node)) {\n return;\n }\n\n if (hasLocalBinding(node, context)) {\n return;\n }\n\n context.report({\n node,\n messageId: \"default\",\n data: { name: node.name },\n });\n },\n };\n },\n});\n","import type { Context, ESTree } from \"@oxlint/plugins\";\n\ntype NodeWithType = { type: string };\n\nexport function isIdentifier(\n node: NodeWithType | null | undefined,\n name: string,\n): boolean {\n return (\n node?.type === \"Identifier\" &&\n (node as unknown as { name: string }).name === name\n );\n}\n\nexport function reportDefault(\n context: Context,\n node: ESTree.Node,\n messageId = \"default\",\n): void {\n context.report({ node, messageId });\n}\n","import { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow async functions and await expressions in AppSync resolvers\",\n },\n messages: {\n default:\n \"Promises and async/await are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n const reportAsyncFunction = (node: { async?: boolean }) => {\n if (node.async) {\n reportDefault(context, node as never);\n }\n };\n\n return {\n AwaitExpression(node) {\n reportDefault(context, node);\n },\n FunctionDeclaration: reportAsyncFunction,\n FunctionExpression: reportAsyncFunction,\n ArrowFunctionExpression: reportAsyncFunction,\n };\n },\n});\n","import { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow the bitwise NOT (~) operator in AppSync resolvers\",\n },\n messages: {\n default: \"The ~ operator is not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n UnaryExpression(node) {\n if (node.operator === \"~\") {\n reportDefault(context, node);\n }\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow class declarations and expressions in AppSync resolvers\",\n },\n messages: {\n default: \"Classes are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n ClassDeclaration(node) {\n reportDefault(context, node);\n },\n ClassExpression(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow continue statements in AppSync resolvers\",\n },\n messages: {\n default: \"continue statements are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n ContinueStatement(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow do-while loops in AppSync resolvers\",\n },\n messages: {\n default: \"do-while loops are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n DoWhileStatement(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow C-style for loops in AppSync resolvers (for-in and for-of are allowed)\",\n },\n messages: {\n default:\n \"Only for-in and for-of loops are supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n ForStatement(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import type { Context, Definition, ESTree, Scope } from \"@oxlint/plugins\";\nimport { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nconst CALLBACK_ACCEPTING_METHODS = new Set([\n \"map\",\n \"find\",\n \"filter\",\n \"findIndex\",\n \"findLast\",\n \"findLastIndex\",\n \"forEach\",\n \"reduce\",\n \"reduceRight\",\n \"every\",\n \"some\",\n \"flatMap\",\n]);\n\nfunction getMemberPropertyName(\n property: ESTree.Node & { type: string },\n): string | null {\n if (property.type === \"Identifier\") {\n return (property as unknown as { name: string }).name;\n }\n\n if (property.type === \"Literal\" && typeof property.value === \"string\") {\n return property.value;\n }\n\n return null;\n}\n\nfunction isCallbackAcceptingCall(callee: ESTree.Node): boolean {\n if (callee.type !== \"MemberExpression\") {\n return false;\n }\n\n const member = callee as ESTree.StaticMemberExpression | ESTree.ComputedMemberExpression;\n const propertyName = getMemberPropertyName(member.property);\n return propertyName !== null && CALLBACK_ACCEPTING_METHODS.has(propertyName);\n}\n\nfunction definitionCreatesFunction(def: Definition): boolean {\n if (def.type === \"FunctionName\") {\n return true;\n }\n\n if (def.type === \"Variable\" && def.node.type === \"VariableDeclarator\") {\n const init = def.node.init;\n if (!init) {\n return false;\n }\n\n return (\n init.type === \"FunctionExpression\" ||\n init.type === \"ArrowFunctionExpression\"\n );\n }\n\n return false;\n}\n\nfunction isFunctionLikeArgument(node: ESTree.Node, context: Context): boolean {\n if (\n node.type === \"FunctionExpression\" ||\n node.type === \"ArrowFunctionExpression\"\n ) {\n return true;\n }\n\n if (node.type !== \"Identifier\") {\n return false;\n }\n\n let scope: Scope | null = context.sourceCode.getScope(node);\n while (scope) {\n const variable = scope.set.get(node.name);\n if (variable?.defs.some(definitionCreatesFunction)) {\n return true;\n }\n scope = scope.upper;\n }\n\n return false;\n}\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow passing functions as call arguments except to allowlisted Array methods\",\n },\n messages: {\n default: \"Functions can not be passed as an argument\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n const allowsCallbacks = isCallbackAcceptingCall(node.callee);\n\n for (const argument of node.arguments) {\n if (argument.type === \"SpreadElement\") {\n continue;\n }\n\n if (argument.type === \"ArrowFunctionExpression\" && allowsCallbacks) {\n continue;\n }\n\n if (isFunctionLikeArgument(argument, context)) {\n reportDefault(context, argument);\n }\n }\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow generator functions in AppSync resolvers\",\n },\n messages: {\n default: \"Generators are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n const reportGenerator = (node: { generator?: boolean }) => {\n if (node.generator) {\n reportDefault(context, node as never);\n }\n };\n\n return {\n FunctionDeclaration: reportGenerator,\n FunctionExpression: reportGenerator,\n };\n },\n});\n","export const GLOBAL_CONSTRUCTOR_NAMES = new Set([\n \"String\",\n \"Boolean\",\n \"Number\",\n \"BigInt\",\n \"Symbol\",\n \"Date\",\n \"Object\",\n \"Array\",\n \"Function\",\n \"RegExp\",\n]);\n","import { GLOBAL_CONSTRUCTOR_NAMES } from \"./global-constructors.js\";\nimport { defineAppsyncRule } from \"./types.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow calling global constructor functions in AppSync resolvers\",\n },\n messages: {\n default:\n \"Do not use `{{name}}()` as a constructor in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n if (\n node.callee.type === \"Identifier\" &&\n GLOBAL_CONSTRUCTOR_NAMES.has(node.callee.name)\n ) {\n context.report({\n node,\n messageId: \"default\",\n data: { name: node.callee.name },\n });\n }\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow the in operator in AppSync resolvers\",\n },\n messages: {\n default:\n \"The in operator is not supported in the AppSync JS runtime; use Object.hasOwn instead\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n BinaryExpression(node) {\n if (node.operator === \"in\") {\n reportDefault(context, node);\n }\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow the instanceof operator in AppSync resolvers\",\n },\n messages: {\n default: \"The instanceof operator is not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n BinaryExpression(node) {\n if (node.operator === \"instanceof\") {\n reportDefault(context, node);\n }\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow labeled statements in AppSync resolvers\",\n },\n messages: {\n default: \"Labeled statements are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n LabeledStatement(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow the new operator in AppSync resolvers\",\n },\n messages: {\n default: \"The new operator is not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n NewExpression(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow this expressions in AppSync resolvers\",\n },\n messages: {\n default: \"this is not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n ThisExpression(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow throw statements in AppSync resolvers\",\n },\n messages: {\n default: \"throw statements are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n ThrowStatement(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow try/catch/finally statements in AppSync resolvers\",\n },\n messages: {\n default:\n \"try/catch/finally statements are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n TryStatement(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow ++ and -- operators in AppSync resolvers\",\n },\n messages: {\n default: \"++ and -- operators are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n UpdateExpression(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow while loops in AppSync resolvers\",\n },\n messages: {\n default: \"while loops are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n WhileStatement(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import noAppsyncGlobals from \"./no-appsync-globals.js\";\nimport noAsyncAwait from \"./no-async-await.js\";\nimport noBitwiseNot from \"./no-bitwise-not.js\";\nimport noClasses from \"./no-classes.js\";\nimport noContinue from \"./no-continue.js\";\nimport noDoWhile from \"./no-do-while.js\";\nimport noForLoop from \"./no-for-loop.js\";\nimport noFunctionArguments from \"./no-function-arguments.js\";\nimport noGenerators from \"./no-generators.js\";\nimport noGlobalConstructor from \"./no-global-constructor.js\";\nimport noInOperator from \"./no-in-operator.js\";\nimport noInstanceof from \"./no-instanceof.js\";\nimport noLabeledStatement from \"./no-labeled-statement.js\";\nimport noNew from \"./no-new.js\";\nimport noThis from \"./no-this.js\";\nimport noThrow from \"./no-throw.js\";\nimport noTry from \"./no-try.js\";\nimport noUpdateOperators from \"./no-update-operators.js\";\nimport noWhile from \"./no-while.js\";\nimport type { AppsyncRuleModule } from \"./types.js\";\n\nconst rules = {\n \"no-appsync-globals\": noAppsyncGlobals,\n \"no-async-await\": noAsyncAwait,\n \"no-bitwise-not\": noBitwiseNot,\n \"no-classes\": noClasses,\n \"no-continue\": noContinue,\n \"no-do-while\": noDoWhile,\n \"no-for-loop\": noForLoop,\n \"no-function-arguments\": noFunctionArguments,\n \"no-generators\": noGenerators,\n \"no-in-operator\": noInOperator,\n \"no-instanceof\": noInstanceof,\n \"no-labeled-statement\": noLabeledStatement,\n \"no-new\": noNew,\n \"no-global-constructor\": noGlobalConstructor,\n \"no-this\": noThis,\n \"no-throw\": noThrow,\n \"no-try\": noTry,\n \"no-update-operators\": noUpdateOperators,\n \"no-while\": noWhile,\n} satisfies Record<string, AppsyncRuleModule>;\n\nexport type AppsyncRuleName = keyof typeof rules;\n\nexport default rules;\n","import { eslintCompatPlugin } from \"@oxlint/plugins\";\nimport rules from \"./rules/index.js\";\n\nconst OPT_IN_RULES = new Set([\"no-appsync-globals\"]);\n\nexport const plugin = eslintCompatPlugin({\n meta: {\n name: \"appsync\",\n },\n rules,\n});\n\nexport const recommended = Object.fromEntries(\n Object.keys(rules)\n .filter((ruleName) => !OPT_IN_RULES.has(ruleName))\n .map((ruleName) => [`appsync/${ruleName}`, \"error\"]),\n) as Record<`appsync/${Exclude<keyof typeof rules, \"no-appsync-globals\">}`, \"error\">;\n\nexport const portable = {\n ...recommended,\n \"appsync/no-appsync-globals\": \"error\",\n} as const;\n","import { plugin, portable, recommended } from \"./plugin.js\";\n\nexport { plugin, portable, recommended };\nexport default plugin;\n"],"mappings":";;AAAA,MAAa,uCAAuB,IAAI,IAAI;CAC1C;CACA;CACA;AACF,CAAC;;;ACAD,SAAgB,kBAAkB,MAA4C;CAC5E,OAAO;AACT;;;ACFA,SAAS,kBAAkB,MAA4B;CACrD,MAAM,SAAS,KAAK;CACpB,IAAI,CAAC,QACH,OAAO;CAGT,IACE,OAAO,SAAS,wBAChB,OAAO,SAAS,yBAChB,OAAO,SAAS,wBAChB,OAAO,SAA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CAAC,aAAa,IAAI,QAAQ,CAAC,CAAC,CACjD,KAAK,aAAa,CAAC,WAAW,YAAY,OAAO,CAAC,CACvD;AAEA,MAAa,WAAW;CACtB,GAAG;CACH,8BAA8B;AAChC;;;AClBA,IAAA,cAAe"}
1
+ {"version":3,"file":"index.js","names":["member","noAppsyncGlobals","noAsyncAwait","noBitwiseNot","noClasses","noContextReassignment","noContinue","noDoWhile","noDisallowedMethods","noForLoop","noFunctionArguments","noFunctionReassign","noFunctionReturn","noGenerators","noInOperator","noInstanceof","noLabeledStatement","noNew","noPromise","noRecursion","noRegex","noGlobalConstructor","noThis","noThrow","noTry","noUpdateOperators","noWhile"],"sources":["../src/lib/appsync-globals.ts","../src/lib/rule-types.ts","../src/rules/no-appsync-globals.ts","../src/lib/utils.ts","../src/rules/no-async-await.ts","../src/rules/no-bitwise-not.ts","../src/rules/no-classes.ts","../src/rules/no-context-reassignment.ts","../src/rules/no-continue.ts","../src/lib/disallowed-methods.ts","../src/lib/function-utils.ts","../src/rules/no-disallowed-methods.ts","../src/rules/no-do-while.ts","../src/rules/no-for-loop.ts","../src/lib/callback-accepting-methods.ts","../src/rules/no-function-arguments.ts","../src/rules/no-function-reassign.ts","../src/rules/no-function-return.ts","../src/rules/no-generators.ts","../src/lib/global-constructors.ts","../src/rules/no-global-constructor.ts","../src/rules/no-in-operator.ts","../src/rules/no-instanceof.ts","../src/rules/no-labeled-statement.ts","../src/rules/no-new.ts","../src/rules/no-promise.ts","../src/rules/no-recursion.ts","../src/rules/no-regex.ts","../src/rules/no-this.ts","../src/rules/no-throw.ts","../src/rules/no-try.ts","../src/rules/no-update-operators.ts","../src/rules/no-while.ts","../src/rules/index.ts","../src/plugin.ts","../src/index.ts"],"sourcesContent":["export const APPSYNC_GLOBAL_NAMES = new Set([\n \"util\",\n \"extensions\",\n \"runtime\",\n]);\n","import type { CreateOnceRule } from \"@oxlint/plugins\";\n\nexport type AppsyncRuleModule = CreateOnceRule;\n\nexport function defineAppsyncRule(rule: AppsyncRuleModule): AppsyncRuleModule {\n return rule;\n}\n","import type { Context, ESTree, Scope } from \"@oxlint/plugins\";\nimport { APPSYNC_GLOBAL_NAMES } from \"../lib/appsync-globals.js\";\nimport { defineAppsyncRule } from \"../lib/rule-types.js\";\n\nfunction isBindingPosition(node: ESTree.Node): boolean {\n const parent = node.parent;\n if (!parent) {\n return false;\n }\n\n if (\n parent.type === \"VariableDeclarator\" ||\n parent.type === \"FunctionDeclaration\" ||\n parent.type === \"FunctionExpression\" ||\n parent.type === \"ClassDeclaration\"\n ) {\n return parent.id === node;\n }\n\n if (\n parent.type === \"ImportSpecifier\" ||\n parent.type === \"ImportDefaultSpecifier\" ||\n parent.type === \"ImportNamespaceSpecifier\"\n ) {\n return parent.local === node;\n }\n\n if (parent.type === \"CatchClause\") {\n return parent.param === node;\n }\n\n return false;\n}\n\nfunction isNonReferencePosition(node: ESTree.Node): boolean {\n const parent = node.parent;\n if (!parent) {\n return false;\n }\n\n if (parent.type === \"Property\" && parent.key === node && !parent.computed) {\n return true;\n }\n\n if (\n parent.type === \"MemberExpression\" &&\n parent.property === node &&\n !parent.computed\n ) {\n return true;\n }\n\n return isBindingPosition(node);\n}\n\nfunction hasLocalBinding(\n node: { name: string },\n context: Context,\n): boolean {\n let scope: Scope | null = context.sourceCode.getScope(\n node as ESTree.IdentifierReference,\n );\n while (scope) {\n const variable = scope.set.get(node.name);\n if (variable && variable.defs.length > 0) {\n return true;\n }\n scope = scope.upper;\n }\n\n return false;\n}\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow AppSync-only globals in code that must run outside the AppSync runtime\",\n },\n messages: {\n default:\n \"AppSync global `{{name}}` is not available outside the AppSync runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n Identifier(node) {\n if (!APPSYNC_GLOBAL_NAMES.has(node.name)) {\n return;\n }\n\n if (isNonReferencePosition(node)) {\n return;\n }\n\n if (hasLocalBinding(node, context)) {\n return;\n }\n\n context.report({\n node,\n messageId: \"default\",\n data: { name: node.name },\n });\n },\n };\n },\n});\n","import type { Context, ESTree } from \"@oxlint/plugins\";\n\ntype NodeWithType = { type: string };\n\nexport function isIdentifier(\n node: NodeWithType | null | undefined,\n name: string,\n): boolean {\n return (\n node?.type === \"Identifier\" &&\n (node as unknown as { name: string }).name === name\n );\n}\n\nexport function reportDefault(\n context: Context,\n node: ESTree.Node,\n messageId = \"default\",\n): void {\n context.report({ node, messageId });\n}\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow async functions and await expressions in AppSync resolvers\",\n },\n messages: {\n default:\n \"Promises and async/await are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n const reportAsyncFunction = (node: { async?: boolean }) => {\n if (node.async) {\n reportDefault(context, node as never);\n }\n };\n\n return {\n AwaitExpression(node) {\n reportDefault(context, node);\n },\n FunctionDeclaration: reportAsyncFunction,\n FunctionExpression: reportAsyncFunction,\n ArrowFunctionExpression: reportAsyncFunction,\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow the bitwise NOT (~) operator in AppSync resolvers\",\n },\n messages: {\n default: \"The ~ operator is not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n UnaryExpression(node) {\n if (node.operator === \"~\") {\n reportDefault(context, node);\n }\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow class declarations and expressions in AppSync resolvers\",\n },\n messages: {\n default: \"Classes are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n ClassDeclaration(node) {\n reportDefault(context, node);\n },\n ClassExpression(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import type { ESTree } from \"@oxlint/plugins\";\nimport { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { isIdentifier, reportDefault } from \"../lib/utils.js\";\n\nfunction isContextAssignmentTarget(node: ESTree.Node): boolean {\n if (isIdentifier(node, \"context\")) {\n return true;\n }\n\n return (\n node.type === \"MemberExpression\" && isIdentifier(node.object, \"context\")\n );\n}\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow reassigning context and its base properties in AppSync resolvers\",\n },\n messages: {\n default:\n \"Reassigning context and base properties of context is not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n AssignmentExpression(node) {\n if (isContextAssignmentTarget(node.left)) {\n reportDefault(context, node.left);\n }\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow continue statements in AppSync resolvers\",\n },\n messages: {\n default: \"continue statements are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n ContinueStatement(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","export const DISALLOWED_METHOD_NAMES = new Set([\"apply\", \"bind\", \"call\"]);\n","import type { Context, Definition, ESTree, Scope } from \"@oxlint/plugins\";\n\ntype FunctionNode = ESTree.Node & {\n type:\n | \"FunctionDeclaration\"\n | \"FunctionExpression\"\n | \"ArrowFunctionExpression\";\n id?: { name: string } | null;\n};\n\nexport function getMemberPropertyName(\n property: ESTree.Node & { type: string },\n): string | null {\n if (property.type === \"Identifier\") {\n return (property as unknown as { name: string }).name;\n }\n\n if (property.type === \"Literal\" && typeof property.value === \"string\") {\n return property.value;\n }\n\n return null;\n}\n\nexport function definitionCreatesFunction(def: Definition): boolean {\n if (def.type === \"FunctionName\") {\n return true;\n }\n\n if (def.type === \"Variable\" && def.node.type === \"VariableDeclarator\") {\n const init = def.node.init;\n if (!init) {\n return false;\n }\n\n return (\n init.type === \"FunctionExpression\" ||\n init.type === \"ArrowFunctionExpression\"\n );\n }\n\n return false;\n}\n\nexport function isFunctionNode(node: ESTree.Node): node is FunctionNode {\n return (\n node.type === \"FunctionDeclaration\" ||\n node.type === \"FunctionExpression\" ||\n node.type === \"ArrowFunctionExpression\"\n );\n}\n\nexport function isFunctionLikeNode(\n node: ESTree.Node,\n context: Context,\n): boolean {\n if (\n node.type === \"FunctionExpression\" ||\n node.type === \"ArrowFunctionExpression\"\n ) {\n return true;\n }\n\n if (node.type !== \"Identifier\") {\n return false;\n }\n\n return variableHoldsFunction(node.name, context, node);\n}\n\nexport function variableHoldsFunction(\n name: string,\n context: Context,\n referenceNode: ESTree.Node,\n): boolean {\n let scope: Scope | null = context.sourceCode.getScope(referenceNode);\n while (scope) {\n const variable = scope.set.get(name);\n if (variable) {\n return variable.defs.some(definitionCreatesFunction);\n }\n scope = scope.upper;\n }\n\n return false;\n}\n","import { DISALLOWED_METHOD_NAMES } from \"../lib/disallowed-methods.js\";\nimport { getMemberPropertyName } from \"../lib/function-utils.js\";\nimport { defineAppsyncRule } from \"../lib/rule-types.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow unsupported method calls such as call, apply, and bind\",\n },\n messages: {\n default:\n \"The {{method}}() method is not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n if (node.callee.type !== \"MemberExpression\") {\n return;\n }\n\n const method = getMemberPropertyName(node.callee.property);\n if (method && DISALLOWED_METHOD_NAMES.has(method)) {\n context.report({\n node,\n messageId: \"default\",\n data: { method },\n });\n }\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow do-while loops in AppSync resolvers\",\n },\n messages: {\n default: \"do-while loops are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n DoWhileStatement(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow C-style for loops in AppSync resolvers (for-in and for-of are allowed)\",\n },\n messages: {\n default:\n \"Only for-in and for-of loops are supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n ForStatement(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","export const CALLBACK_ACCEPTING_METHODS = new Set([\n \"map\",\n \"find\",\n \"filter\",\n \"findIndex\",\n \"findLast\",\n \"findLastIndex\",\n \"forEach\",\n \"reduce\",\n \"reduceRight\",\n \"every\",\n \"some\",\n \"flatMap\",\n]);\n","import type { Context, ESTree, Scope } from \"@oxlint/plugins\";\nimport { CALLBACK_ACCEPTING_METHODS } from \"../lib/callback-accepting-methods.js\";\nimport {\n definitionCreatesFunction,\n getMemberPropertyName,\n} from \"../lib/function-utils.js\";\nimport { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nfunction isCallbackAcceptingCall(callee: ESTree.Node): boolean {\n if (callee.type !== \"MemberExpression\") {\n return false;\n }\n\n const member = callee as\n | ESTree.StaticMemberExpression\n | ESTree.ComputedMemberExpression;\n const propertyName = getMemberPropertyName(member.property);\n return propertyName !== null && CALLBACK_ACCEPTING_METHODS.has(propertyName);\n}\n\nfunction isFunctionLikeArgument(node: ESTree.Node, context: Context): boolean {\n if (\n node.type === \"FunctionExpression\" ||\n node.type === \"ArrowFunctionExpression\"\n ) {\n return true;\n }\n\n if (node.type !== \"Identifier\") {\n return false;\n }\n\n let scope: Scope | null = context.sourceCode.getScope(node);\n while (scope) {\n const variable = scope.set.get(node.name);\n if (variable?.defs.some(definitionCreatesFunction)) {\n return true;\n }\n scope = scope.upper ?? null;\n }\n\n return false;\n}\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow passing functions as call arguments except to allowlisted Array methods\",\n },\n messages: {\n default: \"Functions can not be passed as an argument\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n const allowsCallbacks = isCallbackAcceptingCall(node.callee);\n\n for (const argument of node.arguments) {\n if (argument.type === \"SpreadElement\") {\n continue;\n }\n\n if (argument.type === \"ArrowFunctionExpression\" && allowsCallbacks) {\n continue;\n }\n\n if (isFunctionLikeArgument(argument, context)) {\n reportDefault(context, argument);\n }\n }\n },\n };\n },\n});\n","import { variableHoldsFunction } from \"../lib/function-utils.js\";\nimport { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow reassigning function variables in AppSync resolvers\",\n },\n messages: {\n default: \"Functions cannot be reassigned in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n AssignmentExpression(node) {\n if (node.left.type !== \"Identifier\") {\n return;\n }\n\n if (variableHoldsFunction(node.left.name, context, node.left)) {\n reportDefault(context, node.left);\n }\n },\n };\n },\n});\n","import { isFunctionLikeNode } from \"../lib/function-utils.js\";\nimport { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow returning functions from functions in AppSync resolvers\",\n },\n messages: {\n default:\n \"Functions cannot be the return value of functions in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n ReturnStatement(node) {\n if (!node.argument) {\n return;\n }\n\n if (isFunctionLikeNode(node.argument, context)) {\n reportDefault(context, node.argument);\n }\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow generator functions in AppSync resolvers\",\n },\n messages: {\n default: \"Generators are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n const reportGenerator = (node: { generator?: boolean }) => {\n if (node.generator) {\n reportDefault(context, node as never);\n }\n };\n\n return {\n FunctionDeclaration: reportGenerator,\n FunctionExpression: reportGenerator,\n };\n },\n});\n","export const GLOBAL_CONSTRUCTOR_NAMES = new Set([\n \"String\",\n \"Boolean\",\n \"Number\",\n \"BigInt\",\n \"Symbol\",\n \"Date\",\n \"Object\",\n \"Array\",\n \"Function\",\n \"RegExp\",\n]);\n","import { GLOBAL_CONSTRUCTOR_NAMES } from \"../lib/global-constructors.js\";\nimport { defineAppsyncRule } from \"../lib/rule-types.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow calling global constructor functions in AppSync resolvers\",\n },\n messages: {\n default:\n \"Do not use `{{name}}()` as a constructor in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n if (\n node.callee.type === \"Identifier\" &&\n GLOBAL_CONSTRUCTOR_NAMES.has(node.callee.name)\n ) {\n context.report({\n node,\n messageId: \"default\",\n data: { name: node.callee.name },\n });\n }\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow the in operator in AppSync resolvers\",\n },\n messages: {\n default:\n \"The in operator is not supported in the AppSync JS runtime; use Object.hasOwn instead\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n BinaryExpression(node) {\n if (node.operator === \"in\") {\n reportDefault(context, node);\n }\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow the instanceof operator in AppSync resolvers\",\n },\n messages: {\n default: \"The instanceof operator is not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n BinaryExpression(node) {\n if (node.operator === \"instanceof\") {\n reportDefault(context, node);\n }\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow labeled statements in AppSync resolvers\",\n },\n messages: {\n default: \"Labeled statements are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n LabeledStatement(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow the new operator in AppSync resolvers\",\n },\n messages: {\n default: \"The new operator is not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n NewExpression(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { isIdentifier, reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow Promise usage in AppSync resolvers\",\n },\n messages: {\n default: \"Promises are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n const { callee } = node;\n\n if (\n isIdentifier(callee, \"Promise\") ||\n (callee.type === \"MemberExpression\" &&\n isIdentifier(callee.object, \"Promise\"))\n ) {\n reportDefault(context, node);\n }\n },\n NewExpression(node) {\n if (isIdentifier(node.callee, \"Promise\")) {\n reportDefault(context, node);\n }\n },\n VariableDeclarator(node) {\n if (node.init && isIdentifier(node.init, \"Promise\")) {\n reportDefault(context, node.init);\n }\n },\n AssignmentExpression(node) {\n if (isIdentifier(node.right, \"Promise\")) {\n reportDefault(context, node.right);\n }\n },\n };\n },\n});\n","import type { Context, ESTree } from \"@oxlint/plugins\";\nimport { isFunctionNode } from \"../lib/function-utils.js\";\nimport { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nfunction getEnclosingBindingNames(\n node: ESTree.Node,\n context: Context,\n): Set<string> {\n const names = new Set<string>();\n\n if (\n (node.type === \"FunctionDeclaration\" || node.type === \"FunctionExpression\") &&\n node.id?.type === \"Identifier\"\n ) {\n names.add(node.id.name);\n }\n\n let scope = context.sourceCode.getScope(node).upper;\n while (scope) {\n for (const variable of scope.variables) {\n for (const def of variable.defs) {\n if (\n def.type === \"Variable\" &&\n def.node.type === \"VariableDeclarator\" &&\n def.node.init === node\n ) {\n names.add(variable.name);\n }\n }\n }\n scope = scope.upper;\n }\n\n return names;\n}\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow recursive function calls in AppSync resolvers\",\n },\n messages: {\n default: \"Recursive function calls are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n const enclosingBindingNames: Set<string>[] = [];\n\n const enterFunction = (node: ESTree.Node) => {\n if (!isFunctionNode(node)) {\n return;\n }\n\n enclosingBindingNames.push(getEnclosingBindingNames(node, context));\n };\n\n const exitFunction = (node: ESTree.Node) => {\n if (!isFunctionNode(node)) {\n return;\n }\n\n enclosingBindingNames.pop();\n };\n\n return {\n FunctionDeclaration: enterFunction,\n \"FunctionDeclaration:exit\": exitFunction,\n FunctionExpression: enterFunction,\n \"FunctionExpression:exit\": exitFunction,\n ArrowFunctionExpression: enterFunction,\n \"ArrowFunctionExpression:exit\": exitFunction,\n CallExpression(node) {\n if (node.callee.type !== \"Identifier\") {\n return;\n }\n\n const currentBindings =\n enclosingBindingNames[enclosingBindingNames.length - 1];\n if (currentBindings?.has(node.callee.name)) {\n reportDefault(context, node);\n }\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow regex literals in AppSync resolvers\",\n },\n messages: {\n default: \"Regex literals are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n Literal(node) {\n if (\"regex\" in node && node.regex) {\n reportDefault(context, node);\n }\n },\n RegExpLiteral(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow this expressions in AppSync resolvers\",\n },\n messages: {\n default: \"this is not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n ThisExpression(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow throw statements in AppSync resolvers\",\n },\n messages: {\n default: \"throw statements are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n ThrowStatement(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow try/catch/finally statements in AppSync resolvers\",\n },\n messages: {\n default:\n \"try/catch/finally statements are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n TryStatement(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow ++ and -- operators in AppSync resolvers\",\n },\n messages: {\n default: \"++ and -- operators are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n UpdateExpression(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import { defineAppsyncRule } from \"../lib/rule-types.js\";\nimport { reportDefault } from \"../lib/utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow while loops in AppSync resolvers\",\n },\n messages: {\n default: \"while loops are not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n WhileStatement(node) {\n reportDefault(context, node);\n },\n };\n },\n});\n","import noAppsyncGlobals from \"./no-appsync-globals.js\";\nimport noAsyncAwait from \"./no-async-await.js\";\nimport noBitwiseNot from \"./no-bitwise-not.js\";\nimport noClasses from \"./no-classes.js\";\nimport noContextReassignment from \"./no-context-reassignment.js\";\nimport noContinue from \"./no-continue.js\";\nimport noDisallowedMethods from \"./no-disallowed-methods.js\";\nimport noDoWhile from \"./no-do-while.js\";\nimport noForLoop from \"./no-for-loop.js\";\nimport noFunctionArguments from \"./no-function-arguments.js\";\nimport noFunctionReassign from \"./no-function-reassign.js\";\nimport noFunctionReturn from \"./no-function-return.js\";\nimport noGenerators from \"./no-generators.js\";\nimport noGlobalConstructor from \"./no-global-constructor.js\";\nimport noInOperator from \"./no-in-operator.js\";\nimport noInstanceof from \"./no-instanceof.js\";\nimport noLabeledStatement from \"./no-labeled-statement.js\";\nimport noNew from \"./no-new.js\";\nimport noPromise from \"./no-promise.js\";\nimport noRecursion from \"./no-recursion.js\";\nimport noRegex from \"./no-regex.js\";\nimport noThis from \"./no-this.js\";\nimport noThrow from \"./no-throw.js\";\nimport noTry from \"./no-try.js\";\nimport noUpdateOperators from \"./no-update-operators.js\";\nimport noWhile from \"./no-while.js\";\nimport type { AppsyncRuleModule } from \"../lib/rule-types.js\";\n\nconst rules = {\n \"no-appsync-globals\": noAppsyncGlobals,\n \"no-async-await\": noAsyncAwait,\n \"no-bitwise-not\": noBitwiseNot,\n \"no-classes\": noClasses,\n \"no-context-reassignment\": noContextReassignment,\n \"no-continue\": noContinue,\n \"no-do-while\": noDoWhile,\n \"no-disallowed-methods\": noDisallowedMethods,\n \"no-for-loop\": noForLoop,\n \"no-function-arguments\": noFunctionArguments,\n \"no-function-reassign\": noFunctionReassign,\n \"no-function-return\": noFunctionReturn,\n \"no-generators\": noGenerators,\n \"no-in-operator\": noInOperator,\n \"no-instanceof\": noInstanceof,\n \"no-labeled-statement\": noLabeledStatement,\n \"no-new\": noNew,\n \"no-promise\": noPromise,\n \"no-recursion\": noRecursion,\n \"no-regex\": noRegex,\n \"no-global-constructor\": noGlobalConstructor,\n \"no-this\": noThis,\n \"no-throw\": noThrow,\n \"no-try\": noTry,\n \"no-update-operators\": noUpdateOperators,\n \"no-while\": noWhile,\n} satisfies Record<string, AppsyncRuleModule>;\n\nexport type AppsyncRuleName = keyof typeof rules;\n\nexport default rules;\n","import { eslintCompatPlugin } from \"@oxlint/plugins\";\nimport rules from \"./rules/index.js\";\n\nconst OPT_IN_RULES = new Set([\"no-appsync-globals\"]);\n\nexport const plugin = eslintCompatPlugin({\n meta: {\n name: \"appsync\",\n },\n rules,\n});\n\nexport const recommended = Object.fromEntries(\n Object.keys(rules)\n .filter((ruleName) => !OPT_IN_RULES.has(ruleName))\n .map((ruleName) => [`appsync/${ruleName}`, \"error\"]),\n) as Record<`appsync/${Exclude<keyof typeof rules, \"no-appsync-globals\">}`, \"error\">;\n\nexport const portable = {\n ...recommended,\n \"appsync/no-appsync-globals\": \"error\",\n} as const;\n","import { plugin, portable, recommended } from \"./plugin.js\";\n\nexport { plugin, portable, recommended };\nexport default plugin;\n"],"mappings":";;AAAA,MAAa,uCAAuB,IAAI,IAAI;CAC1C;CACA;CACA;AACF,C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ACJ,aACE,6DACJ;GACA,UAAU,EACR,SACE,2EACJ;GACA,QAAQ,CAAC;EACX;EACA,WAAW,SAAS;GAClB,OAAO,EACL,aAAa,MAAM;IACjB,cAAc,SAAS,IAAI;GAC7B,EACF;EACF;CACF,CG6BYC;CACV,uBFlDa,kBAAkB;EAC/B,MAAM;GACJ,MAAM;GACN,MAAM,EACJ,aAAa,oDACf;GACA,UAAU,EACR,SAAS,kEACX;GACA,QAAQ,CAAC;EACX;EACA,WAAW,SAAS;GAClB,OAAO,EACL,iBAAiB,MAAM;IACrB,cAAc,SAAS,IAAI;GAC7B,EACF;EACF;CACF,CEgCyBC;CACvB,YDnDa,kBAAkB;EAC/B,MAAM;GACJ,MAAM;GACN,MAAM,EACJ,aAAa,4CACf;GACA,UAAU,EACR,SAAS,0DACX;GACA,QAAQ,CAAC;EACX;EACA,WAAW,SAAS;GAClB,OAAO,EACL,eAAe,MAAM;IACnB,cAAc,SAAS,IAAI;GAC7B,EACF;EACF;CACF,CCiCcC;AACd;;;ACpDA,MAAM,+BAAe,IAAI,IAAI,CAAC,oBAAoB,CAAC;AAEnD,MAAa,SAAS,mBAAmB;CACvC,MAAM,EACJ,MAAM,UACR;CACA;AACF,CAAC;AAED,MAAa,cAAc,OAAO,YAChC,OAAO,KAAK,KAAK,CAAC,CACf,QAAQ,aAAa,CAAC,aAAa,IAAI,QAAQ,CAAC,CAAC,CACjD,KAAK,aAAa,CAAC,WAAW,YAAY,OAAO,CAAC,CACvD;AAEA,MAAa,WAAW;CACtB,GAAG;CACH,8BAA8B;AAChC;;;AClBA,IAAA,cAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-appsync",
3
- "version": "0.3.1",
3
+ "version": "0.4.1",
4
4
  "description": "Oxlint plugin that enforces AWS AppSync JavaScript runtime restrictions",
5
5
  "type": "module",
6
6
  "license": "MIT",