@reticlehq/eslint-plugin 2.0.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/LICENSE ADDED
@@ -0,0 +1,202 @@
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 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 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 those 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. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Reticle Labs
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # @reticlehq/eslint-plugin
2
+
3
+ Keeps the Reticle **signal layer self-enforcing**. When your store mutates user-visible state, an `reticle.signal(...)` should fire so an agent can assert on the change off-DOM. This plugin makes "state changed ⇒ signal fired" a lint rule instead of a convention that rots. It pairs with the runtime `commitAndSignal(mutate, signal, data)` helper from `@reticlehq/browser`.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ pnpm add -D @reticlehq/eslint-plugin
9
+ ```
10
+
11
+ Peer dependency: `eslint >= 9` (flat config).
12
+
13
+ ## Flat-config setup
14
+
15
+ ```js
16
+ // eslint.config.mjs
17
+ import reticle from '@reticlehq/eslint-plugin';
18
+
19
+ export default [
20
+ {
21
+ plugins: { reticle },
22
+ rules: {
23
+ 'reticle/require-signal-on-mutation': [
24
+ 'error',
25
+ {
26
+ mutators: ['set', 'reorderSections', 'addSection'],
27
+ signalCallee: 'reticleSignal',
28
+ },
29
+ ],
30
+ },
31
+ },
32
+ ];
33
+ ```
34
+
35
+ Shortcut: enable the bundled `recommended` config (turns the rule on at `warn` with no-op defaults until you configure `mutators`):
36
+
37
+ ```js
38
+ import reticle from '@reticlehq/eslint-plugin';
39
+
40
+ export default [reticle.configs.recommended];
41
+ ```
42
+
43
+ ## Rule: `require-signal-on-mutation`
44
+
45
+ Flags a function (declaration, expression, or arrow) that calls a configured **mutator** but never calls the configured **signal callee** anywhere in that **same** function body.
46
+
47
+ Report message: `store mutation without a mapped Reticle signal`.
48
+
49
+ ### Options
50
+
51
+ `options[0]`:
52
+
53
+ | Option | Type | Default | Meaning |
54
+ | --- | --- | --- | --- |
55
+ | `mutators` | `string[]` | `[]` | Callee names that mutate user-visible state. |
56
+ | `signalCallee` | `string \| string[]` | `['reticleSignal', 'signal']` | Callee name(s) that count as firing an Reticle signal. |
57
+
58
+ With no options, `mutators` is empty, so the rule is a safe **no-op** (it never fires and never crashes). Configure `mutators` to switch it on.
59
+
60
+ ### Scoping — per function
61
+
62
+ Signal-credit is **per function**. A signal called in an enclosing or inner function does **not** satisfy a mutator called in a different function. Pair the mutation and the signal in the same body (which is exactly what `commitAndSignal(mutate, signal, data)` does). This is deliberate: a signal fired in some other scope is not guaranteed to run for the mutation path that drifted.
63
+
64
+ ### Matching — by name
65
+
66
+ The callee is matched by **name**, ignoring the object:
67
+
68
+ - `set(...)` — matched.
69
+ - `this.set(...)` — matched (`set`).
70
+ - `store.set(...)` — matched (`set`).
71
+ - `store['set'](...)` — **not** matched (computed member access; documented limitation).
72
+
73
+ ### Examples
74
+
75
+ ```js
76
+ // ✅ valid — mutation + signal in the same function
77
+ function commit() {
78
+ set(next);
79
+ reticleSignal('sections:reordered');
80
+ }
81
+
82
+ // ❌ invalid — mutation with no mapped signal
83
+ function commit() {
84
+ store.set(next); // store mutation without a mapped Reticle signal
85
+ }
86
+ ```
87
+
88
+ ## How it fits the workflow
89
+
90
+ The runtime side advertises signals via `registerCapabilities({ signals: [...] })` (G5) and fires them with `reticle.signal(name, data)`. P5b centralizes that in a Zustand `signalMap` / `commitAndSignal` pair. This lint rule is the **static** counterpart that guards those pairs so the signal map can't silently fall behind the store.
@@ -0,0 +1,19 @@
1
+ /** Constants for the Reticle ESLint plugin (no free strings). */
2
+ /** The single rule id this plugin ships. */
3
+ export declare const RULE_NAME = "require-signal-on-mutation";
4
+ /** messageId keys (reported via context.report). */
5
+ export declare const MessageId: {
6
+ readonly MUTATION_WITHOUT_SIGNAL: "mutationWithoutSignal";
7
+ };
8
+ export type MessageId = (typeof MessageId)[keyof typeof MessageId];
9
+ /** The human-readable report text (the assertion in tests matches this verbatim). */
10
+ export declare const MUTATION_WITHOUT_SIGNAL_MESSAGE = "store mutation without a mapped Reticle signal";
11
+ /** Default signal-callee names recognized when the consumer passes none. */
12
+ export declare const DEFAULT_SIGNAL_CALLEES: readonly ["reticleSignal", "signal"];
13
+ /** Default mutators = NONE. With no configured mutators the rule never fires (safe no-op). */
14
+ export declare const DEFAULT_MUTATORS: readonly string[];
15
+ /** Plugin meta name used in the flat-config export + RuleCreator url namespace. */
16
+ export declare const PLUGIN_NAME = "reticle";
17
+ /** Docs URL builder root for ESLintUtils.RuleCreator. */
18
+ export declare const DOCS_URL_ROOT = "https://github.com/reticlehq/reticle/blob/main/packages/eslint-plugin/README.md";
19
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAEjE,4CAA4C;AAC5C,eAAO,MAAM,SAAS,+BAA+B,CAAC;AAEtD,oDAAoD;AACpD,eAAO,MAAM,SAAS;;CAEZ,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEnE,qFAAqF;AACrF,eAAO,MAAM,+BAA+B,mDAAmD,CAAC;AAEhG,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,sCAAuC,CAAC;AAE3E,8FAA8F;AAC9F,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAAO,CAAC;AAEtD,mFAAmF;AACnF,eAAO,MAAM,WAAW,YAAY,CAAC;AAErC,yDAAyD;AACzD,eAAO,MAAM,aAAa,oFACyD,CAAC"}
@@ -0,0 +1,18 @@
1
+ /** Constants for the Reticle ESLint plugin (no free strings). */
2
+ /** The single rule id this plugin ships. */
3
+ export const RULE_NAME = 'require-signal-on-mutation';
4
+ /** messageId keys (reported via context.report). */
5
+ export const MessageId = {
6
+ MUTATION_WITHOUT_SIGNAL: 'mutationWithoutSignal',
7
+ };
8
+ /** The human-readable report text (the assertion in tests matches this verbatim). */
9
+ export const MUTATION_WITHOUT_SIGNAL_MESSAGE = 'store mutation without a mapped Reticle signal';
10
+ /** Default signal-callee names recognized when the consumer passes none. */
11
+ export const DEFAULT_SIGNAL_CALLEES = ['reticleSignal', 'signal'];
12
+ /** Default mutators = NONE. With no configured mutators the rule never fires (safe no-op). */
13
+ export const DEFAULT_MUTATORS = [];
14
+ /** Plugin meta name used in the flat-config export + RuleCreator url namespace. */
15
+ export const PLUGIN_NAME = 'reticle';
16
+ /** Docs URL builder root for ESLintUtils.RuleCreator. */
17
+ export const DOCS_URL_ROOT = 'https://github.com/reticlehq/reticle/blob/main/packages/eslint-plugin/README.md';
18
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAEjE,4CAA4C;AAC5C,MAAM,CAAC,MAAM,SAAS,GAAG,4BAA4B,CAAC;AAEtD,oDAAoD;AACpD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,uBAAuB,EAAE,uBAAuB;CACxC,CAAC;AAGX,qFAAqF;AACrF,MAAM,CAAC,MAAM,+BAA+B,GAAG,gDAAgD,CAAC;AAEhG,4EAA4E;AAC5E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,eAAe,EAAE,QAAQ,CAAU,CAAC;AAE3E,8FAA8F;AAC9F,MAAM,CAAC,MAAM,gBAAgB,GAAsB,EAAE,CAAC;AAEtD,mFAAmF;AACnF,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC;AAErC,yDAAyD;AACzD,MAAM,CAAC,MAAM,aAAa,GACxB,iFAAiF,CAAC"}
@@ -0,0 +1,21 @@
1
+ /** @reticlehq/eslint-plugin — flat-config plugin export. */
2
+ import { requireSignalOnMutation } from './require-signal-on-mutation.js';
3
+ export declare const rules: {
4
+ readonly "require-signal-on-mutation": import("@typescript-eslint/utils/ts-eslint").RuleModule<"mutationWithoutSignal", [import("./options.js").RawRuleOptions], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
5
+ name: string;
6
+ };
7
+ };
8
+ declare const plugin: {
9
+ meta: {
10
+ name: string;
11
+ };
12
+ rules: {
13
+ readonly "require-signal-on-mutation": import("@typescript-eslint/utils/ts-eslint").RuleModule<"mutationWithoutSignal", [import("./options.js").RawRuleOptions], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
14
+ name: string;
15
+ };
16
+ };
17
+ configs: Record<string, unknown>;
18
+ };
19
+ export default plugin;
20
+ export { requireSignalOnMutation };
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAE5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAG1E,eAAO,MAAM,KAAK;;;;CAAoD,CAAC;AAEvE,QAAA,MAAM,MAAM;;;;;;;;;aAGK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CACvC,CAAC;AAQF,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ /** @reticlehq/eslint-plugin — flat-config plugin export. */
2
+ import { requireSignalOnMutation } from './require-signal-on-mutation.js';
3
+ import { PLUGIN_NAME, RULE_NAME } from './constants.js';
4
+ export const rules = { [RULE_NAME]: requireSignalOnMutation };
5
+ const plugin = {
6
+ meta: { name: PLUGIN_NAME },
7
+ rules,
8
+ configs: {},
9
+ };
10
+ // recommended flat config: turns the rule on with empty (no-op) defaults.
11
+ plugin.configs.recommended = {
12
+ plugins: { [PLUGIN_NAME]: plugin },
13
+ rules: { [`${PLUGIN_NAME}/${RULE_NAME}`]: 'warn' },
14
+ };
15
+ export default plugin;
16
+ export { requireSignalOnMutation };
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAE5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,uBAAuB,EAAW,CAAC;AAEvE,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;IAC3B,KAAK;IACL,OAAO,EAAE,EAA6B;CACvC,CAAC;AAEF,0EAA0E;AAC1E,MAAM,CAAC,OAAO,CAAC,WAAW,GAAG;IAC3B,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE;IAClC,KAAK,EAAE,EAAE,CAAC,GAAG,WAAW,IAAI,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE;CACnD,CAAC;AAEF,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ /** Option schema + normalizer for require-signal-on-mutation. Pure, no I/O. */
2
+ export interface RawRuleOptions {
3
+ mutators?: string[];
4
+ signalCallee?: string | string[];
5
+ }
6
+ interface NormalizedOptions {
7
+ mutators: ReadonlySet<string>;
8
+ signalCallees: ReadonlySet<string>;
9
+ }
10
+ /** JSON schema for the rule's options[0] (consumed by ESLint meta.schema). */
11
+ export declare const OPTIONS_SCHEMA: readonly unknown[];
12
+ /** Pure: raw options (possibly undefined) -> normalized sets. Injects defaults. */
13
+ export declare function normalizeOptions(raw: RawRuleOptions | undefined): NormalizedOptions;
14
+ export {};
15
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAI/E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAClC;AAED,UAAU,iBAAiB;IACzB,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACpC;AAED,8EAA8E;AAC9E,eAAO,MAAM,cAAc,EAAE,SAAS,OAAO,EAc5C,CAAC;AAMF,mFAAmF;AACnF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,cAAc,GAAG,SAAS,GAAG,iBAAiB,CAiBnF"}
@@ -0,0 +1,41 @@
1
+ /** Option schema + normalizer for require-signal-on-mutation. Pure, no I/O. */
2
+ import { DEFAULT_MUTATORS, DEFAULT_SIGNAL_CALLEES } from './constants.js';
3
+ /** JSON schema for the rule's options[0] (consumed by ESLint meta.schema). */
4
+ export const OPTIONS_SCHEMA = [
5
+ {
6
+ type: 'object',
7
+ properties: {
8
+ mutators: {
9
+ type: 'array',
10
+ items: { type: 'string' },
11
+ },
12
+ signalCallee: {
13
+ oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
14
+ },
15
+ },
16
+ additionalProperties: false,
17
+ },
18
+ ];
19
+ function toNonEmptySet(values) {
20
+ return new Set(values.filter((v) => v.length > 0));
21
+ }
22
+ /** Pure: raw options (possibly undefined) -> normalized sets. Injects defaults. */
23
+ export function normalizeOptions(raw) {
24
+ const mutatorList = raw?.mutators ?? DEFAULT_MUTATORS;
25
+ const rawSignal = raw?.signalCallee;
26
+ let signalList;
27
+ if (rawSignal === undefined) {
28
+ signalList = DEFAULT_SIGNAL_CALLEES;
29
+ }
30
+ else if (typeof rawSignal === 'string') {
31
+ signalList = [rawSignal];
32
+ }
33
+ else {
34
+ signalList = rawSignal;
35
+ }
36
+ return {
37
+ mutators: toNonEmptySet(mutatorList),
38
+ signalCallees: toNonEmptySet(signalList),
39
+ };
40
+ }
41
+ //# sourceMappingURL=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aAAa,CAAC,WAAW,CAAC;QACpC,aAAa,EAAE,aAAa,CAAC,UAAU,CAAC;KACzC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Rule: require-signal-on-mutation.
3
+ *
4
+ * Flags a function that CALLS a configured mutator but never calls the
5
+ * signal callee anywhere in that SAME function body. Keeps the Reticle signal
6
+ * layer self-enforcing (pairs with commitAndSignal).
7
+ *
8
+ * Scoping is per-function: a signal in an enclosing or inner function does
9
+ * NOT credit a mutation in a different function. Each frame stands alone.
10
+ */
11
+ import { ESLintUtils } from '@typescript-eslint/utils';
12
+ import { type RawRuleOptions } from './options.js';
13
+ type Options = [RawRuleOptions];
14
+ export declare const requireSignalOnMutation: ESLintUtils.RuleModule<"mutationWithoutSignal", Options, unknown, ESLintUtils.RuleListener> & {
15
+ name: string;
16
+ };
17
+ export {};
18
+ //# sourceMappingURL=require-signal-on-mutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"require-signal-on-mutation.d.ts","sourceRoot":"","sources":["../src/require-signal-on-mutation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAkB,WAAW,EAAiB,MAAM,0BAA0B,CAAC;AAEtF,OAAO,EAAoC,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAIrF,KAAK,OAAO,GAAG,CAAC,cAAc,CAAC,CAAC;AAwBhC,eAAO,MAAM,uBAAuB;;CAsDlC,CAAC"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Rule: require-signal-on-mutation.
3
+ *
4
+ * Flags a function that CALLS a configured mutator but never calls the
5
+ * signal callee anywhere in that SAME function body. Keeps the Reticle signal
6
+ * layer self-enforcing (pairs with commitAndSignal).
7
+ *
8
+ * Scoping is per-function: a signal in an enclosing or inner function does
9
+ * NOT credit a mutation in a different function. Each frame stands alone.
10
+ */
11
+ import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils';
12
+ import { DOCS_URL_ROOT, MessageId, MUTATION_WITHOUT_SIGNAL_MESSAGE } from './constants.js';
13
+ import { normalizeOptions, OPTIONS_SCHEMA } from './options.js';
14
+ const createRule = ESLintUtils.RuleCreator((name) => `${DOCS_URL_ROOT}#${name}`);
15
+ /** Resolve the callee name of a CallExpression by NAME (ignores the object). */
16
+ function calleeName(node) {
17
+ const callee = node.callee;
18
+ if (callee.type === AST_NODE_TYPES.Identifier) {
19
+ return callee.name;
20
+ }
21
+ if (callee.type === AST_NODE_TYPES.MemberExpression &&
22
+ callee.computed === false &&
23
+ callee.property.type === AST_NODE_TYPES.Identifier) {
24
+ return callee.property.name;
25
+ }
26
+ return null;
27
+ }
28
+ export const requireSignalOnMutation = createRule({
29
+ name: 'require-signal-on-mutation',
30
+ meta: {
31
+ type: 'problem',
32
+ docs: {
33
+ description: 'Require an Reticle signal alongside any user-visible store mutation so the signal layer cannot drift.',
34
+ },
35
+ schema: OPTIONS_SCHEMA,
36
+ messages: {
37
+ [MessageId.MUTATION_WITHOUT_SIGNAL]: MUTATION_WITHOUT_SIGNAL_MESSAGE,
38
+ },
39
+ },
40
+ defaultOptions: [{}],
41
+ create(context) {
42
+ const { mutators, signalCallees } = normalizeOptions(context.options[0]);
43
+ const stack = [];
44
+ function enterFn() {
45
+ stack.push({ calledSignal: false, mutatorNode: null });
46
+ }
47
+ function exitFn() {
48
+ const frame = stack.pop();
49
+ if (frame === undefined)
50
+ return;
51
+ if (frame.mutatorNode !== null && frame.calledSignal === false) {
52
+ context.report({
53
+ node: frame.mutatorNode,
54
+ messageId: MessageId.MUTATION_WITHOUT_SIGNAL,
55
+ });
56
+ }
57
+ }
58
+ return {
59
+ FunctionDeclaration: enterFn,
60
+ 'FunctionDeclaration:exit': exitFn,
61
+ FunctionExpression: enterFn,
62
+ 'FunctionExpression:exit': exitFn,
63
+ ArrowFunctionExpression: enterFn,
64
+ 'ArrowFunctionExpression:exit': exitFn,
65
+ CallExpression(node) {
66
+ const frame = stack.at(-1);
67
+ if (frame === undefined)
68
+ return;
69
+ const name = calleeName(node);
70
+ if (name === null)
71
+ return;
72
+ if (mutators.has(name) && frame.mutatorNode === null) {
73
+ frame.mutatorNode = node;
74
+ }
75
+ if (signalCallees.has(name)) {
76
+ frame.calledSignal = true;
77
+ }
78
+ },
79
+ };
80
+ },
81
+ });
82
+ //# sourceMappingURL=require-signal-on-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"require-signal-on-mutation.js","sourceRoot":"","sources":["../src/require-signal-on-mutation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAiB,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAuB,MAAM,cAAc,CAAC;AAErF,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,aAAa,IAAI,IAAI,EAAE,CAAC,CAAC;AAUjF,gFAAgF;AAChF,SAAS,UAAU,CAAC,IAA6B;IAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,IAAI,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,EAAE,CAAC;QAC9C,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IACD,IACE,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB;QAC/C,MAAM,CAAC,QAAQ,KAAK,KAAK;QACzB,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,EAClD,CAAC;QACD,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC9B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAsB;IACrE,IAAI,EAAE,4BAA4B;IAClC,IAAI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AI,CAAC,CAAC;gBAC9B,IAAI,IAAI,KAAK,IAAI;oBAAE,OAAO;gBAC1B,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;oBACrD,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;gBAC3B,CAAC;gBACD,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC5B,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;gBAC5B,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@reticlehq/eslint-plugin",
3
+ "version": "2.0.0",
4
+ "description": "Reticle ESLint plugin — keeps the signal layer self-enforcing (mutation-without-signal).",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "dependencies": {
15
+ "@typescript-eslint/utils": "^8.20.0"
16
+ },
17
+ "peerDependencies": {
18
+ "eslint": ">=9"
19
+ },
20
+ "devDependencies": {
21
+ "@typescript-eslint/rule-tester": "^8.20.0"
22
+ },
23
+ "license": "Apache-2.0",
24
+ "author": "Reticle contributors",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/reticlehq/reticle.git",
28
+ "directory": "packages/eslint-plugin"
29
+ },
30
+ "homepage": "https://github.com/reticlehq/reticle#readme",
31
+ "bugs": "https://github.com/reticlehq/reticle/issues",
32
+ "files": [
33
+ "dist",
34
+ "README.md"
35
+ ],
36
+ "sideEffects": false,
37
+ "keywords": [
38
+ "mcp",
39
+ "ai-agents",
40
+ "eslint",
41
+ "eslint-plugin",
42
+ "testing"
43
+ ],
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "scripts": {
48
+ "build": "tsc -b",
49
+ "typecheck": "tsc -b",
50
+ "lint": "eslint src",
51
+ "test:unit": "vitest run src --passWithNoTests"
52
+ }
53
+ }