@voltlaunchrr/eslint-plugin 0.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.
Files changed (35) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +22 -0
  3. package/dist/ast.d.ts +7 -0
  4. package/dist/ast.js +77 -0
  5. package/dist/create-rule.d.ts +4 -0
  6. package/dist/create-rule.js +2 -0
  7. package/dist/index.d.ts +30 -0
  8. package/dist/index.js +48 -0
  9. package/dist/manifest.d.ts +30 -0
  10. package/dist/manifest.js +103 -0
  11. package/dist/rules/manifest-title-description-quality.d.ts +4 -0
  12. package/dist/rules/manifest-title-description-quality.js +67 -0
  13. package/dist/rules/manifest-valid-permissions.d.ts +3 -0
  14. package/dist/rules/manifest-valid-permissions.js +41 -0
  15. package/dist/rules/no-broad-system-action.d.ts +3 -0
  16. package/dist/rules/no-broad-system-action.js +30 -0
  17. package/dist/rules/no-secret-in-storage.d.ts +3 -0
  18. package/dist/rules/no-secret-in-storage.js +85 -0
  19. package/dist/rules/no-tauri-api-import.d.ts +3 -0
  20. package/dist/rules/no-tauri-api-import.js +67 -0
  21. package/dist/rules/no-unsafe-open-url.d.ts +3 -0
  22. package/dist/rules/no-unsafe-open-url.js +74 -0
  23. package/dist/rules/prefer-hud-for-silent-action.d.ts +3 -0
  24. package/dist/rules/prefer-hud-for-silent-action.js +71 -0
  25. package/dist/rules/require-manifest-permission.d.ts +4 -0
  26. package/dist/rules/require-manifest-permission.js +116 -0
  27. package/docs/rules/manifest-title-description-quality.md +3 -0
  28. package/docs/rules/manifest-valid-permissions.md +3 -0
  29. package/docs/rules/no-broad-system-action.md +3 -0
  30. package/docs/rules/no-secret-in-storage.md +3 -0
  31. package/docs/rules/no-tauri-api-import.md +3 -0
  32. package/docs/rules/no-unsafe-open-url.md +3 -0
  33. package/docs/rules/prefer-hud-for-silent-action.md +3 -0
  34. package/docs/rules/require-manifest-permission.md +3 -0
  35. package/package.json +47 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to the Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by the Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding any notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. Please also get an in-touch
186
+ with us so we can add your project to our list of projects
187
+ using the Apache License.
188
+
189
+ Copyright 2026 VoltLaunchr Contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # Volt ESLint Plugin
2
+
3
+ Rules for Volt extension authors.
4
+
5
+ ```js
6
+ import volt from "@voltlaunchrr/eslint-plugin";
7
+
8
+ export default [
9
+ ...volt.configs.recommended,
10
+ ];
11
+ ```
12
+
13
+ ## Rules
14
+
15
+ - `@voltlaunchrr/no-tauri-api-import`
16
+ - `@voltlaunchrr/require-manifest-permission`
17
+ - `@voltlaunchrr/no-secret-in-storage`
18
+ - `@voltlaunchrr/no-unsafe-open-url`
19
+ - `@voltlaunchrr/no-broad-system-action`
20
+ - `@voltlaunchrr/prefer-hud-for-silent-action`
21
+ - `@voltlaunchrr/manifest-valid-permissions`
22
+ - `@voltlaunchrr/manifest-title-description-quality`
package/dist/ast.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { type TSESTree } from '@typescript-eslint/utils';
2
+ export declare function getStaticPropertyName(node: TSESTree.Node): string | null;
3
+ export declare function getMemberPath(node: TSESTree.Node): string[] | null;
4
+ export declare function getCallPath(node: TSESTree.CallExpression): string[] | null;
5
+ export declare function pathStartsWith(path: readonly string[], prefix: readonly string[]): boolean;
6
+ export declare function isIdentifierLike(node: TSESTree.Node, pattern: RegExp): boolean;
7
+ export declare function containsCallPath(node: TSESTree.Node, predicate: (path: readonly string[]) => boolean): boolean;
package/dist/ast.js ADDED
@@ -0,0 +1,77 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ export function getStaticPropertyName(node) {
3
+ if (node.type === AST_NODE_TYPES.Identifier) {
4
+ return node.name;
5
+ }
6
+ if (node.type === AST_NODE_TYPES.Literal && typeof node.value === 'string') {
7
+ return node.value;
8
+ }
9
+ return null;
10
+ }
11
+ export function getMemberPath(node) {
12
+ if (node.type === AST_NODE_TYPES.Identifier) {
13
+ return [node.name];
14
+ }
15
+ if (node.type !== AST_NODE_TYPES.MemberExpression) {
16
+ return null;
17
+ }
18
+ const objectPath = getMemberPath(node.object);
19
+ if (!objectPath) {
20
+ return null;
21
+ }
22
+ const propertyName = getStaticPropertyName(node.property);
23
+ if (!propertyName) {
24
+ return null;
25
+ }
26
+ return [...objectPath, propertyName];
27
+ }
28
+ export function getCallPath(node) {
29
+ return getMemberPath(node.callee);
30
+ }
31
+ export function pathStartsWith(path, prefix) {
32
+ return prefix.every((part, index) => path[index] === part);
33
+ }
34
+ export function isIdentifierLike(node, pattern) {
35
+ if (node.type === AST_NODE_TYPES.Identifier) {
36
+ return pattern.test(node.name);
37
+ }
38
+ if (node.type === AST_NODE_TYPES.MemberExpression) {
39
+ const path = getMemberPath(node);
40
+ return path ? pattern.test(path.join('.')) : false;
41
+ }
42
+ return false;
43
+ }
44
+ export function containsCallPath(node, predicate) {
45
+ if (node.type === AST_NODE_TYPES.CallExpression) {
46
+ const path = getCallPath(node);
47
+ if (path && predicate(path)) {
48
+ return true;
49
+ }
50
+ }
51
+ for (const [key, value] of Object.entries(node)) {
52
+ if (key === 'parent' || key === 'loc' || key === 'range' || key === 'tokens' || key === 'comments') {
53
+ continue;
54
+ }
55
+ if (!value) {
56
+ continue;
57
+ }
58
+ if (Array.isArray(value)) {
59
+ for (const item of value) {
60
+ if (isNode(item) && containsCallPath(item, predicate)) {
61
+ return true;
62
+ }
63
+ }
64
+ continue;
65
+ }
66
+ if (isNode(value) && containsCallPath(value, predicate)) {
67
+ return true;
68
+ }
69
+ }
70
+ return false;
71
+ }
72
+ function isNode(value) {
73
+ return (typeof value === 'object' &&
74
+ value !== null &&
75
+ 'type' in value &&
76
+ typeof value.type === 'string');
77
+ }
@@ -0,0 +1,4 @@
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+ export declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, unknown>>) => ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener> & {
3
+ name: string;
4
+ };
@@ -0,0 +1,2 @@
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+ export const createRule = ESLintUtils.RuleCreator((name) => `https://github.com/VoltLaunchr/Volt/tree/dev/packages/eslint-plugin/docs/rules/${name}.md`);
@@ -0,0 +1,30 @@
1
+ import type { TSESLint } from '@typescript-eslint/utils';
2
+ declare const rules: {
3
+ 'no-tauri-api-import': TSESLint.RuleModule<"forbidden", [], unknown, TSESLint.RuleListener> & {
4
+ name: string;
5
+ };
6
+ 'require-manifest-permission': TSESLint.RuleModule<"missing" | "manifestMissing", [import("./manifest.js").ManifestRuleOptions?], unknown, TSESLint.RuleListener> & {
7
+ name: string;
8
+ };
9
+ 'no-secret-in-storage': TSESLint.RuleModule<"secret", [], unknown, TSESLint.RuleListener> & {
10
+ name: string;
11
+ };
12
+ 'no-unsafe-open-url': TSESLint.RuleModule<"unsafe", [], unknown, TSESLint.RuleListener> & {
13
+ name: string;
14
+ };
15
+ 'no-broad-system-action': TSESLint.RuleModule<"confirm", [], unknown, TSESLint.RuleListener> & {
16
+ name: string;
17
+ };
18
+ 'prefer-hud-for-silent-action': TSESLint.RuleModule<"hud", [], unknown, TSESLint.RuleListener> & {
19
+ name: string;
20
+ };
21
+ 'manifest-valid-permissions': TSESLint.RuleModule<"invalid", [], unknown, TSESLint.RuleListener> & {
22
+ name: string;
23
+ };
24
+ 'manifest-title-description-quality': TSESLint.RuleModule<"genericName" | "emptyDescription" | "badCasing", [], unknown, TSESLint.RuleListener> & {
25
+ name: string;
26
+ };
27
+ };
28
+ declare const plugin: TSESLint.FlatConfig.Plugin;
29
+ export default plugin;
30
+ export { rules };
package/dist/index.js ADDED
@@ -0,0 +1,48 @@
1
+ import { manifestTitleDescriptionQuality } from './rules/manifest-title-description-quality.js';
2
+ import { manifestValidPermissions } from './rules/manifest-valid-permissions.js';
3
+ import { noBroadSystemAction } from './rules/no-broad-system-action.js';
4
+ import { noSecretInStorage } from './rules/no-secret-in-storage.js';
5
+ import { noTauriApiImport } from './rules/no-tauri-api-import.js';
6
+ import { noUnsafeOpenUrl } from './rules/no-unsafe-open-url.js';
7
+ import { preferHudForSilentAction } from './rules/prefer-hud-for-silent-action.js';
8
+ import { requireManifestPermission } from './rules/require-manifest-permission.js';
9
+ const rules = {
10
+ 'no-tauri-api-import': noTauriApiImport,
11
+ 'require-manifest-permission': requireManifestPermission,
12
+ 'no-secret-in-storage': noSecretInStorage,
13
+ 'no-unsafe-open-url': noUnsafeOpenUrl,
14
+ 'no-broad-system-action': noBroadSystemAction,
15
+ 'prefer-hud-for-silent-action': preferHudForSilentAction,
16
+ 'manifest-valid-permissions': manifestValidPermissions,
17
+ 'manifest-title-description-quality': manifestTitleDescriptionQuality,
18
+ };
19
+ const plugin = {
20
+ meta: {
21
+ name: '@voltlaunchrr/eslint-plugin',
22
+ namespace: '@voltlaunchrr',
23
+ version: '0.1.0',
24
+ },
25
+ rules,
26
+ configs: {},
27
+ };
28
+ plugin.configs = {
29
+ recommended: [
30
+ {
31
+ plugins: {
32
+ '@voltlaunchrr': plugin,
33
+ },
34
+ rules: {
35
+ '@voltlaunchrr/no-tauri-api-import': 'error',
36
+ '@voltlaunchrr/require-manifest-permission': 'error',
37
+ '@voltlaunchrr/no-secret-in-storage': 'error',
38
+ '@voltlaunchrr/no-unsafe-open-url': 'warn',
39
+ '@voltlaunchrr/no-broad-system-action': 'warn',
40
+ '@voltlaunchrr/prefer-hud-for-silent-action': 'warn',
41
+ '@voltlaunchrr/manifest-valid-permissions': 'error',
42
+ '@voltlaunchrr/manifest-title-description-quality': 'warn',
43
+ },
44
+ },
45
+ ],
46
+ };
47
+ export default plugin;
48
+ export { rules };
@@ -0,0 +1,30 @@
1
+ export declare const allowedPermissions: readonly ["clipboard", "network", "notifications", "openUrl", "oauth", "ai", "system"];
2
+ export type VoltPermission = (typeof allowedPermissions)[number];
3
+ export interface ManifestData {
4
+ readonly name?: string | undefined;
5
+ readonly title?: string | undefined;
6
+ readonly description?: string | undefined;
7
+ readonly permissions: readonly string[];
8
+ readonly commands: readonly ManifestCommand[];
9
+ }
10
+ export interface ManifestCommand {
11
+ readonly name?: string | undefined;
12
+ readonly title?: string | undefined;
13
+ readonly description?: string | undefined;
14
+ }
15
+ export interface ManifestRuleOptions {
16
+ readonly manifestPath?: string;
17
+ readonly manifest?: {
18
+ readonly permissions?: readonly string[];
19
+ };
20
+ }
21
+ interface RuleContextWithFile {
22
+ readonly cwd: string;
23
+ readonly filename: string;
24
+ }
25
+ export declare function isAllowedPermission(permission: string): permission is VoltPermission;
26
+ export declare function isManifestFile(filename: string): boolean;
27
+ export declare function parseManifestText(text: string): ManifestData | null;
28
+ export declare function readManifestForRule(context: RuleContextWithFile, options: ManifestRuleOptions | undefined): ManifestData | null;
29
+ export declare function getDeclaredPermissions(context: RuleContextWithFile, options: ManifestRuleOptions | undefined): ReadonlySet<string> | null;
30
+ export {};
@@ -0,0 +1,103 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ export const allowedPermissions = [
4
+ 'clipboard',
5
+ 'network',
6
+ 'notifications',
7
+ 'openUrl',
8
+ 'oauth',
9
+ 'ai',
10
+ 'system',
11
+ ];
12
+ const manifestCache = new Map();
13
+ export function isAllowedPermission(permission) {
14
+ return allowedPermissions.includes(permission);
15
+ }
16
+ export function isManifestFile(filename) {
17
+ return normalizePath(filename).endsWith('/manifest.json');
18
+ }
19
+ export function parseManifestText(text) {
20
+ try {
21
+ const parsed = JSON.parse(text);
22
+ if (!isRecord(parsed)) {
23
+ return null;
24
+ }
25
+ const permissions = Array.isArray(parsed.permissions)
26
+ ? parsed.permissions.filter((permission) => typeof permission === 'string')
27
+ : [];
28
+ const commands = Array.isArray(parsed.commands)
29
+ ? parsed.commands.filter(isRecord).map((command) => ({
30
+ name: typeof command.name === 'string' ? command.name : undefined,
31
+ title: typeof command.title === 'string' ? command.title : undefined,
32
+ description: typeof command.description === 'string' ? command.description : undefined,
33
+ }))
34
+ : [];
35
+ return {
36
+ name: typeof parsed.name === 'string' ? parsed.name : undefined,
37
+ title: typeof parsed.title === 'string' ? parsed.title : undefined,
38
+ description: typeof parsed.description === 'string' ? parsed.description : undefined,
39
+ permissions,
40
+ commands,
41
+ };
42
+ }
43
+ catch {
44
+ return null;
45
+ }
46
+ }
47
+ export function readManifestForRule(context, options) {
48
+ if (options?.manifest) {
49
+ return {
50
+ permissions: options.manifest.permissions ?? [],
51
+ commands: [],
52
+ };
53
+ }
54
+ const configuredPath = options?.manifestPath;
55
+ if (configuredPath) {
56
+ const absolutePath = path.isAbsolute(configuredPath)
57
+ ? configuredPath
58
+ : path.resolve(context.cwd, configuredPath);
59
+ return readManifestFile(absolutePath);
60
+ }
61
+ return findNearestManifest(context.filename);
62
+ }
63
+ export function getDeclaredPermissions(context, options) {
64
+ const manifest = readManifestForRule(context, options);
65
+ return manifest ? new Set(manifest.permissions) : null;
66
+ }
67
+ function findNearestManifest(filename) {
68
+ if (filename === '<input>' || filename.startsWith('<')) {
69
+ return null;
70
+ }
71
+ let current = path.dirname(filename);
72
+ const root = path.parse(current).root;
73
+ while (current && current !== root) {
74
+ const candidate = path.join(current, 'manifest.json');
75
+ if (fs.existsSync(candidate)) {
76
+ return readManifestFile(candidate);
77
+ }
78
+ current = path.dirname(current);
79
+ }
80
+ return null;
81
+ }
82
+ function readManifestFile(filename) {
83
+ const cached = manifestCache.get(filename);
84
+ if (cached !== undefined) {
85
+ return cached;
86
+ }
87
+ try {
88
+ const text = fs.readFileSync(filename, 'utf8');
89
+ const parsed = parseManifestText(text);
90
+ manifestCache.set(filename, parsed);
91
+ return parsed;
92
+ }
93
+ catch {
94
+ manifestCache.set(filename, null);
95
+ return null;
96
+ }
97
+ }
98
+ function normalizePath(filename) {
99
+ return filename.replace(/\\/g, '/');
100
+ }
101
+ function isRecord(value) {
102
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
103
+ }
@@ -0,0 +1,4 @@
1
+ import type { TSESLint } from '@typescript-eslint/utils';
2
+ export declare const manifestTitleDescriptionQuality: TSESLint.RuleModule<"genericName" | "emptyDescription" | "badCasing", [], unknown, TSESLint.RuleListener> & {
3
+ name: string;
4
+ };
@@ -0,0 +1,67 @@
1
+ import { createRule } from '../create-rule.js';
2
+ import { isManifestFile, parseManifestText } from '../manifest.js';
3
+ const genericNamePattern = /^(extension|plugin|tool|utility|app|my extension|new extension|test|demo|sample|untitled)$/i;
4
+ export const manifestTitleDescriptionQuality = createRule({
5
+ name: 'manifest-title-description-quality',
6
+ meta: {
7
+ type: 'suggestion',
8
+ docs: {
9
+ description: 'Flag generic Volt extension names, weak titles, and empty descriptions.',
10
+ },
11
+ messages: {
12
+ genericName: 'Manifest {{field}} "{{value}}" is too generic for the Volt extension store.',
13
+ emptyDescription: 'Manifest description should be specific and non-empty.',
14
+ badCasing: 'Manifest {{field}} "{{value}}" should use readable title casing, not snake_case, kebab-case, or all lowercase.',
15
+ },
16
+ schema: [],
17
+ },
18
+ defaultOptions: [],
19
+ create(context) {
20
+ return {
21
+ Program(node) {
22
+ if (!isManifestFile(context.filename)) {
23
+ return;
24
+ }
25
+ const manifest = parseManifestText(context.sourceCode.getText());
26
+ if (!manifest) {
27
+ return;
28
+ }
29
+ const topLevelName = manifest.title ?? manifest.name;
30
+ if (topLevelName) {
31
+ reportWeakLabel(context, node, 'name', topLevelName);
32
+ }
33
+ if (!manifest.description || manifest.description.trim().length < 12) {
34
+ context.report({ node, messageId: 'emptyDescription' });
35
+ }
36
+ for (const command of manifest.commands) {
37
+ if (command.title) {
38
+ reportWeakLabel(context, node, 'command title', command.title);
39
+ }
40
+ }
41
+ },
42
+ };
43
+ },
44
+ });
45
+ function reportWeakLabel(context, node, field, value) {
46
+ const trimmed = value.trim();
47
+ if (genericNamePattern.test(trimmed)) {
48
+ context.report({
49
+ node,
50
+ messageId: 'genericName',
51
+ data: { field, value: trimmed },
52
+ });
53
+ return;
54
+ }
55
+ if (hasBadCasing(trimmed)) {
56
+ context.report({
57
+ node,
58
+ messageId: 'badCasing',
59
+ data: { field, value: trimmed },
60
+ });
61
+ }
62
+ }
63
+ function hasBadCasing(value) {
64
+ return (value.includes('_') ||
65
+ value.includes('-') ||
66
+ (/^[a-z\s]+$/.test(value) && value.split(/\s+/).filter(Boolean).length > 1));
67
+ }
@@ -0,0 +1,3 @@
1
+ export declare const manifestValidPermissions: import("@typescript-eslint/utils/ts-eslint").RuleModule<"invalid", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
2
+ name: string;
3
+ };
@@ -0,0 +1,41 @@
1
+ import { createRule } from '../create-rule.js';
2
+ import { allowedPermissions, isAllowedPermission, isManifestFile, parseManifestText, } from '../manifest.js';
3
+ export const manifestValidPermissions = createRule({
4
+ name: 'manifest-valid-permissions',
5
+ meta: {
6
+ type: 'problem',
7
+ docs: {
8
+ description: 'Validate Volt extension manifest permissions.',
9
+ },
10
+ messages: {
11
+ invalid: 'Invalid Volt extension permission "{{permission}}". Allowed permissions: {{allowed}}.',
12
+ },
13
+ schema: [],
14
+ },
15
+ defaultOptions: [],
16
+ create(context) {
17
+ return {
18
+ Program(node) {
19
+ if (!isManifestFile(context.filename)) {
20
+ return;
21
+ }
22
+ const manifest = parseManifestText(context.sourceCode.getText());
23
+ if (!manifest) {
24
+ return;
25
+ }
26
+ for (const permission of manifest.permissions) {
27
+ if (!isAllowedPermission(permission)) {
28
+ context.report({
29
+ node,
30
+ messageId: 'invalid',
31
+ data: {
32
+ permission,
33
+ allowed: allowedPermissions.join(', '),
34
+ },
35
+ });
36
+ }
37
+ }
38
+ },
39
+ };
40
+ },
41
+ });
@@ -0,0 +1,3 @@
1
+ export declare const noBroadSystemAction: import("@typescript-eslint/utils/ts-eslint").RuleModule<"confirm", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
2
+ name: string;
3
+ };
@@ -0,0 +1,30 @@
1
+ import { getCallPath, pathStartsWith } from '../ast.js';
2
+ import { createRule } from '../create-rule.js';
3
+ export const noBroadSystemAction = createRule({
4
+ name: 'no-broad-system-action',
5
+ meta: {
6
+ type: 'suggestion',
7
+ docs: {
8
+ description: 'Require confirmation before broad or destructive system actions.',
9
+ },
10
+ messages: {
11
+ confirm: 'Call VoltAPI.confirm before VoltAPI.system.moveToTrash.',
12
+ },
13
+ schema: [],
14
+ },
15
+ defaultOptions: [],
16
+ create(context) {
17
+ return {
18
+ CallExpression(node) {
19
+ const path = getCallPath(node);
20
+ if (!pathStartsWith(path ?? [], ['VoltAPI', 'system', 'moveToTrash'])) {
21
+ return;
22
+ }
23
+ const textBeforeCall = context.sourceCode.getText().slice(0, node.range[0]);
24
+ if (!/\bVoltAPI\.confirm\s*\(/.test(textBeforeCall)) {
25
+ context.report({ node, messageId: 'confirm' });
26
+ }
27
+ },
28
+ };
29
+ },
30
+ });
@@ -0,0 +1,3 @@
1
+ export declare const noSecretInStorage: import("@typescript-eslint/utils/ts-eslint").RuleModule<"secret", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
2
+ name: string;
3
+ };
@@ -0,0 +1,85 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ import { getCallPath, isIdentifierLike, pathStartsWith } from '../ast.js';
3
+ import { createRule } from '../create-rule.js';
4
+ const secretPattern = /api[_-]?key|token|secret|password|passwd|bearer|jwt|credential|client[_-]?secret|access[_-]?token|refresh[_-]?token|auth/i;
5
+ export const noSecretInStorage = createRule({
6
+ name: 'no-secret-in-storage',
7
+ meta: {
8
+ type: 'problem',
9
+ docs: {
10
+ description: 'Disallow storing API keys and tokens in plain extension storage.',
11
+ },
12
+ messages: {
13
+ secret: 'Do not store secrets in localStorage, sessionStorage, or VoltAPI.storage. Use VoltAPI.secrets or a secret preference.',
14
+ },
15
+ schema: [],
16
+ },
17
+ defaultOptions: [],
18
+ create(context) {
19
+ function reportIfSecret(node, values) {
20
+ if (values.some(isSecretLikeNode)) {
21
+ context.report({ node, messageId: 'secret' });
22
+ }
23
+ }
24
+ return {
25
+ CallExpression(node) {
26
+ const path = getCallPath(node);
27
+ if (!path) {
28
+ return;
29
+ }
30
+ const isPlainStorageSet = pathStartsWith(path, ['localStorage', 'setItem']) ||
31
+ pathStartsWith(path, ['sessionStorage', 'setItem']) ||
32
+ pathStartsWith(path, ['VoltAPI', 'storage', 'set']);
33
+ if (isPlainStorageSet) {
34
+ reportIfSecret(node, node.arguments.filter(isExpression));
35
+ }
36
+ },
37
+ AssignmentExpression(node) {
38
+ const leftPath = getCallPathLike(node.left);
39
+ if (!leftPath) {
40
+ return;
41
+ }
42
+ if (leftPath[0] === 'localStorage' || leftPath[0] === 'sessionStorage') {
43
+ reportIfSecret(node, [node.left, node.right]);
44
+ }
45
+ },
46
+ };
47
+ },
48
+ });
49
+ function isSecretLikeNode(node) {
50
+ if (node.type === AST_NODE_TYPES.Literal && typeof node.value === 'string') {
51
+ return secretPattern.test(node.value);
52
+ }
53
+ if (node.type === AST_NODE_TYPES.TemplateLiteral) {
54
+ return node.quasis.some((quasi) => secretPattern.test(quasi.value.raw));
55
+ }
56
+ return isIdentifierLike(node, secretPattern);
57
+ }
58
+ function isExpression(node) {
59
+ return node.type !== AST_NODE_TYPES.SpreadElement;
60
+ }
61
+ function getCallPathLike(node) {
62
+ if (node.type !== AST_NODE_TYPES.MemberExpression) {
63
+ return null;
64
+ }
65
+ const parts = [];
66
+ let current = node;
67
+ while (current.type === AST_NODE_TYPES.MemberExpression) {
68
+ const property = current.property;
69
+ if (property.type === AST_NODE_TYPES.Identifier) {
70
+ parts.unshift(property.name);
71
+ }
72
+ else if (property.type === AST_NODE_TYPES.Literal && typeof property.value === 'string') {
73
+ parts.unshift(property.value);
74
+ }
75
+ else {
76
+ return null;
77
+ }
78
+ current = current.object;
79
+ }
80
+ if (current.type !== AST_NODE_TYPES.Identifier) {
81
+ return null;
82
+ }
83
+ parts.unshift(current.name);
84
+ return parts;
85
+ }
@@ -0,0 +1,3 @@
1
+ export declare const noTauriApiImport: import("@typescript-eslint/utils/ts-eslint").RuleModule<"forbidden", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
2
+ name: string;
3
+ };
@@ -0,0 +1,67 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ import { createRule } from '../create-rule.js';
3
+ function isTauriSpecifier(value) {
4
+ return value === '@tauri-apps/api' || value.startsWith('@tauri-apps/api/');
5
+ }
6
+ export const noTauriApiImport = createRule({
7
+ name: 'no-tauri-api-import',
8
+ meta: {
9
+ type: 'problem',
10
+ docs: {
11
+ description: 'Disallow direct Tauri API imports in Volt extensions.',
12
+ },
13
+ messages: {
14
+ forbidden: 'Do not import {{specifier}} from a Volt extension. Use VoltAPI instead.',
15
+ },
16
+ schema: [],
17
+ },
18
+ defaultOptions: [],
19
+ create(context) {
20
+ function reportSpecifier(node) {
21
+ if (typeof node.value === 'string' && isTauriSpecifier(node.value)) {
22
+ context.report({
23
+ node,
24
+ messageId: 'forbidden',
25
+ data: { specifier: node.value },
26
+ });
27
+ }
28
+ }
29
+ return {
30
+ Identifier(node) {
31
+ if (node.name === '__TAURI__') {
32
+ context.report({
33
+ node,
34
+ messageId: 'forbidden',
35
+ data: { specifier: '__TAURI__' },
36
+ });
37
+ }
38
+ },
39
+ ImportDeclaration(node) {
40
+ reportSpecifier(node.source);
41
+ },
42
+ ExportAllDeclaration(node) {
43
+ reportSpecifier(node.source);
44
+ },
45
+ ExportNamedDeclaration(node) {
46
+ if (node.source) {
47
+ reportSpecifier(node.source);
48
+ }
49
+ },
50
+ CallExpression(node) {
51
+ if (node.callee.type === AST_NODE_TYPES.Identifier &&
52
+ node.callee.name === 'require' &&
53
+ isStringLiteral(node.arguments[0])) {
54
+ reportSpecifier(node.arguments[0]);
55
+ }
56
+ },
57
+ ImportExpression(node) {
58
+ if (isStringLiteral(node.source)) {
59
+ reportSpecifier(node.source);
60
+ }
61
+ },
62
+ };
63
+ },
64
+ });
65
+ function isStringLiteral(node) {
66
+ return node?.type === AST_NODE_TYPES.Literal && typeof node.value === 'string';
67
+ }
@@ -0,0 +1,3 @@
1
+ export declare const noUnsafeOpenUrl: import("@typescript-eslint/utils/ts-eslint").RuleModule<"unsafe", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
2
+ name: string;
3
+ };
@@ -0,0 +1,74 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ import { getCallPath, pathStartsWith } from '../ast.js';
3
+ import { createRule } from '../create-rule.js';
4
+ const validatedNamePattern = /safe|trusted|validated|allowed|saniti[sz]ed/i;
5
+ const validatorNamePattern = /validate|assert|safe|trusted|allow|saniti[sz]e/i;
6
+ export const noUnsafeOpenUrl = createRule({
7
+ name: 'no-unsafe-open-url',
8
+ meta: {
9
+ type: 'problem',
10
+ docs: {
11
+ description: 'Require Volt openUrl calls to use explicit or validated URLs.',
12
+ },
13
+ messages: {
14
+ unsafe: 'openUrl must receive an explicit URL literal or a value that is visibly validated before opening.',
15
+ },
16
+ schema: [],
17
+ },
18
+ defaultOptions: [],
19
+ create(context) {
20
+ return {
21
+ CallExpression(node) {
22
+ if (!isOpenUrlCall(node)) {
23
+ return;
24
+ }
25
+ const firstArg = node.arguments[0];
26
+ if (!firstArg || firstArg.type === AST_NODE_TYPES.SpreadElement || !isSafeUrlArgument(firstArg)) {
27
+ context.report({ node, messageId: 'unsafe' });
28
+ }
29
+ },
30
+ };
31
+ },
32
+ });
33
+ function isOpenUrlCall(node) {
34
+ const path = getCallPath(node);
35
+ if (!path) {
36
+ return false;
37
+ }
38
+ return (pathStartsWith(path, ['VoltAPI', 'utils', 'openUrl']) ||
39
+ (path.length === 1 && path[0] === 'openUrl'));
40
+ }
41
+ function isSafeUrlArgument(node) {
42
+ if (node.type === AST_NODE_TYPES.Literal && typeof node.value === 'string') {
43
+ return hasExplicitSafeScheme(node.value);
44
+ }
45
+ if (node.type === AST_NODE_TYPES.Identifier) {
46
+ return validatedNamePattern.test(node.name);
47
+ }
48
+ if (node.type === AST_NODE_TYPES.CallExpression) {
49
+ const path = getCallPath(node);
50
+ if (path && validatorNamePattern.test(path.join('.'))) {
51
+ return true;
52
+ }
53
+ if (node.callee.type === AST_NODE_TYPES.MemberExpression &&
54
+ node.callee.property.type === AST_NODE_TYPES.Identifier &&
55
+ node.callee.property.name === 'toString' &&
56
+ node.callee.object.type === AST_NODE_TYPES.NewExpression) {
57
+ return isNewUrlWithLiteral(node.callee.object);
58
+ }
59
+ }
60
+ if (node.type === AST_NODE_TYPES.NewExpression) {
61
+ return isNewUrlWithLiteral(node);
62
+ }
63
+ return false;
64
+ }
65
+ function isNewUrlWithLiteral(node) {
66
+ return (node.callee.type === AST_NODE_TYPES.Identifier &&
67
+ node.callee.name === 'URL' &&
68
+ node.arguments[0]?.type === AST_NODE_TYPES.Literal &&
69
+ typeof node.arguments[0].value === 'string' &&
70
+ hasExplicitSafeScheme(node.arguments[0].value));
71
+ }
72
+ function hasExplicitSafeScheme(value) {
73
+ return /^(https?|mailto):/i.test(value);
74
+ }
@@ -0,0 +1,3 @@
1
+ export declare const preferHudForSilentAction: import("@typescript-eslint/utils/ts-eslint").RuleModule<"hud", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
2
+ name: string;
3
+ };
@@ -0,0 +1,71 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ import { containsCallPath, getCallPath, pathStartsWith } from '../ast.js';
3
+ import { createRule } from '../create-rule.js';
4
+ export const preferHudForSilentAction = createRule({
5
+ name: 'prefer-hud-for-silent-action',
6
+ meta: {
7
+ type: 'suggestion',
8
+ docs: {
9
+ description: 'Prefer VoltAPI.showHUD after silent copy, save, and delete actions.',
10
+ },
11
+ messages: {
12
+ hud: 'Silent {{action}} actions should call VoltAPI.showHUD so the user gets feedback.',
13
+ },
14
+ schema: [],
15
+ },
16
+ defaultOptions: [],
17
+ create(context) {
18
+ return {
19
+ CallExpression(node) {
20
+ const action = getSilentAction(node);
21
+ if (!action) {
22
+ return;
23
+ }
24
+ const scopeNode = findNearestFunctionOrProgram(context.sourceCode.getAncestors(node));
25
+ if (!scopeNode || !containsCallPath(scopeNode, isHudPath)) {
26
+ context.report({
27
+ node,
28
+ messageId: 'hud',
29
+ data: { action },
30
+ });
31
+ }
32
+ },
33
+ };
34
+ },
35
+ });
36
+ function getSilentAction(node) {
37
+ const path = getCallPath(node);
38
+ if (!path) {
39
+ return null;
40
+ }
41
+ if (pathStartsWith(path, ['VoltAPI', 'utils', 'copyToClipboard']) ||
42
+ pathStartsWith(path, ['VoltAPI', 'utils', 'pasteText']) ||
43
+ (path.length === 1 && (path[0] === 'copyToClipboard' || path[0] === 'pasteText'))) {
44
+ return 'copy';
45
+ }
46
+ if (pathStartsWith(path, ['VoltAPI', 'storage', 'set']) ||
47
+ pathStartsWith(path, ['VoltAPI', 'storage', 'remove']) ||
48
+ pathStartsWith(path, ['VoltAPI', 'storage', 'clear'])) {
49
+ return 'save/delete';
50
+ }
51
+ if (pathStartsWith(path, ['VoltAPI', 'system', 'moveToTrash'])) {
52
+ return 'delete';
53
+ }
54
+ return null;
55
+ }
56
+ function isHudPath(path) {
57
+ return pathStartsWith(path, ['VoltAPI', 'showHUD']);
58
+ }
59
+ function findNearestFunctionOrProgram(ancestors) {
60
+ for (let index = ancestors.length - 1; index >= 0; index -= 1) {
61
+ const node = ancestors[index];
62
+ if (node &&
63
+ (node.type === AST_NODE_TYPES.FunctionDeclaration ||
64
+ node.type === AST_NODE_TYPES.FunctionExpression ||
65
+ node.type === AST_NODE_TYPES.ArrowFunctionExpression ||
66
+ node.type === AST_NODE_TYPES.Program)) {
67
+ return node;
68
+ }
69
+ }
70
+ return null;
71
+ }
@@ -0,0 +1,4 @@
1
+ import { type ManifestRuleOptions } from '../manifest.js';
2
+ export declare const requireManifestPermission: import("@typescript-eslint/utils/ts-eslint").RuleModule<"missing" | "manifestMissing", [ManifestRuleOptions?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
3
+ name: string;
4
+ };
@@ -0,0 +1,116 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ import { getCallPath, pathStartsWith } from '../ast.js';
3
+ import { createRule } from '../create-rule.js';
4
+ import { getDeclaredPermissions, } from '../manifest.js';
5
+ export const requireManifestPermission = createRule({
6
+ name: 'require-manifest-permission',
7
+ meta: {
8
+ type: 'problem',
9
+ docs: {
10
+ description: 'Require manifest permissions for privileged VoltAPI and Web API usage.',
11
+ },
12
+ messages: {
13
+ missing: '{{reason}} requires the "{{permission}}" permission in manifest.json.',
14
+ manifestMissing: '{{reason}} requires the "{{permission}}" permission, but no manifest.json could be resolved.',
15
+ },
16
+ schema: [
17
+ {
18
+ type: 'object',
19
+ properties: {
20
+ manifestPath: { type: 'string' },
21
+ manifest: {
22
+ type: 'object',
23
+ properties: {
24
+ permissions: {
25
+ type: 'array',
26
+ items: { type: 'string' },
27
+ },
28
+ },
29
+ additionalProperties: true,
30
+ },
31
+ },
32
+ additionalProperties: false,
33
+ },
34
+ ],
35
+ },
36
+ defaultOptions: [{}],
37
+ create(context, [options]) {
38
+ const declared = getDeclaredPermissions(context, options);
39
+ const reported = new WeakSet();
40
+ function reportIfMissing(node, use) {
41
+ if (reported.has(node)) {
42
+ return;
43
+ }
44
+ if (!declared) {
45
+ reported.add(node);
46
+ context.report({
47
+ node,
48
+ messageId: 'manifestMissing',
49
+ data: { permission: use.permission, reason: use.reason },
50
+ });
51
+ return;
52
+ }
53
+ if (!declared.has(use.permission)) {
54
+ reported.add(node);
55
+ context.report({
56
+ node,
57
+ messageId: 'missing',
58
+ data: { permission: use.permission, reason: use.reason },
59
+ });
60
+ }
61
+ }
62
+ return {
63
+ CallExpression(node) {
64
+ const required = getRequiredPermissionUse(node);
65
+ if (required) {
66
+ reportIfMissing(node, required);
67
+ }
68
+ },
69
+ };
70
+ },
71
+ });
72
+ function getRequiredPermissionUse(node) {
73
+ const path = getCallPath(node);
74
+ if (!path) {
75
+ return null;
76
+ }
77
+ if (path[0] === 'fetch') {
78
+ const firstArg = node.arguments[0];
79
+ if (firstArg?.type === AST_NODE_TYPES.Literal &&
80
+ typeof firstArg.value === 'string' &&
81
+ !hasNetworkUrl(firstArg.value)) {
82
+ return null;
83
+ }
84
+ return { permission: 'network', reason: 'fetch()' };
85
+ }
86
+ if (pathStartsWith(path, ['navigator', 'clipboard'])) {
87
+ return { permission: 'clipboard', reason: 'navigator.clipboard' };
88
+ }
89
+ if (pathStartsWith(path, ['VoltAPI', 'oauth'])) {
90
+ return { permission: 'oauth', reason: 'VoltAPI.oauth' };
91
+ }
92
+ if (pathStartsWith(path, ['VoltAPI', 'ai'])) {
93
+ return { permission: 'ai', reason: 'VoltAPI.ai' };
94
+ }
95
+ if (pathStartsWith(path, ['VoltAPI', 'system'])) {
96
+ return { permission: 'system', reason: 'VoltAPI.system' };
97
+ }
98
+ if (pathStartsWith(path, ['VoltAPI', 'utils', 'copyToClipboard']) ||
99
+ pathStartsWith(path, ['VoltAPI', 'utils', 'pasteText'])) {
100
+ return { permission: 'clipboard', reason: `VoltAPI.utils.${path[2]}()` };
101
+ }
102
+ if (pathStartsWith(path, ['VoltAPI', 'utils', 'openUrl'])) {
103
+ return { permission: 'openUrl', reason: 'VoltAPI.utils.openUrl()' };
104
+ }
105
+ if (pathStartsWith(path, ['VoltAPI', 'notify'])) {
106
+ return { permission: 'notifications', reason: 'VoltAPI.notify()' };
107
+ }
108
+ if (node.callee.type === AST_NODE_TYPES.Identifier &&
109
+ (node.callee.name === 'copyToClipboard' || node.callee.name === 'pasteText')) {
110
+ return { permission: 'clipboard', reason: `${node.callee.name}()` };
111
+ }
112
+ return null;
113
+ }
114
+ function hasNetworkUrl(value) {
115
+ return /^[a-z][a-z0-9+.-]*:\/\//i.test(value) || /^\/\//.test(value);
116
+ }
@@ -0,0 +1,3 @@
1
+ # manifest-title-description-quality
2
+
3
+ Warns on generic extension names, weak command titles, and empty or too-short descriptions.
@@ -0,0 +1,3 @@
1
+ # manifest-valid-permissions
2
+
3
+ Validates `manifest.json` permissions against Volt's public extension permission allowlist.
@@ -0,0 +1,3 @@
1
+ # no-broad-system-action
2
+
3
+ Warns when `VoltAPI.system.moveToTrash` is called without a nearby `VoltAPI.confirm`.
@@ -0,0 +1,3 @@
1
+ # no-secret-in-storage
2
+
3
+ Disallows storing token, API key, password, and credential-like values in `localStorage`, `sessionStorage`, or `VoltAPI.storage`.
@@ -0,0 +1,3 @@
1
+ # no-tauri-api-import
2
+
3
+ Disallows `@tauri-apps/api/*` imports in Volt extensions. Extensions must use `VoltAPI` so permission checks stay enforceable.
@@ -0,0 +1,3 @@
1
+ # no-unsafe-open-url
2
+
3
+ Warns when `openUrl` receives a dynamic value that is not visibly validated.
@@ -0,0 +1,3 @@
1
+ # prefer-hud-for-silent-action
2
+
3
+ Warns when silent copy, save, or delete actions do not call `VoltAPI.showHUD`.
@@ -0,0 +1,3 @@
1
+ # require-manifest-permission
2
+
3
+ Requires the extension manifest to declare permissions used by privileged APIs such as `VoltAPI.oauth`, `VoltAPI.ai`, `VoltAPI.system`, `fetch`, clipboard helpers, notifications, and `openUrl`.
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@voltlaunchrr/eslint-plugin",
3
+ "version": "0.1.0",
4
+ "description": "ESLint plugin for Volt extension authors",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/VoltLaunchr/eslint-plugin.git",
9
+ "directory": "packages/eslint-plugin"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "type": "module",
15
+ "main": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "docs",
26
+ "README.md"
27
+ ],
28
+ "dependencies": {
29
+ "@typescript-eslint/utils": "^8.59.3"
30
+ },
31
+ "peerDependencies": {
32
+ "eslint": "^9.0.0 || ^10.0.0",
33
+ "typescript": ">=5.4 <6.1"
34
+ },
35
+ "devDependencies": {
36
+ "@typescript-eslint/parser": "^8.59.3",
37
+ "@types/node": "^26.0.1",
38
+ "eslint": "^10.5.0",
39
+ "jsonc-eslint-parser": "^2.4.1",
40
+ "typescript": "~6.0.3",
41
+ "vitest": "^4.1.6"
42
+ },
43
+ "scripts": {
44
+ "build": "tsc -p tsconfig.json",
45
+ "test": "vitest run"
46
+ }
47
+ }