@stardeck-customer-apps/eslint-plugin 1.0.1 → 1.1.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/dist/index.cjs CHANGED
@@ -65,9 +65,57 @@ var rule = {
65
65
  };
66
66
  var no_template_literal_classname_default = rule;
67
67
 
68
+ // src/rules/no-kysely-interactive-transaction.ts
69
+ var rule2 = {
70
+ meta: {
71
+ type: "problem",
72
+ docs: {
73
+ description: "Disallow Kysely interactive transactions, which throw at runtime on the Neon HTTP driver used by data stores",
74
+ recommended: true
75
+ },
76
+ messages: {
77
+ noInteractiveTransaction: "The Neon HTTP driver used by data stores doesn't support interactive transactions, so `.transaction().execute(...)` throws at runtime. Combine the statements into a single query (e.g. a CTE via `db.with(...)`) or run them sequentially instead.",
78
+ noControlledTransaction: "The Neon HTTP driver used by data stores doesn't support controlled transactions, so `.startTransaction().execute()` throws at runtime. Combine the statements into a single query (e.g. a CTE via `db.with(...)`) or run them sequentially instead."
79
+ },
80
+ schema: []
81
+ },
82
+ create(context) {
83
+ return {
84
+ CallExpression(node) {
85
+ const callee = node.callee;
86
+ if (callee.type !== "MemberExpression") {
87
+ return;
88
+ }
89
+ const property = callee.property;
90
+ if (property.type !== "Identifier") {
91
+ return;
92
+ }
93
+ if (property.name !== "transaction" && property.name !== "startTransaction") {
94
+ return;
95
+ }
96
+ if (property.name === "startTransaction" && node.arguments.length === 0) {
97
+ context.report({
98
+ node,
99
+ messageId: "noControlledTransaction"
100
+ });
101
+ return;
102
+ }
103
+ if (property.name === "transaction" && node.arguments.length === 0) {
104
+ context.report({
105
+ node,
106
+ messageId: "noInteractiveTransaction"
107
+ });
108
+ }
109
+ }
110
+ };
111
+ }
112
+ };
113
+ var no_kysely_interactive_transaction_default = rule2;
114
+
68
115
  // src/rules/index.ts
69
116
  var rules = {
70
- "no-template-literal-classname": no_template_literal_classname_default
117
+ "no-template-literal-classname": no_template_literal_classname_default,
118
+ "no-kysely-interactive-transaction": no_kysely_interactive_transaction_default
71
119
  };
72
120
 
73
121
  // src/configs/recommended.ts
@@ -79,7 +127,8 @@ var recommended = {
79
127
  }
80
128
  },
81
129
  rules: {
82
- [`${pluginName}/no-template-literal-classname`]: "error"
130
+ [`${pluginName}/no-template-literal-classname`]: "error",
131
+ [`${pluginName}/no-kysely-interactive-transaction`]: "error"
83
132
  }
84
133
  };
85
134
 
package/dist/index.d.cts CHANGED
@@ -1,20 +1,13 @@
1
1
  import * as eslint from 'eslint';
2
+ import { Linter, ESLint } from 'eslint';
2
3
 
3
4
  declare const rules: {
4
5
  "no-template-literal-classname": eslint.Rule.RuleModule;
6
+ "no-kysely-interactive-transaction": eslint.Rule.RuleModule;
5
7
  };
6
8
 
7
- declare const configs: {
8
- recommended: eslint.Linter.Config<eslint.Linter.RulesRecord>;
9
- };
9
+ declare const configs: Record<string, Linter.Config>;
10
10
 
11
- declare const plugin: {
12
- rules: {
13
- "no-template-literal-classname": eslint.Rule.RuleModule;
14
- };
15
- configs: {
16
- recommended: eslint.Linter.Config<eslint.Linter.RulesRecord>;
17
- };
18
- };
11
+ declare const plugin: ESLint.Plugin;
19
12
 
20
13
  export { configs, plugin as default, rules };
package/dist/index.d.ts CHANGED
@@ -1,20 +1,13 @@
1
1
  import * as eslint from 'eslint';
2
+ import { Linter, ESLint } from 'eslint';
2
3
 
3
4
  declare const rules: {
4
5
  "no-template-literal-classname": eslint.Rule.RuleModule;
6
+ "no-kysely-interactive-transaction": eslint.Rule.RuleModule;
5
7
  };
6
8
 
7
- declare const configs: {
8
- recommended: eslint.Linter.Config<eslint.Linter.RulesRecord>;
9
- };
9
+ declare const configs: Record<string, Linter.Config>;
10
10
 
11
- declare const plugin: {
12
- rules: {
13
- "no-template-literal-classname": eslint.Rule.RuleModule;
14
- };
15
- configs: {
16
- recommended: eslint.Linter.Config<eslint.Linter.RulesRecord>;
17
- };
18
- };
11
+ declare const plugin: ESLint.Plugin;
19
12
 
20
13
  export { configs, plugin as default, rules };
package/dist/index.js CHANGED
@@ -37,9 +37,57 @@ var rule = {
37
37
  };
38
38
  var no_template_literal_classname_default = rule;
39
39
 
40
+ // src/rules/no-kysely-interactive-transaction.ts
41
+ var rule2 = {
42
+ meta: {
43
+ type: "problem",
44
+ docs: {
45
+ description: "Disallow Kysely interactive transactions, which throw at runtime on the Neon HTTP driver used by data stores",
46
+ recommended: true
47
+ },
48
+ messages: {
49
+ noInteractiveTransaction: "The Neon HTTP driver used by data stores doesn't support interactive transactions, so `.transaction().execute(...)` throws at runtime. Combine the statements into a single query (e.g. a CTE via `db.with(...)`) or run them sequentially instead.",
50
+ noControlledTransaction: "The Neon HTTP driver used by data stores doesn't support controlled transactions, so `.startTransaction().execute()` throws at runtime. Combine the statements into a single query (e.g. a CTE via `db.with(...)`) or run them sequentially instead."
51
+ },
52
+ schema: []
53
+ },
54
+ create(context) {
55
+ return {
56
+ CallExpression(node) {
57
+ const callee = node.callee;
58
+ if (callee.type !== "MemberExpression") {
59
+ return;
60
+ }
61
+ const property = callee.property;
62
+ if (property.type !== "Identifier") {
63
+ return;
64
+ }
65
+ if (property.name !== "transaction" && property.name !== "startTransaction") {
66
+ return;
67
+ }
68
+ if (property.name === "startTransaction" && node.arguments.length === 0) {
69
+ context.report({
70
+ node,
71
+ messageId: "noControlledTransaction"
72
+ });
73
+ return;
74
+ }
75
+ if (property.name === "transaction" && node.arguments.length === 0) {
76
+ context.report({
77
+ node,
78
+ messageId: "noInteractiveTransaction"
79
+ });
80
+ }
81
+ }
82
+ };
83
+ }
84
+ };
85
+ var no_kysely_interactive_transaction_default = rule2;
86
+
40
87
  // src/rules/index.ts
41
88
  var rules = {
42
- "no-template-literal-classname": no_template_literal_classname_default
89
+ "no-template-literal-classname": no_template_literal_classname_default,
90
+ "no-kysely-interactive-transaction": no_kysely_interactive_transaction_default
43
91
  };
44
92
 
45
93
  // src/configs/recommended.ts
@@ -51,7 +99,8 @@ var recommended = {
51
99
  }
52
100
  },
53
101
  rules: {
54
- [`${pluginName}/no-template-literal-classname`]: "error"
102
+ [`${pluginName}/no-template-literal-classname`]: "error",
103
+ [`${pluginName}/no-kysely-interactive-transaction`]: "error"
55
104
  }
56
105
  };
57
106
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stardeck-customer-apps/eslint-plugin",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Custom ESLint rules for Stardeck customer apps",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -25,6 +25,7 @@
25
25
  "build": "tsup src/index.ts --format esm,cjs --dts",
26
26
  "dev": "tsup src/index.ts --format esm,cjs --dts --watch",
27
27
  "typecheck": "tsc --noEmit",
28
+ "test": "vitest run",
28
29
  "format": "prettier --write . && eslint . --fix",
29
30
  "lint": "eslint src/"
30
31
  },