eslint-plugin-modularity 3.0.2 → 3.0.4

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/AGENTS.md ADDED
@@ -0,0 +1,54 @@
1
+ <!-- Generated by scripts/generate-plugin-agents-md.ts from package.json and the plugin exports. Do not edit by hand; run `npm run agents-md`. -->
2
+
3
+ # eslint-plugin-modularity
4
+
5
+ Guide for AI coding assistants using this plugin in a project. To change the plugin's own source, read https://github.com/ofri-peretz/eslint/blob/main/AGENTS.md instead.
6
+
7
+ > ESLint module boundaries and architecture rules — enforces DDD value objects and anemic-model checks, naming, REST conventions, and utility isolation.
8
+
9
+ ## Enable it
10
+
11
+ ```bash
12
+ npm install --save-dev eslint-plugin-modularity
13
+ ```
14
+
15
+ Requires ESLint ^8.40.0 || ^9.0.0 || ^10.0.0 and Node >=22.13.0.
16
+
17
+ Flat config files (`eslint.config.*`) are found by ESLint 8.57 and newer; on ESLint 9 and 10 they are the default.
18
+
19
+ ```js
20
+ // eslint.config.mjs
21
+ import modularity from 'eslint-plugin-modularity';
22
+
23
+ export default [modularity.configs.recommended];
24
+ ```
25
+
26
+ Each preset is one flat config object: put it in the array as an element, do not spread it. Rule ids are prefixed `modularity/`. Add it to the config you already have; do not remove other plugins. TypeScript files need a TypeScript parser in the config (`typescript-eslint`).
27
+
28
+ ## Presets
29
+
30
+ | Preset | Rules | Errors | Warnings |
31
+ | ------------- | ----- | ------ | -------- |
32
+ | `recommended` | 6 | 3 | 3 |
33
+ | `strict` | 6 | 6 | 0 |
34
+
35
+ ### `recommended`
36
+
37
+ 6 rules:
38
+
39
+ - `ddd-anemic-domain-model` (warn): Detects entities with only getters/setters and no business logic.
40
+ - `ddd-value-object-immutability` (error): Validates value objects are properly immutable.
41
+ - `enforce-naming` (warn): Enforce domain-specific naming conventions with business context.
42
+ - `enforce-rest-conventions` (error): Validates REST endpoint design against best practices.
43
+ - `no-external-api-calls-in-utils` (error): Detects network calls in utility functions.
44
+ - `no-mutable-exports` (warn): Disallow mutable exports (export let / export var).
45
+
46
+ ### `strict`
47
+
48
+ Same rules as `recommended`.
49
+
50
+ ## More
51
+
52
+ - Docs: https://eslint.interlace.tools/docs/quality/plugin-modularity
53
+ - README.md in this package: every rule with examples.
54
+ - `eslint-plugin-modularity/oxlint` is an entry point for oxlint's JS plugin support; see the README.
package/README.md CHANGED
@@ -20,7 +20,28 @@
20
20
  <a href="https://scorecard.dev/viewer/?uri=github.com/ofri-peretz/eslint" target="_blank"><img src="https://api.securityscorecards.dev/projects/github.com/ofri-peretz/eslint/badge" alt="OpenSSF Scorecard" /></a>
21
21
  </p>
22
22
 
23
- > ⭐ If this plugin caught a real bug for you, [**star the repo**](https://github.com/ofri-peretz/eslint) — it's the signal that keeps these rules maintained.
23
+ ## Getting Started
24
+
25
+ - To check out the [guide](https://eslint.interlace.tools/docs/quality/plugin-modularity?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-modularity), visit [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-modularity). 📚
26
+
27
+ <!-- AUTO-GENERATED:INSTALL:START - Do not edit manually -->
28
+
29
+ ```bash
30
+ npm install --save-dev eslint eslint-plugin-modularity
31
+ ```
32
+
33
+ ```js
34
+ // eslint.config.mjs
35
+ import { configs } from 'eslint-plugin-modularity';
36
+
37
+ export default [configs.recommended];
38
+ ```
39
+
40
+ `recommended` is the preset to start with. The others are listed under Configuration Presets below.
41
+
42
+ Using oxlint or Vite+? Install `oxlint-plugin-modularity`: the same rules under the same `modularity/<rule>` IDs, without ESLint. Its [page](https://www.npmjs.com/package/oxlint-plugin-modularity) has the setup.
43
+
44
+ <!-- AUTO-GENERATED:INSTALL:END -->
24
45
 
25
46
  ## Description
26
47
 
@@ -42,40 +63,6 @@ That trade costs recall, and we measure it:
42
63
 
43
64
  <!-- AUTO-GENERATED:DOCTRINE:END -->
44
65
 
45
- ## Getting Started
46
-
47
- - To check out the [guide](https://eslint.interlace.tools/docs/quality/plugin-modularity?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-modularity), visit [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-modularity). 📚
48
-
49
- <!-- AUTO-GENERATED:INSTALL:START - Do not edit manually -->
50
-
51
- **oxlint / Vite+** — the same rules under the same `modularity/<rule>` IDs, without ESLint:
52
-
53
- ```bash
54
- npm install oxlint-plugin-modularity --save-dev
55
- ```
56
-
57
- ```jsonc
58
- // .oxlintrc.json
59
- { "jsPlugins": ["oxlint-plugin-modularity"] }
60
- ```
61
-
62
- ```ts
63
- // vite.config.ts
64
- import { defineConfig } from 'vite-plus';
65
-
66
- export default defineConfig({
67
- lint: { jsPlugins: ['oxlint-plugin-modularity'] },
68
- });
69
- ```
70
-
71
- **ESLint:**
72
-
73
- ```bash
74
- npm install eslint-plugin-modularity --save-dev
75
- ```
76
-
77
- <!-- AUTO-GENERATED:INSTALL:END -->
78
-
79
66
  ## ⚙️ Configuration Presets
80
67
  | Preset | Description |
81
68
  | :------------ | :----------------------------------------- |
@@ -205,10 +192,10 @@ See the [ESLint Version Support Policy](../../docs/ESLINT_VERSION_SUPPORT.md)
205
192
  | Rule | CWE | OWASP | CVSS | Description | 🧠 | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
206
193
  | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
207
194
  | [ddd-anemic-domain-model](https://eslint.interlace.tools/docs/quality/plugin-modularity/rules/ddd-anemic-domain-model?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-modularity) | | | | Detects entities with only getters/setters and no business logic, enforcing the Rich Domain Model over the… | 🟢 | | ⚠️ | | 💡 | |
208
- | [ddd-value-object-immutability](https://eslint.interlace.tools/docs/quality/plugin-modularity/rules/ddd-value-object-immutability?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-modularity) | | | | ESLint Rule: ddd-value-object-immutability with LLM-optimized suggestions and auto-fix capabilities. | 🟢 | 💼 | | | 💡 | |
195
+ | [ddd-value-object-immutability](https://eslint.interlace.tools/docs/quality/plugin-modularity/rules/ddd-value-object-immutability?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-modularity) | | | | Report value-object classes whose instance fields can be reassigned after construction. | 🟢 | 💼 | | | 💡 | |
209
196
  | [enforce-naming](https://eslint.interlace.tools/docs/quality/plugin-modularity/rules/enforce-naming?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-modularity) | | | | Enforce domain-specific naming conventions with business context | 🟢 | | ⚠️ | | 💡 | |
210
- | [enforce-rest-conventions](https://eslint.interlace.tools/docs/quality/plugin-modularity/rules/enforce-rest-conventions?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-modularity) | | | | ESLint Rule: enforce-rest-conventions with LLM-optimized suggestions and auto-fix capabilities. | 🟢 | 💼 | | | 💡 | |
211
- | [no-external-api-calls-in-utils](https://eslint.interlace.tools/docs/quality/plugin-modularity/rules/no-external-api-calls-in-utils?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-modularity) | | | | ESLint Rule: no-external-api-calls-in-utils with LLM-optimized suggestions and auto-fix capabilities. | 🟢 | 💼 | | | 💡 | |
197
+ | [enforce-rest-conventions](https://eslint.interlace.tools/docs/quality/plugin-modularity/rules/enforce-rest-conventions?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-modularity) | | | | Report route paths whose first segment is not a plural resource name. | 🟢 | 💼 | | | 💡 | |
198
+ | [no-external-api-calls-in-utils](https://eslint.interlace.tools/docs/quality/plugin-modularity/rules/no-external-api-calls-in-utils?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-modularity) | | | | Report network calls inside utility modules, where an HTTP client makes the helper untestable without the n… | 🟢 | 💼 | | | 💡 | |
212
199
  | [no-mutable-exports](https://eslint.interlace.tools/docs/quality/plugin-modularity/rules/no-mutable-exports?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-modularity) | | | | Disallow mutable let/var declarations on exported bindings | 🟢 | | ⚠️ | | | |
213
200
  <!-- AUTO-GENERATED:RULES_TABLE:END -->
214
201
  <!-- AUTO-GENERATED:ECOSYSTEM_TABLE:START - Do not edit manually -->
@@ -260,11 +247,10 @@ Part of the **Interlace ESLint ecosystem** — AI-native rules with LLM-optimize
260
247
  <!-- AUTO-GENERATED:ECOSYSTEM_TABLE:END -->
261
248
 
262
249
  <!-- INTERLACE:STAR_CTA:START -->
263
- ## ⭐ Support & follow
264
250
 
265
- If this plugin caught a real bug for you, **[star the repo](https://github.com/ofri-peretz/eslint)** — stars are the signal that keeps the Interlace ESLint ecosystem maintained — and **[follow the writeups on Dev.to](https://dev.to/ofri-peretz)** for the benchmarks and security research behind these rules.
251
+ ## Support
266
252
 
267
- [![GitHub stars](https://img.shields.io/github/stars/ofri-peretz/eslint?style=social)](https://github.com/ofri-peretz/eslint)
253
+ Found a false positive? [Open an issue](https://github.com/ofri-peretz/eslint/issues): that is a bug. If the plugin helped, a star on [ofri-peretz/eslint](https://github.com/ofri-peretz/eslint) helps others find it.
268
254
 
269
255
  <!-- INTERLACE:STAR_CTA:END -->
270
256
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-modularity",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "ESLint module boundaries and architecture rules — enforces DDD value objects and anemic-model checks, naming, REST conventions, and utility isolation.",
5
5
  "type": "commonjs",
6
6
  "sideEffects": false,
@@ -33,7 +33,8 @@
33
33
  "files": [
34
34
  "src/",
35
35
  "README.md",
36
- "LICENSE"
36
+ "LICENSE",
37
+ "AGENTS.md"
37
38
  ],
38
39
  "keywords": [
39
40
  "eslint",
package/src/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.rules={get"ddd-anemic-domain-model"(){return require("./rules/ddd-anemic-domain-model").dddAnemicDomainModel},get"ddd-value-object-immutability"(){return require("./rules/ddd-value-object-immutability").dddValueObjectImmutability},get"enforce-naming"(){return require("./rules/enforce-naming").enforceNaming},get"enforce-rest-conventions"(){return require("./rules/enforce-rest-conventions").enforceRestConventions},get"no-external-api-calls-in-utils"(){return require("./rules/no-external-api-calls-in-utils").noExternalApiCallsInUtils},get"no-mutable-exports"(){return require("./rules/no-mutable-exports").noMutableExports}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-modularity",exports.rules);exports.plugin={meta:{name:"eslint-plugin-modularity",version:"3.0.2"},rules:exports.rules};const recommendedRules={"modularity/ddd-anemic-domain-model":"warn","modularity/ddd-value-object-immutability":"error","modularity/enforce-naming":"warn","modularity/enforce-rest-conventions":"error","modularity/no-external-api-calls-in-utils":"error","modularity/no-mutable-exports":"warn"};exports.configs={recommended:{plugins:{"modularity":exports.plugin},rules:recommendedRules},strict:{plugins:{"modularity":exports.plugin},rules:Object.fromEntries(Object.keys(exports.rules).map(ruleName=>[`modularity/${ruleName}`,"error"]))}};exports.default=exports.plugin;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.rules={get"ddd-anemic-domain-model"(){return require("./rules/ddd-anemic-domain-model").dddAnemicDomainModel},get"ddd-value-object-immutability"(){return require("./rules/ddd-value-object-immutability").dddValueObjectImmutability},get"enforce-naming"(){return require("./rules/enforce-naming").enforceNaming},get"enforce-rest-conventions"(){return require("./rules/enforce-rest-conventions").enforceRestConventions},get"no-external-api-calls-in-utils"(){return require("./rules/no-external-api-calls-in-utils").noExternalApiCallsInUtils},get"no-mutable-exports"(){return require("./rules/no-mutable-exports").noMutableExports}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-modularity",exports.rules);exports.plugin={meta:{name:"eslint-plugin-modularity",version:"3.0.4"},rules:exports.rules};const recommendedRules={"modularity/ddd-anemic-domain-model":"warn","modularity/ddd-value-object-immutability":"error","modularity/enforce-naming":"warn","modularity/enforce-rest-conventions":"error","modularity/no-external-api-calls-in-utils":"error","modularity/no-mutable-exports":"warn"};exports.configs={recommended:{plugins:{"modularity":exports.plugin},rules:recommendedRules},strict:{plugins:{"modularity":exports.plugin},rules:Object.fromEntries(Object.keys(exports.rules).map(ruleName=>[`modularity/${ruleName}`,"error"]))}};exports.default=exports.plugin;