oxlint-appsync 0.2.0 → 0.3.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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Oxlint (and ESLint-compatible) plugin that enforces [AWS AppSync JavaScript runtime restrictions](https://docs.aws.amazon.com/appsync/latest/devguide/supported-features.html).
4
4
 
5
- Use it to catch unsupported syntax in AppSync resolver code before deployment. See [docs/code-generation-appsync.md](docs/code-generation-appsync.md) for the project-specific summary of limitations.
5
+ Use it to catch unsupported syntax in AppSync resolver code before deployment.
6
6
 
7
7
  ## Install
8
8
 
@@ -22,11 +22,17 @@ Copy [oxlintrc.example.json](oxlintrc.example.json) to `.oxlintrc.json` in your
22
22
 
23
23
  ```ts
24
24
  import { defineConfig } from "oxlint";
25
- import plugin, { recommended } from "oxlint-appsync";
25
+ import plugin, { portable, recommended } from "oxlint-appsync";
26
26
 
27
27
  export default defineConfig({
28
28
  jsPlugins: [plugin],
29
29
  rules: recommended,
30
+ overrides: [
31
+ {
32
+ files: ["src/shared/**/*.js"],
33
+ rules: portable,
34
+ },
35
+ ],
30
36
  });
31
37
  ```
32
38
 
@@ -42,58 +48,79 @@ The plugin uses Oxlint's `createOnce` API wrapped with `eslintCompatPlugin`, so
42
48
 
43
49
  ```js
44
50
  import appsync from "oxlint-appsync";
45
- import { recommended } from "oxlint-appsync";
51
+ import { portable, recommended } from "oxlint-appsync";
46
52
 
47
53
  export default [
48
54
  {
49
55
  plugins: { appsync },
50
56
  rules: recommended,
51
57
  },
58
+ {
59
+ files: ["src/shared/**/*.js"],
60
+ rules: portable,
61
+ },
52
62
  ];
53
63
  ```
54
64
 
65
+ ## Config presets
66
+
67
+ | Preset | Use for |
68
+ | ------------- | ----------------------------------------------------------------------------------------------------------------- |
69
+ | `recommended` | AppSync resolver entry points — all syntax rules enabled |
70
+ | `portable` | Shared modules that must run in AppSync and other runtimes (e.g. Lambda) — syntax rules plus `no-appsync-globals` |
71
+
55
72
  ## Rules
56
73
 
57
- | Rule | Description |
58
- | --- | --- |
59
- | `appsync/no-global-constructor` | Disallow global constructor calls (`String()`, `Number()`, `Boolean()`, `Date()`, etc.) |
60
- | `appsync/no-async-await` | Disallow `async`/`await` and async functions |
61
- | `appsync/no-classes` | Disallow `class` declarations and expressions |
62
- | `appsync/no-instanceof` | Disallow `instanceof` |
63
- | `appsync/no-for-loop` | Disallow C-style `for` loops (`for-in` / `for-of` allowed) |
64
- | `appsync/no-while` | Disallow `while` loops |
65
- | `appsync/no-do-while` | Disallow `do-while` loops |
66
- | `appsync/no-try` | Disallow `try`/`catch`/`finally` |
67
- | `appsync/no-throw` | Disallow `throw` |
68
- | `appsync/no-continue` | Disallow `continue` |
69
- | `appsync/no-labeled-statement` | Disallow labeled statements |
70
- | `appsync/no-new` | Disallow the `new` operator |
71
- | `appsync/no-generators` | Disallow generator functions |
72
- | `appsync/no-this` | Disallow `this` |
73
- | `appsync/no-update-operators` | Disallow `++` and `--` |
74
- | `appsync/no-bitwise-not` | Disallow bitwise NOT (`~`) |
75
- | `appsync/no-in-operator` | Disallow `in` (use `Object.hasOwn`) |
76
- | `appsync/no-function-arguments` | Disallow passing function references as call arguments (inline arrow callbacks are allowed) |
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` |
77
95
 
78
96
  ## Migration
79
97
 
98
+ ### 0.3.0 → 0.3.1
99
+
100
+ `appsync/no-function-arguments` now matches AWS `no-function-passing` more closely:
101
+
102
+ - Inline arrow functions are allowed only on allowlisted `Array` methods (`map`, `filter`, `find`, `some`, `every`, `reduce`, and similar).
103
+ - `Array.prototype.sort()` with a comparator (inline or by reference) is reported.
104
+ - Passing arrow functions to non-allowlisted calls (e.g. `run(() => 1)`) is reported.
105
+
80
106
  ### 0.1.x → 0.2.0
81
107
 
82
108
  `appsync/no-string-constructor` was removed. Use `appsync/no-global-constructor` instead — it covers `String()` and other global constructor calls (`Boolean()`, `Number()`, `Date()`, etc.).
83
109
 
84
110
  ## Development
85
111
 
112
+ Requires [Bun](https://bun.sh/).
113
+
86
114
  ```bash
87
- npm install
88
- npm run build
89
- npm test
115
+ bun install
116
+ bun run build
117
+ bun test
90
118
  ```
91
119
 
92
120
  ## References
93
121
 
94
122
  - [Writing Oxlint JS plugins](https://oxc.rs/docs/guide/usage/linter/writing-js-plugins.html)
95
123
  - [AWS AppSync supported runtime features](https://docs.aws.amazon.com/appsync/latest/devguide/supported-features.html)
96
- - [Project AppSync code generation rules](docs/code-generation-appsync.md)
97
124
 
98
125
  ## License
99
126
 
package/dist/index.d.ts CHANGED
@@ -1,39 +1,54 @@
1
1
  import * as _oxlint_plugins0 from "@oxlint/plugins";
2
- import { Rule } from "eslint";
3
2
 
4
- //#region src/rules/types.d.ts
5
- type AppsyncRuleModule = {
6
- meta: Rule.RuleMetaData;
7
- createOnce: (context: Rule.RuleContext) => Rule.RuleListener;
8
- };
9
- //#endregion
10
3
  //#region src/rules/index.d.ts
11
4
  declare const rules: {
12
- "no-async-await": AppsyncRuleModule;
13
- "no-bitwise-not": AppsyncRuleModule;
14
- "no-classes": AppsyncRuleModule;
15
- "no-continue": AppsyncRuleModule;
16
- "no-do-while": AppsyncRuleModule;
17
- "no-for-loop": AppsyncRuleModule;
18
- "no-function-arguments": AppsyncRuleModule;
19
- "no-generators": AppsyncRuleModule;
20
- "no-in-operator": AppsyncRuleModule;
21
- "no-instanceof": AppsyncRuleModule;
22
- "no-labeled-statement": AppsyncRuleModule;
23
- "no-new": AppsyncRuleModule;
24
- "no-global-constructor": AppsyncRuleModule;
25
- "no-this": AppsyncRuleModule;
26
- "no-throw": AppsyncRuleModule;
27
- "no-try": AppsyncRuleModule;
28
- "no-update-operators": AppsyncRuleModule;
29
- "no-while": AppsyncRuleModule;
5
+ "no-appsync-globals": _oxlint_plugins0.CreateOnceRule;
6
+ "no-async-await": _oxlint_plugins0.CreateOnceRule;
7
+ "no-bitwise-not": _oxlint_plugins0.CreateOnceRule;
8
+ "no-classes": _oxlint_plugins0.CreateOnceRule;
9
+ "no-continue": _oxlint_plugins0.CreateOnceRule;
10
+ "no-do-while": _oxlint_plugins0.CreateOnceRule;
11
+ "no-for-loop": _oxlint_plugins0.CreateOnceRule;
12
+ "no-function-arguments": _oxlint_plugins0.CreateOnceRule;
13
+ "no-generators": _oxlint_plugins0.CreateOnceRule;
14
+ "no-in-operator": _oxlint_plugins0.CreateOnceRule;
15
+ "no-instanceof": _oxlint_plugins0.CreateOnceRule;
16
+ "no-labeled-statement": _oxlint_plugins0.CreateOnceRule;
17
+ "no-new": _oxlint_plugins0.CreateOnceRule;
18
+ "no-global-constructor": _oxlint_plugins0.CreateOnceRule;
19
+ "no-this": _oxlint_plugins0.CreateOnceRule;
20
+ "no-throw": _oxlint_plugins0.CreateOnceRule;
21
+ "no-try": _oxlint_plugins0.CreateOnceRule;
22
+ "no-update-operators": _oxlint_plugins0.CreateOnceRule;
23
+ "no-while": _oxlint_plugins0.CreateOnceRule;
30
24
  };
31
25
  //#endregion
32
26
  //#region src/plugin.d.ts
33
27
  declare const plugin: _oxlint_plugins0.Plugin;
34
- declare const recommended: Record<`appsync/${keyof typeof rules}`, "error">;
28
+ declare const recommended: Record<`appsync/${Exclude<keyof typeof rules, "no-appsync-globals">}`, "error">;
29
+ declare const portable: {
30
+ readonly "appsync/no-appsync-globals": "error";
31
+ readonly "appsync/no-async-await": "error";
32
+ readonly "appsync/no-bitwise-not": "error";
33
+ readonly "appsync/no-classes": "error";
34
+ readonly "appsync/no-continue": "error";
35
+ readonly "appsync/no-do-while": "error";
36
+ readonly "appsync/no-for-loop": "error";
37
+ readonly "appsync/no-function-arguments": "error";
38
+ readonly "appsync/no-generators": "error";
39
+ readonly "appsync/no-in-operator": "error";
40
+ readonly "appsync/no-instanceof": "error";
41
+ readonly "appsync/no-labeled-statement": "error";
42
+ readonly "appsync/no-new": "error";
43
+ readonly "appsync/no-global-constructor": "error";
44
+ readonly "appsync/no-this": "error";
45
+ readonly "appsync/no-throw": "error";
46
+ readonly "appsync/no-try": "error";
47
+ readonly "appsync/no-update-operators": "error";
48
+ readonly "appsync/no-while": "error";
49
+ };
35
50
  //# sourceMappingURL=plugin.d.ts.map
36
51
 
37
52
  //#endregion
38
- export { plugin as default, plugin, recommended };
53
+ export { plugin as default, plugin, portable, recommended };
39
54
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/rules/types.ts","../src/rules/index.ts","../src/plugin.ts"],"mappings":";;;;KAEY,iBAAA;QACJ,IAAA,CAAK;wBACW,IAAA,CAAK,gBAAgB,IAAA,CAAK;AAFlD,CAAA;;;cCkBM;;;EDlBM,YAAA,mBAAiB;EAAA,aAAA,mBAAA;eAChB,mBAAA;eACgB,mBAAA;yBAAqB,mBAAA;EAAY,eAAA,mBAAA;;;;ECgBxD,QAmBuC,mBAAA;EAAA,uBAAA,mBAAA;;;;;;;;;cCpChC,QAKX,gBAAA,CALiB;cAON,aAER,+BAA+B"}
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"}
package/dist/index.js CHANGED
@@ -1,9 +1,62 @@
1
1
  import { eslintCompatPlugin } from "@oxlint/plugins";
2
+ //#region src/rules/appsync-globals.ts
3
+ const APPSYNC_GLOBAL_NAMES = /* @__PURE__ */ new Set([
4
+ "util",
5
+ "extensions",
6
+ "runtime"
7
+ ]);
8
+ //#endregion
2
9
  //#region src/rules/types.ts
3
10
  function defineAppsyncRule(rule) {
4
11
  return rule;
5
12
  }
6
13
  //#endregion
14
+ //#region src/rules/no-appsync-globals.ts
15
+ function isBindingPosition(node) {
16
+ const parent = node.parent;
17
+ if (!parent) return false;
18
+ if (parent.type === "VariableDeclarator" || parent.type === "FunctionDeclaration" || parent.type === "FunctionExpression" || parent.type === "ClassDeclaration") return parent.id === node;
19
+ if (parent.type === "ImportSpecifier" || parent.type === "ImportDefaultSpecifier" || parent.type === "ImportNamespaceSpecifier") return parent.local === node;
20
+ if (parent.type === "CatchClause") return parent.param === node;
21
+ return false;
22
+ }
23
+ function isNonReferencePosition(node) {
24
+ const parent = node.parent;
25
+ if (!parent) return false;
26
+ if (parent.type === "Property" && parent.key === node && !parent.computed) return true;
27
+ if (parent.type === "MemberExpression" && parent.property === node && !parent.computed) return true;
28
+ return isBindingPosition(node);
29
+ }
30
+ function hasLocalBinding(node, context) {
31
+ let scope = context.sourceCode.getScope(node);
32
+ while (scope) {
33
+ const variable = scope.set.get(node.name);
34
+ if (variable && variable.defs.length > 0) return true;
35
+ scope = scope.upper;
36
+ }
37
+ return false;
38
+ }
39
+ var no_appsync_globals_default = defineAppsyncRule({
40
+ meta: {
41
+ type: "problem",
42
+ docs: { description: "Disallow AppSync-only globals in code that must run outside the AppSync runtime" },
43
+ messages: { default: "AppSync global `{{name}}` is not available outside the AppSync runtime" },
44
+ schema: []
45
+ },
46
+ createOnce(context) {
47
+ return { Identifier(node) {
48
+ if (!APPSYNC_GLOBAL_NAMES.has(node.name)) return;
49
+ if (isNonReferencePosition(node)) return;
50
+ if (hasLocalBinding(node, context)) return;
51
+ context.report({
52
+ node,
53
+ messageId: "default",
54
+ data: { name: node.name }
55
+ });
56
+ } };
57
+ }
58
+ });
59
+ //#endregion
7
60
  //#region src/rules/utils.ts
8
61
  function reportDefault(context, node, messageId = "default") {
9
62
  context.report({
@@ -116,6 +169,30 @@ var no_for_loop_default = defineAppsyncRule({
116
169
  });
117
170
  //#endregion
118
171
  //#region src/rules/no-function-arguments.ts
172
+ const CALLBACK_ACCEPTING_METHODS = /* @__PURE__ */ new Set([
173
+ "map",
174
+ "find",
175
+ "filter",
176
+ "findIndex",
177
+ "findLast",
178
+ "findLastIndex",
179
+ "forEach",
180
+ "reduce",
181
+ "reduceRight",
182
+ "every",
183
+ "some",
184
+ "flatMap"
185
+ ]);
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
+ }
191
+ function isCallbackAcceptingCall(callee) {
192
+ if (callee.type !== "MemberExpression") return false;
193
+ const propertyName = getMemberPropertyName(callee.property);
194
+ return propertyName !== null && CALLBACK_ACCEPTING_METHODS.has(propertyName);
195
+ }
119
196
  function definitionCreatesFunction(def) {
120
197
  if (def.type === "FunctionName") return true;
121
198
  if (def.type === "Variable" && def.node.type === "VariableDeclarator") {
@@ -125,8 +202,8 @@ function definitionCreatesFunction(def) {
125
202
  }
126
203
  return false;
127
204
  }
128
- function isFunctionReference(node, context) {
129
- if (node.type === "FunctionExpression") return true;
205
+ function isFunctionLikeArgument(node, context) {
206
+ if (node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") return true;
130
207
  if (node.type !== "Identifier") return false;
131
208
  let scope = context.sourceCode.getScope(node);
132
209
  while (scope) {
@@ -138,15 +215,17 @@ function isFunctionReference(node, context) {
138
215
  var no_function_arguments_default = defineAppsyncRule({
139
216
  meta: {
140
217
  type: "problem",
141
- docs: { description: "Disallow passing function references as call arguments in AppSync resolvers" },
142
- messages: { default: "Passing a function reference as an argument is not supported in the AppSync JS runtime; use an inline arrow function instead" },
218
+ docs: { description: "Disallow passing functions as call arguments except to allowlisted Array methods" },
219
+ messages: { default: "Functions can not be passed as an argument" },
143
220
  schema: []
144
221
  },
145
222
  createOnce(context) {
146
223
  return { CallExpression(node) {
224
+ const allowsCallbacks = isCallbackAcceptingCall(node.callee);
147
225
  for (const argument of node.arguments) {
148
226
  if (argument.type === "SpreadElement") continue;
149
- if (isFunctionReference(argument, context)) reportDefault(context, argument);
227
+ if (argument.type === "ArrowFunctionExpression" && allowsCallbacks) continue;
228
+ if (isFunctionLikeArgument(argument, context)) reportDefault(context, argument);
150
229
  }
151
230
  } };
152
231
  }
@@ -206,6 +285,7 @@ var no_global_constructor_default = defineAppsyncRule({
206
285
  //#endregion
207
286
  //#region src/rules/index.ts
208
287
  const rules = {
288
+ "no-appsync-globals": no_appsync_globals_default,
209
289
  "no-async-await": no_async_await_default,
210
290
  "no-bitwise-not": no_bitwise_not_default,
211
291
  "no-classes": no_classes_default,
@@ -335,15 +415,20 @@ const rules = {
335
415
  };
336
416
  //#endregion
337
417
  //#region src/plugin.ts
418
+ const OPT_IN_RULES = /* @__PURE__ */ new Set(["no-appsync-globals"]);
338
419
  const plugin = eslintCompatPlugin({
339
420
  meta: { name: "appsync" },
340
421
  rules
341
422
  });
342
- const recommended = Object.fromEntries(Object.keys(rules).map((ruleName) => [`appsync/${ruleName}`, "error"]));
423
+ const recommended = Object.fromEntries(Object.keys(rules).filter((ruleName) => !OPT_IN_RULES.has(ruleName)).map((ruleName) => [`appsync/${ruleName}`, "error"]));
424
+ const portable = {
425
+ ...recommended,
426
+ "appsync/no-appsync-globals": "error"
427
+ };
343
428
  //#endregion
344
429
  //#region src/index.ts
345
430
  var src_default = plugin;
346
431
  //#endregion
347
- export { src_default as default, plugin, recommended };
432
+ export { src_default as default, plugin, portable, recommended };
348
433
 
349
434
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["noAsyncAwait","noBitwiseNot","noClasses","noContinue","noDoWhile","noForLoop","noFunctionArguments","noGenerators","noInOperator","noInstanceof","noLabeledStatement","noNew","noGlobalConstructor","noThis","noThrow","noTry","noUpdateOperators","noWhile"],"sources":["../src/rules/types.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":["import type { Rule } from \"eslint\";\n\nexport type AppsyncRuleModule = {\n meta: Rule.RuleMetaData;\n createOnce: (context: Rule.RuleContext) => Rule.RuleListener;\n};\n\nexport function defineAppsyncRule(rule: AppsyncRuleModule): AppsyncRuleModule {\n return rule;\n}\n","import type { Rule } from \"eslint\";\n\ntype NodeWithType = { type: string };\n\nexport function isIdentifier(\n node: NodeWithType | null | undefined,\n name: string,\n): boolean {\n return node?.type === \"Identifier\" && (node as { name: string }).name === name;\n}\n\nexport function reportDefault(\n context: Rule.RuleContext,\n node: Rule.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 { Rule } from \"eslint\";\nimport { defineAppsyncRule } from \"./types.js\";\nimport { reportDefault } from \"./utils.js\";\n\nfunction definitionCreatesFunction(def: Rule.Scope.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 isFunctionReference(\n node: Rule.Node,\n context: Rule.RuleContext,\n): boolean {\n if (node.type === \"FunctionExpression\") {\n return true;\n }\n\n if (node.type !== \"Identifier\") {\n return false;\n }\n\n let scope: Rule.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 function references as call arguments in AppSync resolvers\",\n },\n messages: {\n default:\n \"Passing a function reference as an argument is not supported in the AppSync JS runtime; use an inline arrow function instead\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n for (const argument of node.arguments) {\n if (argument.type === \"SpreadElement\") {\n continue;\n }\n\n if (isFunctionReference(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 { defineAppsyncRule } from \"./types.js\";\nimport { GLOBAL_CONSTRUCTOR_NAMES } from \"./global-constructors.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 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-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\nexport const plugin = eslintCompatPlugin({\n meta: {\n name: \"appsync\",\n },\n rules,\n});\n\nexport const recommended = Object.fromEntries(\n Object.keys(rules).map((ruleName) => [`appsync/${ruleName}`, \"error\"]),\n) as Record<`appsync/${keyof typeof rules}`, \"error\">;\n","import { plugin, recommended } from \"./plugin.js\";\n\nexport { plugin, recommended };\nexport default plugin;\n"],"mappings":";;AAOA,SAAgB,kBAAkB,MAA4C;CAC5E,OAAO;AACT;;;ACEA,SAAgB,cACd,SACA,MACA,YAAY,WACN;CACN,QAAQ,OAAO;EAAE;EAAM;CAAU,CAAC;AACpC;;;ACdA,IAAA,yBAAe,kBAAkB;CAC/B,MAAM;EACJ,MAAM;EACN,MAAM,EACJ,aACE,sEACJ;EACA,UAAU,EACR,SACE,uEACJ;EACA,QAAQ,CAAC;CACX;CACA,WAAW,SAAS;EAClB,MAAM,uBAAuB,SAA8B;GACzD,IAAI,KAAK,OACP,cAAc,SAAS,IAAa;EAExC;EAEA,OAAO;GACL,gBAAgB,MAAM;IACpB,cAAc,SAAS,IAAI;GAC7B;GACA,qBAAqB;GACrB,oBAAoB;GACpB,yBAAyB;EAC3B;CACF;AACF,CAAC;;;AC7BD,IAAA,yBAAe,kBAAkB;CAC/B,MAAM;EACJ,MAAM;EACN,MAAM,EACJ,aAAa,6DACf;EACA,UAAU,EACR,SAAS,4DACX;EACA,QAAQ,CAAC;CACX;CACA,WAAW,SAAS;EAClB,OAAO,EACL,gBAAgB,MAAM;GACpB,IAAI,KAAK,aAAa,KACpB,cAAc,SAAS,IAAI;EAE/B,EACF;CACF;AACF,CAAC;;;ACpBD,IAAA,qBAAe,kBAAkB;CAC/B,MAAM;EACJ,MAAM;EACN,MAAM,EACJ,aAAa,mEACf;EACA,UAAU,EACR,SAAS,sDACX;EACA,QAAQ,CAAC;CACX;CACA,WAAW,SAAS;EAClB,OAAO;GACL,iBAAiB,MAAM;IACrB,cAAc,SAAS,IAAI;GAC7B;GACA,gBAAgB,MAAM;IACpB,cAAc,SAAS,IAAI;GAC7B;EACF;CACF;AACF,CAAC;;;ACrBD,IAAA,sBAAe,kBAAkB;CAC/B,MAAM;EACJ,MAAM;EACN,MAAM,EACJ,aAAa,oDACf;EACA,UAAU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EACA,WAAW,SAAS;GAClB,OAAO,EACL,eAAe,MAAM;IACnB,cAAc,SAAS,IAAI;GAC7B,EACF;EACF;CACF,CIccC;CACZ,UHjCa,kBAAkB;EAC/B,MAAM;GACJ,MAAM;GACN,MAAM,EACJ,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,CGaYC;CACV,uBFlCa,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,CEgByBC;CACvB,YDnCa,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,CCiBcC;AACd;;;ACpCA,MAAa,SAAS,mBAAmB;CACvC,MAAM,EACJ,MAAM,UACR;CACA;AACF,CAAC;AAED,MAAa,cAAc,OAAO,YAChC,OAAO,KAAK,KAAK,CAAC,CAAC,KAAK,aAAa,CAAC,WAAW,YAAY,OAAO,CAAC,CACvE;;;ACTA,IAAA,cAAe"}
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,SAAS,oBAEhB,OAAO,OAAO,OAAO;CAGvB,IACE,OAAO,SAAS,qBAChB,OAAO,SAAS,4BAChB,OAAO,SAAS,4BAEhB,OAAO,OAAO,UAAU;CAG1B,IAAI,OAAO,SAAS,eAClB,OAAO,OAAO,UAAU;CAG1B,OAAO;AACT;AAEA,SAAS,uBAAuB,MAA4B;CAC1D,MAAM,SAAS,KAAK;CACpB,IAAI,CAAC,QACH,OAAO;CAGT,IAAI,OAAO,SAAS,cAAc,OAAO,QAAQ,QAAQ,CAAC,OAAO,UAC/D,OAAO;CAGT,IACE,OAAO,SAAS,sBAChB,OAAO,aAAa,QACpB,CAAC,OAAO,UAER,OAAO;CAGT,OAAO,kBAAkB,IAAI;AAC/B;AAEA,SAAS,gBACP,MACA,SACS;CACT,IAAI,QAAsB,QAAQ,WAAW,SAC3C,IACF;CACA,OAAO,OAAO;EACZ,MAAM,WAAW,MAAM,IAAI,IAAI,KAAK,IAAI;EACxC,IAAI,YAAY,SAAS,KAAK,SAAS,GACrC,OAAO;EAET,QAAQ,MAAM;CAChB;CAEA,OAAO;AACT;AAEA,IAAA,6BAAe,kBAAkB;CAC/B,MA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,SAAS;GAClB,OAAO,EACL,iBAAiB,MAAM;IACrB,cAAc,SAAS,IAAI;GAC7B,EACF;EACF;CACF,CEkByBC;CACvB,YDrCa,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,CCmBcC;AACd;;;ACtCA,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.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Oxlint plugin that enforces AWS AppSync JavaScript runtime restrictions",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -31,11 +31,13 @@
31
31
  },
32
32
  "scripts": {
33
33
  "build": "tsdown",
34
- "prepublishOnly": "npm test",
35
- "test": "npm run build && vitest run",
34
+ "prepublishOnly": "bun run test",
35
+ "test": "bun run build && vitest run",
36
36
  "test:unit": "vitest run tests/rules",
37
- "lint": "oxlint src tests/helpers tests/smoke.test.ts vitest.config.ts tsdown.config.ts"
37
+ "lint": "oxlint src tests/helpers tests/smoke.test.ts vitest.config.ts tsdown.config.ts",
38
+ "typecheck": "tsc --noEmit"
38
39
  },
40
+ "packageManager": "bun@1.3.12",
39
41
  "dependencies": {
40
42
  "@oxlint/plugins": "^1.42.0"
41
43
  },