oxlint-appsync 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -56,7 +56,7 @@ export default [
56
56
 
57
57
  | Rule | Description |
58
58
  | --- | --- |
59
- | `appsync/no-string-constructor` | Disallow `String()` for stringification |
59
+ | `appsync/no-global-constructor` | Disallow global constructor calls (`String()`, `Number()`, `Boolean()`, `Date()`, etc.) |
60
60
  | `appsync/no-async-await` | Disallow `async`/`await` and async functions |
61
61
  | `appsync/no-classes` | Disallow `class` declarations and expressions |
62
62
  | `appsync/no-instanceof` | Disallow `instanceof` |
@@ -73,7 +73,13 @@ export default [
73
73
  | `appsync/no-update-operators` | Disallow `++` and `--` |
74
74
  | `appsync/no-bitwise-not` | Disallow bitwise NOT (`~`) |
75
75
  | `appsync/no-in-operator` | Disallow `in` (use `Object.hasOwn`) |
76
- | `appsync/no-function-arguments` | Disallow passing functions as call arguments |
76
+ | `appsync/no-function-arguments` | Disallow passing function references as call arguments (inline arrow callbacks are allowed) |
77
+
78
+ ## Migration
79
+
80
+ ### 0.1.x → 0.2.0
81
+
82
+ `appsync/no-string-constructor` was removed. Use `appsync/no-global-constructor` instead — it covers `String()` and other global constructor calls (`Boolean()`, `Number()`, `Date()`, etc.).
77
83
 
78
84
  ## Development
79
85
 
package/dist/index.d.ts CHANGED
@@ -21,7 +21,7 @@ declare const rules: {
21
21
  "no-instanceof": AppsyncRuleModule;
22
22
  "no-labeled-statement": AppsyncRuleModule;
23
23
  "no-new": AppsyncRuleModule;
24
- "no-string-constructor": AppsyncRuleModule;
24
+ "no-global-constructor": AppsyncRuleModule;
25
25
  "no-this": AppsyncRuleModule;
26
26
  "no-throw": AppsyncRuleModule;
27
27
  "no-try": AppsyncRuleModule;
package/dist/index.js CHANGED
@@ -5,9 +5,6 @@ function defineAppsyncRule(rule) {
5
5
  }
6
6
  //#endregion
7
7
  //#region src/rules/utils.ts
8
- function isIdentifier(node, name) {
9
- return node?.type === "Identifier" && node.name === name;
10
- }
11
8
  function reportDefault(context, node, messageId = "default") {
12
9
  context.report({
13
10
  node,
@@ -119,14 +116,93 @@ var no_for_loop_default = defineAppsyncRule({
119
116
  });
120
117
  //#endregion
121
118
  //#region src/rules/no-function-arguments.ts
122
- const FUNCTION_ARGUMENT_TYPES = /* @__PURE__ */ new Set([
123
- "FunctionDeclaration",
124
- "FunctionExpression",
125
- "ArrowFunctionExpression"
126
- ]);
127
- function isFunctionArgument(node) {
128
- return FUNCTION_ARGUMENT_TYPES.has(node.type);
119
+ function definitionCreatesFunction(def) {
120
+ if (def.type === "FunctionName") return true;
121
+ if (def.type === "Variable" && def.node.type === "VariableDeclarator") {
122
+ const init = def.node.init;
123
+ if (!init) return false;
124
+ return init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression";
125
+ }
126
+ return false;
127
+ }
128
+ function isFunctionReference(node, context) {
129
+ if (node.type === "FunctionExpression") return true;
130
+ if (node.type !== "Identifier") return false;
131
+ let scope = context.sourceCode.getScope(node);
132
+ while (scope) {
133
+ if (scope.set.get(node.name)?.defs.some(definitionCreatesFunction)) return true;
134
+ scope = scope.upper;
135
+ }
136
+ return false;
129
137
  }
138
+ var no_function_arguments_default = defineAppsyncRule({
139
+ meta: {
140
+ 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" },
143
+ schema: []
144
+ },
145
+ createOnce(context) {
146
+ return { CallExpression(node) {
147
+ for (const argument of node.arguments) {
148
+ if (argument.type === "SpreadElement") continue;
149
+ if (isFunctionReference(argument, context)) reportDefault(context, argument);
150
+ }
151
+ } };
152
+ }
153
+ });
154
+ //#endregion
155
+ //#region src/rules/no-generators.ts
156
+ var no_generators_default = defineAppsyncRule({
157
+ meta: {
158
+ type: "problem",
159
+ docs: { description: "Disallow generator functions in AppSync resolvers" },
160
+ messages: { default: "Generators are not supported in the AppSync JS runtime" },
161
+ schema: []
162
+ },
163
+ createOnce(context) {
164
+ const reportGenerator = (node) => {
165
+ if (node.generator) reportDefault(context, node);
166
+ };
167
+ return {
168
+ FunctionDeclaration: reportGenerator,
169
+ FunctionExpression: reportGenerator
170
+ };
171
+ }
172
+ });
173
+ //#endregion
174
+ //#region src/rules/global-constructors.ts
175
+ const GLOBAL_CONSTRUCTOR_NAMES = /* @__PURE__ */ new Set([
176
+ "String",
177
+ "Boolean",
178
+ "Number",
179
+ "BigInt",
180
+ "Symbol",
181
+ "Date",
182
+ "Object",
183
+ "Array",
184
+ "Function",
185
+ "RegExp"
186
+ ]);
187
+ //#endregion
188
+ //#region src/rules/no-global-constructor.ts
189
+ var no_global_constructor_default = defineAppsyncRule({
190
+ meta: {
191
+ type: "problem",
192
+ docs: { description: "Disallow calling global constructor functions in AppSync resolvers" },
193
+ messages: { default: "Do not use `{{name}}()` as a constructor in the AppSync JS runtime" },
194
+ schema: []
195
+ },
196
+ createOnce(context) {
197
+ return { CallExpression(node) {
198
+ if (node.callee.type === "Identifier" && GLOBAL_CONSTRUCTOR_NAMES.has(node.callee.name)) context.report({
199
+ node,
200
+ messageId: "default",
201
+ data: { name: node.callee.name }
202
+ });
203
+ } };
204
+ }
205
+ });
130
206
  //#endregion
131
207
  //#region src/rules/index.ts
132
208
  const rules = {
@@ -136,36 +212,8 @@ const rules = {
136
212
  "no-continue": no_continue_default,
137
213
  "no-do-while": no_do_while_default,
138
214
  "no-for-loop": no_for_loop_default,
139
- "no-function-arguments": defineAppsyncRule({
140
- meta: {
141
- type: "problem",
142
- docs: { description: "Disallow passing functions as call arguments in AppSync resolvers" },
143
- messages: { default: "Passing functions as arguments is not supported in the AppSync JS runtime" },
144
- schema: []
145
- },
146
- createOnce(context) {
147
- return { CallExpression(node) {
148
- for (const argument of node.arguments) if (argument.type !== "SpreadElement" && isFunctionArgument(argument)) reportDefault(context, argument);
149
- } };
150
- }
151
- }),
152
- "no-generators": defineAppsyncRule({
153
- meta: {
154
- type: "problem",
155
- docs: { description: "Disallow generator functions in AppSync resolvers" },
156
- messages: { default: "Generators are not supported in the AppSync JS runtime" },
157
- schema: []
158
- },
159
- createOnce(context) {
160
- const reportGenerator = (node) => {
161
- if (node.generator) reportDefault(context, node);
162
- };
163
- return {
164
- FunctionDeclaration: reportGenerator,
165
- FunctionExpression: reportGenerator
166
- };
167
- }
168
- }),
215
+ "no-function-arguments": no_function_arguments_default,
216
+ "no-generators": no_generators_default,
169
217
  "no-in-operator": defineAppsyncRule({
170
218
  meta: {
171
219
  type: "problem",
@@ -218,24 +266,7 @@ const rules = {
218
266
  } };
219
267
  }
220
268
  }),
221
- "no-string-constructor": defineAppsyncRule({
222
- meta: {
223
- type: "problem",
224
- docs: { description: "Disallow using String() to stringify values in AppSync resolvers" },
225
- messages: { default: "Do not use String() to stringify variables in the AppSync JS runtime" },
226
- schema: []
227
- },
228
- createOnce(context) {
229
- return {
230
- CallExpression(node) {
231
- if (isIdentifier(node.callee, "String")) reportDefault(context, node);
232
- },
233
- NewExpression(node) {
234
- if (isIdentifier(node.callee, "String")) reportDefault(context, node);
235
- }
236
- };
237
- }
238
- }),
269
+ "no-global-constructor": no_global_constructor_default,
239
270
  "no-this": defineAppsyncRule({
240
271
  meta: {
241
272
  type: "problem",
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","noStringConstructor","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/no-in-operator.ts","../src/rules/no-instanceof.ts","../src/rules/no-labeled-statement.ts","../src/rules/no-new.ts","../src/rules/no-string-constructor.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\nconst FUNCTION_ARGUMENT_TYPES = new Set([\n \"FunctionDeclaration\",\n \"FunctionExpression\",\n \"ArrowFunctionExpression\",\n]);\n\nfunction isFunctionArgument(node: Rule.Node): boolean {\n return FUNCTION_ARGUMENT_TYPES.has(node.type);\n}\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow passing functions as call arguments in AppSync resolvers\",\n },\n messages: {\n default:\n \"Passing functions as arguments is not supported in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n for (const argument of node.arguments) {\n if (argument.type !== \"SpreadElement\" && isFunctionArgument(argument)) {\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","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 { isIdentifier, reportDefault } from \"./utils.js\";\n\nexport default defineAppsyncRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow using String() to stringify values in AppSync resolvers\",\n },\n messages: {\n default:\n \"Do not use String() to stringify variables in the AppSync JS runtime\",\n },\n schema: [],\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n if (isIdentifier(node.callee, \"String\")) {\n reportDefault(context, node);\n }\n },\n NewExpression(node) {\n if (isIdentifier(node.callee, \"String\")) {\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 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 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 noStringConstructor from \"./no-string-constructor.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-string-constructor\": noStringConstructor,\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;;;ACLA,SAAgB,aACd,MACA,MACS;CACT,OAAO,MAAM,SAAS,gBAAiB,KAA0B,SAAS;AAC5E;AAEA,SAAgB,cACd,SACA,MACA,YAAY,WACN;CACN,QAAQ,OAAO;EAAE;EAA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;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":["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,M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f;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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-appsync",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Oxlint plugin that enforces AWS AppSync JavaScript runtime restrictions",
5
5
  "type": "module",
6
6
  "license": "MIT",