eslint-plugin-modularity 2.1.3 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/package.json +4 -11
- package/src/index.d.ts +17 -16
- package/src/index.js +1 -16
- package/src/lib/eslint-plugin-modularity.js +0 -1
- package/src/oxlint.d.ts +17 -20
- package/src/oxlint.js +0 -19
- package/src/rules/ddd-anemic-domain-model.js +2 -45
- package/src/rules/ddd-value-object-immutability.js +2 -26
- package/src/rules/enforce-naming.js +1 -32
- package/src/rules/enforce-rest-conventions.js +0 -19
- package/src/rules/no-external-api-calls-in-utils.js +0 -15
- package/src/rules/no-mutable-exports.js +0 -7
- package/src/index.js.map +0 -1
- package/src/lib/eslint-plugin-modularity.d.ts +0 -1
- package/src/lib/eslint-plugin-modularity.js.map +0 -1
- package/src/oxlint.js.map +0 -1
- package/src/rules/ddd-anemic-domain-model.d.ts +0 -27
- package/src/rules/ddd-anemic-domain-model.js.map +0 -1
- package/src/rules/ddd-value-object-immutability.d.ts +0 -27
- package/src/rules/ddd-value-object-immutability.js.map +0 -1
- package/src/rules/enforce-naming.d.ts +0 -30
- package/src/rules/enforce-naming.js.map +0 -1
- package/src/rules/enforce-rest-conventions.d.ts +0 -27
- package/src/rules/enforce-rest-conventions.js.map +0 -1
- package/src/rules/no-external-api-calls-in-utils.d.ts +0 -23
- package/src/rules/no-external-api-calls-in-utils.js.map +0 -1
- package/src/rules/no-mutable-exports.d.ts +0 -28
- package/src/rules/no-mutable-exports.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-modularity" target="blank"><img src="https://eslint.interlace.tools/
|
|
2
|
+
<a href="https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-modularity" target="blank"><img src="https://eslint.interlace.tools/logos/interlace.svg" alt="Interlace" height="90" /></a>
|
|
3
3
|
|
|
4
|
-
<a href="https://
|
|
4
|
+
<a href="https://oxc.rs" target="_blank"><img src="https://eslint.interlace.tools/logos/oxlint.svg" alt="oxlint" height="90" /></a>
|
|
5
|
+
|
|
6
|
+
<a href="https://eslint.org" target="_blank"><img src="https://eslint.interlace.tools/logos/eslint.svg" alt="ESLint" height="90" /></a>
|
|
5
7
|
</p>
|
|
6
8
|
|
|
7
9
|
<p align="center">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-modularity",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"description": "ESLint plugin for module architecture — enforces DDD value objects and anemic-model checks, naming, REST conventions, and utility isolation.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"homepage": "https://eslint.interlace.tools/docs/quality/plugin-modularity?utm_source=npm&utm_medium=referral&utm_campaign=eslint-plugin-modularity",
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
|
-
"url": "https://github.com/ofri-peretz/eslint",
|
|
23
|
+
"url": "git+https://github.com/ofri-peretz/eslint.git",
|
|
24
24
|
"directory": "packages/eslint-plugin-modularity"
|
|
25
25
|
},
|
|
26
26
|
"bugs": {
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"src/",
|
|
34
|
-
"dist/",
|
|
35
34
|
"README.md",
|
|
36
35
|
"LICENSE"
|
|
37
36
|
],
|
|
@@ -60,19 +59,13 @@
|
|
|
60
59
|
},
|
|
61
60
|
"dependencies": {
|
|
62
61
|
"tslib": "^2.3.0",
|
|
63
|
-
"@interlace/eslint-devkit": "
|
|
64
|
-
},
|
|
65
|
-
"scripts": {
|
|
66
|
-
"build": "tsx ../../scripts/build-package.ts",
|
|
67
|
-
"test": "vitest run",
|
|
68
|
-
"test:coverage": "vitest run --coverage",
|
|
69
|
-
"typecheck": "tsc -p tsconfig.lib.json --noEmit"
|
|
62
|
+
"@interlace/eslint-devkit": "^1.6.1"
|
|
70
63
|
},
|
|
71
64
|
"peerDependencies": {
|
|
72
65
|
"eslint": "^8.0.0 || ^9.0.0 || ^10.0.0"
|
|
73
66
|
},
|
|
74
67
|
"funding": {
|
|
75
68
|
"type": "github",
|
|
76
|
-
"url": "https://github.com/ofri-peretz/eslint"
|
|
69
|
+
"url": "git+https://github.com/ofri-peretz/eslint.git"
|
|
77
70
|
}
|
|
78
71
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
// Minimal declaration written by scripts/build-package.ts.
|
|
2
|
+
//
|
|
3
|
+
// tsc's generated entry declaration inlined every inferred rule-option type
|
|
4
|
+
// (up to 166 kB per plugin) for an API no consumer calls directly. This types
|
|
5
|
+
// what a flat config actually touches. Per-rule option types remain available
|
|
6
|
+
// from the "./types" subpath export where a plugin provides one.
|
|
7
|
+
import type { Linter, Rule } from 'eslint';
|
|
8
|
+
|
|
9
|
+
export declare const rules: Record<string, Rule.RuleModule>;
|
|
10
|
+
export declare const configs: Record<string, Linter.Config>;
|
|
11
|
+
export declare const plugin: {
|
|
12
|
+
meta: { name: string; version: string };
|
|
13
|
+
rules: Record<string, Rule.RuleModule>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare const _default: typeof plugin;
|
|
17
|
+
export default _default;
|
package/src/index.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.configs = exports.plugin = exports.rules = void 0;
|
|
9
4
|
const ddd_anemic_domain_model_1 = require("./rules/ddd-anemic-domain-model");
|
|
@@ -12,9 +7,6 @@ const enforce_naming_1 = require("./rules/enforce-naming");
|
|
|
12
7
|
const enforce_rest_conventions_1 = require("./rules/enforce-rest-conventions");
|
|
13
8
|
const no_external_api_calls_in_utils_1 = require("./rules/no-external-api-calls-in-utils");
|
|
14
9
|
const no_mutable_exports_1 = require("./rules/no-mutable-exports");
|
|
15
|
-
/**
|
|
16
|
-
* Collection of all modularity and design pattern ESLint rules
|
|
17
|
-
*/
|
|
18
10
|
exports.rules = {
|
|
19
11
|
'ddd-anemic-domain-model': ddd_anemic_domain_model_1.dddAnemicDomainModel,
|
|
20
12
|
'ddd-value-object-immutability': ddd_value_object_immutability_1.dddValueObjectImmutability,
|
|
@@ -23,19 +15,13 @@ exports.rules = {
|
|
|
23
15
|
'no-external-api-calls-in-utils': no_external_api_calls_in_utils_1.noExternalApiCallsInUtils,
|
|
24
16
|
'no-mutable-exports': no_mutable_exports_1.noMutableExports,
|
|
25
17
|
};
|
|
26
|
-
/**
|
|
27
|
-
* ESLint Plugin object
|
|
28
|
-
*/
|
|
29
18
|
exports.plugin = {
|
|
30
19
|
meta: {
|
|
31
20
|
name: 'eslint-plugin-modularity',
|
|
32
|
-
version: '2.1.
|
|
21
|
+
version: '2.1.5',
|
|
33
22
|
},
|
|
34
23
|
rules: exports.rules,
|
|
35
24
|
};
|
|
36
|
-
/**
|
|
37
|
-
* Preset configurations for modularity rules
|
|
38
|
-
*/
|
|
39
25
|
const recommendedRules = {
|
|
40
26
|
'modularity/ddd-anemic-domain-model': 'warn',
|
|
41
27
|
'modularity/ddd-value-object-immutability': 'error',
|
|
@@ -59,4 +45,3 @@ exports.configs = {
|
|
|
59
45
|
},
|
|
60
46
|
};
|
|
61
47
|
exports.default = exports.plugin;
|
|
62
|
-
//# sourceMappingURL=index.js.map
|
package/src/oxlint.d.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
19
|
-
import { plugin } from './index';
|
|
20
|
-
export = plugin;
|
|
1
|
+
// Minimal declaration written by scripts/build-package.ts.
|
|
2
|
+
//
|
|
3
|
+
// tsc's generated entry declaration inlined every inferred rule-option type
|
|
4
|
+
// (up to 166 kB per plugin) for an API no consumer calls directly. This types
|
|
5
|
+
// what a flat config actually touches. Per-rule option types remain available
|
|
6
|
+
// from the "./types" subpath export where a plugin provides one.
|
|
7
|
+
import type { Linter, Rule } from 'eslint';
|
|
8
|
+
|
|
9
|
+
export declare const rules: Record<string, Rule.RuleModule>;
|
|
10
|
+
export declare const configs: Record<string, Linter.Config>;
|
|
11
|
+
export declare const plugin: {
|
|
12
|
+
meta: { name: string; version: string };
|
|
13
|
+
rules: Record<string, Rule.RuleModule>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare const _default: typeof plugin;
|
|
17
|
+
export default _default;
|
package/src/oxlint.js
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* oxlint sub-export.
|
|
9
|
-
*
|
|
10
|
-
* Consumers wire oxlint to this entry via:
|
|
11
|
-
* { "jsPlugins": ["eslint-plugin-modularity/oxlint"] }
|
|
12
|
-
*
|
|
13
|
-
* oxlint's JS plugin loader does `require('eslint-plugin-modularity/oxlint')` and reads
|
|
14
|
-
* `.rules` off the result. The compiled output of `export = plugin` is
|
|
15
|
-
* `module.exports = plugin`, which gives oxlint the plugin object directly
|
|
16
|
-
* (`{ meta, rules }`) — no wrapper, no `.default` indirection.
|
|
17
|
-
*
|
|
18
|
-
* Generated by scripts/generate-oxlint-shims.mjs. Do not edit by hand.
|
|
19
|
-
*/
|
|
20
2
|
const index_1 = require("./index");
|
|
21
3
|
module.exports = index_1.plugin;
|
|
22
|
-
//# sourceMappingURL=oxlint.js.map
|
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.dddAnemicDomainModel = void 0;
|
|
9
4
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
10
5
|
const eslint_devkit_2 = require("@interlace/eslint-devkit");
|
|
11
|
-
/**
|
|
12
|
-
* Check if a class is likely a DTO
|
|
13
|
-
*/
|
|
14
6
|
function isDto(className, dtoPatterns) {
|
|
15
7
|
return dtoPatterns.some(pattern => className.includes(pattern));
|
|
16
8
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Check if a method is a simple getter/setter in disguise
|
|
19
|
-
*/
|
|
20
9
|
function isSimpleGetterSetter(member) {
|
|
21
10
|
if (member.value.type !== 'FunctionExpression') {
|
|
22
11
|
return false;
|
|
@@ -26,30 +15,21 @@ function isSimpleGetterSetter(member) {
|
|
|
26
15
|
if (body.type !== 'BlockStatement' || body.body.length === 0) {
|
|
27
16
|
return false;
|
|
28
17
|
}
|
|
29
|
-
// Check if it's a simple getter (getName() { return this.name; })
|
|
30
18
|
if (methodName.startsWith('get') && body.body.length === 1) {
|
|
31
19
|
const statement = body.body[0];
|
|
32
20
|
if (statement.type === 'ReturnStatement' && statement.argument) {
|
|
33
|
-
// Simple return statement
|
|
34
21
|
return true;
|
|
35
22
|
}
|
|
36
23
|
}
|
|
37
|
-
// Check if it's a simple setter (setName(name) { this.name = name; })
|
|
38
24
|
if (methodName.startsWith('set') && body.body.length === 1) {
|
|
39
25
|
const statement = body.body[0];
|
|
40
26
|
if (statement.type === 'ExpressionStatement' &&
|
|
41
27
|
statement.expression.type === 'AssignmentExpression') {
|
|
42
|
-
// Simple assignment
|
|
43
28
|
return true;
|
|
44
29
|
}
|
|
45
30
|
}
|
|
46
31
|
return false;
|
|
47
32
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Check if a method is pure delegation (just calls another method and returns)
|
|
50
|
-
* e.g., save() { return this.repository.save(this); }
|
|
51
|
-
* Does NOT count calls to array methods, built-ins, or methods on this
|
|
52
|
-
*/
|
|
53
33
|
function isPureDelegation(member) {
|
|
54
34
|
if (member.value.type !== 'FunctionExpression') {
|
|
55
35
|
return false;
|
|
@@ -59,51 +39,42 @@ function isPureDelegation(member) {
|
|
|
59
39
|
return false;
|
|
60
40
|
}
|
|
61
41
|
const statement = body.body[0];
|
|
62
|
-
// Array/collection methods that are business logic, not delegation
|
|
63
42
|
const builtInMethods = new Set([
|
|
64
43
|
'map', 'filter', 'reduce', 'forEach', 'find', 'findIndex', 'some', 'every',
|
|
65
44
|
'includes', 'indexOf', 'slice', 'concat', 'join', 'sort', 'reverse',
|
|
66
45
|
'push', 'pop', 'shift', 'unshift', 'splice', 'flat', 'flatMap',
|
|
67
46
|
'toString', 'valueOf', 'toJSON'
|
|
68
47
|
]);
|
|
69
|
-
// Check: return someService.method(...) or return this.service.method(...)
|
|
70
48
|
if (statement.type === 'ReturnStatement' && statement.argument) {
|
|
71
49
|
const arg = statement.argument;
|
|
72
50
|
if (arg.type === 'CallExpression' && arg.callee.type === 'MemberExpression') {
|
|
73
51
|
const callee = arg.callee;
|
|
74
52
|
const methodName = callee.property.type === 'Identifier' ? callee.property.name : '';
|
|
75
|
-
// Skip if it's a built-in method (not delegation)
|
|
76
53
|
if (builtInMethods.has(methodName)) {
|
|
77
54
|
return false;
|
|
78
55
|
}
|
|
79
|
-
// It's a delegation call, check if it's to an external service
|
|
80
56
|
const object = callee.object;
|
|
81
57
|
if (object.type === 'MemberExpression' &&
|
|
82
58
|
object.object.type === 'ThisExpression') {
|
|
83
|
-
// this.service.method() pattern - but only if not a built-in
|
|
84
59
|
const propName = object.property.type === 'Identifier' ? object.property.name : '';
|
|
85
|
-
// Common service patterns: repository, service, api, client, dao
|
|
86
60
|
if (propName.includes('repository') || propName.includes('service') ||
|
|
87
61
|
propName.includes('api') || propName.includes('client') ||
|
|
88
62
|
propName.includes('dao') || propName.includes('Repository') ||
|
|
89
63
|
propName.includes('Service') || propName.includes('Api')) {
|
|
90
64
|
return true;
|
|
91
65
|
}
|
|
92
|
-
return false;
|
|
66
|
+
return false;
|
|
93
67
|
}
|
|
94
68
|
if (object.type === 'Identifier') {
|
|
95
|
-
// externalService.method() pattern - definitely delegation
|
|
96
69
|
return true;
|
|
97
70
|
}
|
|
98
71
|
}
|
|
99
72
|
}
|
|
100
|
-
// Check: this.service.method(...) without return (void delegation)
|
|
101
73
|
if (statement.type === 'ExpressionStatement') {
|
|
102
74
|
const expr = statement.expression;
|
|
103
75
|
if (expr.type === 'CallExpression' && expr.callee.type === 'MemberExpression') {
|
|
104
76
|
const callee = expr.callee;
|
|
105
77
|
const methodName = callee.property.type === 'Identifier' ? callee.property.name : '';
|
|
106
|
-
// Skip built-in methods
|
|
107
78
|
if (builtInMethods.has(methodName)) {
|
|
108
79
|
return false;
|
|
109
80
|
}
|
|
@@ -123,38 +94,29 @@ function isPureDelegation(member) {
|
|
|
123
94
|
}
|
|
124
95
|
return false;
|
|
125
96
|
}
|
|
126
|
-
/**
|
|
127
|
-
* Count business logic methods (non-getter/setter/delegation)
|
|
128
|
-
*/
|
|
129
97
|
function countBusinessMethods(node) {
|
|
130
98
|
let count = 0;
|
|
131
99
|
for (const member of node.body.body) {
|
|
132
100
|
if (member.type === 'MethodDefinition') {
|
|
133
101
|
const methodName = member.key.type === 'Identifier' ? member.key.name : '';
|
|
134
|
-
// Skip getters and setters
|
|
135
102
|
if (member.kind === 'get' || member.kind === 'set') {
|
|
136
103
|
continue;
|
|
137
104
|
}
|
|
138
|
-
// Skip constructor
|
|
139
105
|
if (methodName === 'constructor') {
|
|
140
106
|
continue;
|
|
141
107
|
}
|
|
142
|
-
// Skip simple getter/setter methods in disguise
|
|
143
108
|
if (isSimpleGetterSetter(member)) {
|
|
144
109
|
continue;
|
|
145
110
|
}
|
|
146
|
-
// Skip pure delegation methods (just calls external service)
|
|
147
111
|
if (isPureDelegation(member)) {
|
|
148
112
|
continue;
|
|
149
113
|
}
|
|
150
|
-
// Count methods (any method that's not a getter/setter/constructor/delegation is business logic)
|
|
151
114
|
const valueType = member.value.type;
|
|
152
115
|
if (valueType === 'FunctionExpression' || valueType === 'ArrowFunctionExpression') {
|
|
153
116
|
count++;
|
|
154
117
|
}
|
|
155
118
|
}
|
|
156
119
|
else if (member.type === 'PropertyDefinition') {
|
|
157
|
-
// Property definitions are not business logic
|
|
158
120
|
continue;
|
|
159
121
|
}
|
|
160
122
|
}
|
|
@@ -237,15 +199,11 @@ exports.dddAnemicDomainModel = (0, eslint_devkit_2.createRule)({
|
|
|
237
199
|
],
|
|
238
200
|
create(context, [options = {}]) {
|
|
239
201
|
const { minBusinessMethods = 1, ignoreDtos = true, dtoPatterns = ['DTO', 'Dto', 'Data', 'Request', 'Response', 'Payload'], } = options || {};
|
|
240
|
-
/**
|
|
241
|
-
* Check class declarations
|
|
242
|
-
*/
|
|
243
202
|
function checkClass(node) {
|
|
244
203
|
if (!node.id) {
|
|
245
|
-
return;
|
|
204
|
+
return;
|
|
246
205
|
}
|
|
247
206
|
const className = node.id.name;
|
|
248
|
-
// Check if it's a DTO
|
|
249
207
|
if (ignoreDtos && isDto(className, dtoPatterns)) {
|
|
250
208
|
return;
|
|
251
209
|
}
|
|
@@ -283,4 +241,3 @@ exports.dddAnemicDomainModel = (0, eslint_devkit_2.createRule)({
|
|
|
283
241
|
};
|
|
284
242
|
},
|
|
285
243
|
});
|
|
286
|
-
//# sourceMappingURL=ddd-anemic-domain-model.js.map
|
|
@@ -1,32 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.dddValueObjectImmutability = void 0;
|
|
9
4
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
10
5
|
const eslint_devkit_2 = require("@interlace/eslint-devkit");
|
|
11
|
-
/**
|
|
12
|
-
* Check if a class name suggests a value object
|
|
13
|
-
*/
|
|
14
6
|
function isValueObject(className, patterns) {
|
|
15
7
|
return patterns.some(pattern => className.includes(pattern));
|
|
16
8
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Check if property has readonly modifier.
|
|
19
|
-
* The rule only visits classes, so only PropertyDefinition can reach here
|
|
20
|
-
* (the former TSPropertySignature branch was unreachable dead code).
|
|
21
|
-
*/
|
|
22
9
|
function hasReadonlyModifier(node) {
|
|
23
10
|
return node.readonly === true;
|
|
24
11
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Check if class uses Object.freeze
|
|
27
|
-
*/
|
|
28
12
|
function usesObjectFreeze(node) {
|
|
29
|
-
// Check constructor for Object.freeze(this)
|
|
30
13
|
for (const member of node.body.body) {
|
|
31
14
|
if (member.type === 'MethodDefinition' && member.kind === 'constructor') {
|
|
32
15
|
const constructor = member.value;
|
|
@@ -134,23 +117,17 @@ exports.dddValueObjectImmutability = (0, eslint_devkit_2.createRule)({
|
|
|
134
117
|
],
|
|
135
118
|
create(context, [options = {}]) {
|
|
136
119
|
const { valueObjectPatterns = ['Value', 'VO', 'ValueObject'], requireReadonly = true, checkObjectFreeze = true, } = options || {};
|
|
137
|
-
/**
|
|
138
|
-
* Check class declarations
|
|
139
|
-
*/
|
|
140
120
|
function checkClass(node) {
|
|
141
121
|
if (!node.id) {
|
|
142
122
|
return;
|
|
143
123
|
}
|
|
144
124
|
const className = node.id.name;
|
|
145
|
-
// Check if it's a value object
|
|
146
125
|
if (!isValueObject(className, valueObjectPatterns)) {
|
|
147
126
|
return;
|
|
148
127
|
}
|
|
149
|
-
// Check if Object.freeze is used
|
|
150
128
|
if (checkObjectFreeze && usesObjectFreeze(node)) {
|
|
151
|
-
return;
|
|
129
|
+
return;
|
|
152
130
|
}
|
|
153
|
-
// Check properties for readonly
|
|
154
131
|
const mutableProperties = [];
|
|
155
132
|
for (const member of node.body.body) {
|
|
156
133
|
if (member.type === 'PropertyDefinition') {
|
|
@@ -169,7 +146,7 @@ exports.dddValueObjectImmutability = (0, eslint_devkit_2.createRule)({
|
|
|
169
146
|
suggest: [
|
|
170
147
|
{
|
|
171
148
|
messageId: 'addReadonly',
|
|
172
|
-
fix: () => null,
|
|
149
|
+
fix: () => null,
|
|
173
150
|
},
|
|
174
151
|
{
|
|
175
152
|
messageId: 'useObjectFreeze',
|
|
@@ -189,4 +166,3 @@ exports.dddValueObjectImmutability = (0, eslint_devkit_2.createRule)({
|
|
|
189
166
|
};
|
|
190
167
|
},
|
|
191
168
|
});
|
|
192
|
-
//# sourceMappingURL=ddd-value-object-immutability.js.map
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.enforceNaming = void 0;
|
|
9
4
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -21,7 +16,6 @@ exports.enforceNaming = (0, eslint_devkit_2.createRule)({
|
|
|
21
16
|
fixable: 'code',
|
|
22
17
|
hasSuggestions: true,
|
|
23
18
|
messages: {
|
|
24
|
-
// 🎯 Token optimization: 46% reduction (56→30 tokens) - domain terminology keeps code clear
|
|
25
19
|
wrongTerminology: (0, eslint_devkit_1.formatLLMMessage)({
|
|
26
20
|
icon: eslint_devkit_1.MessageIcons.QUALITY,
|
|
27
21
|
issueName: 'Domain terminology mismatch',
|
|
@@ -61,7 +55,7 @@ exports.enforceNaming = (0, eslint_devkit_2.createRule)({
|
|
|
61
55
|
items: {
|
|
62
56
|
type: 'object',
|
|
63
57
|
properties: {
|
|
64
|
-
incorrect: { type: ['string', 'object'] },
|
|
58
|
+
incorrect: { type: ['string', 'object'] },
|
|
65
59
|
correct: { type: 'string' },
|
|
66
60
|
context: { type: 'string' },
|
|
67
61
|
examples: {
|
|
@@ -88,17 +82,11 @@ exports.enforceNaming = (0, eslint_devkit_2.createRule)({
|
|
|
88
82
|
},
|
|
89
83
|
],
|
|
90
84
|
create(context) {
|
|
91
|
-
// `context.options[0] || {}` guarantees a truthy object, so no extra
|
|
92
|
-
// `|| {}` fallback is needed on the destructure below.
|
|
93
85
|
const options = context.options[0] || {};
|
|
94
86
|
const { domain = 'general', terms = [] } = options;
|
|
95
|
-
// Early return if no terms configured
|
|
96
87
|
if (!terms || terms.length === 0) {
|
|
97
88
|
return {};
|
|
98
89
|
}
|
|
99
|
-
/**
|
|
100
|
-
* Check if identifier violates domain terms
|
|
101
|
-
*/
|
|
102
90
|
const checkIdentifier = (name) => {
|
|
103
91
|
for (const term of terms) {
|
|
104
92
|
if (typeof term.incorrect === 'string') {
|
|
@@ -114,11 +102,6 @@ exports.enforceNaming = (0, eslint_devkit_2.createRule)({
|
|
|
114
102
|
}
|
|
115
103
|
return null;
|
|
116
104
|
};
|
|
117
|
-
/**
|
|
118
|
-
* Preserve case when replacing term
|
|
119
|
-
* e.g., User -> Customer, user -> customer, USER -> CUSTOMER
|
|
120
|
-
*/
|
|
121
|
-
// oxlint-disable-next-line consistent-function-scoping
|
|
122
105
|
const preserveCase = (original, replacement) => {
|
|
123
106
|
if (original === original.toUpperCase()) {
|
|
124
107
|
return replacement.toUpperCase();
|
|
@@ -128,22 +111,14 @@ exports.enforceNaming = (0, eslint_devkit_2.createRule)({
|
|
|
128
111
|
}
|
|
129
112
|
return replacement.toLowerCase();
|
|
130
113
|
};
|
|
131
|
-
/**
|
|
132
|
-
* Generate replacement suggestion
|
|
133
|
-
*/
|
|
134
114
|
const generateReplacement = (name, term) => {
|
|
135
115
|
if (typeof term.incorrect === 'string') {
|
|
136
|
-
// Case-preserving replacement
|
|
137
116
|
return name.replace(new RegExp(`(${term.incorrect})`, 'gi'), (match) => {
|
|
138
117
|
return preserveCase(match, term.correct);
|
|
139
118
|
});
|
|
140
119
|
}
|
|
141
|
-
// For regex, just suggest the correct term
|
|
142
120
|
return term.correct;
|
|
143
121
|
};
|
|
144
|
-
/**
|
|
145
|
-
* Report violation
|
|
146
|
-
*/
|
|
147
122
|
const reportViolation = (node, violatedTerm) => {
|
|
148
123
|
const replacement = generateReplacement(node.name, violatedTerm);
|
|
149
124
|
context.report({
|
|
@@ -167,7 +142,6 @@ exports.enforceNaming = (0, eslint_devkit_2.createRule)({
|
|
|
167
142
|
});
|
|
168
143
|
};
|
|
169
144
|
return {
|
|
170
|
-
// Check variable declarations
|
|
171
145
|
VariableDeclarator(node) {
|
|
172
146
|
if (node.id.type !== 'Identifier')
|
|
173
147
|
return;
|
|
@@ -176,7 +150,6 @@ exports.enforceNaming = (0, eslint_devkit_2.createRule)({
|
|
|
176
150
|
reportViolation(node.id, violatedTerm);
|
|
177
151
|
}
|
|
178
152
|
},
|
|
179
|
-
// Check function declarations
|
|
180
153
|
FunctionDeclaration(node) {
|
|
181
154
|
if (!node.id)
|
|
182
155
|
return;
|
|
@@ -185,7 +158,6 @@ exports.enforceNaming = (0, eslint_devkit_2.createRule)({
|
|
|
185
158
|
reportViolation(node.id, violatedTerm);
|
|
186
159
|
}
|
|
187
160
|
},
|
|
188
|
-
// Check class declarations
|
|
189
161
|
ClassDeclaration(node) {
|
|
190
162
|
if (!node.id)
|
|
191
163
|
return;
|
|
@@ -194,7 +166,6 @@ exports.enforceNaming = (0, eslint_devkit_2.createRule)({
|
|
|
194
166
|
reportViolation(node.id, violatedTerm);
|
|
195
167
|
}
|
|
196
168
|
},
|
|
197
|
-
// Check property definitions
|
|
198
169
|
PropertyDefinition(node) {
|
|
199
170
|
if (node.key.type !== 'Identifier')
|
|
200
171
|
return;
|
|
@@ -203,7 +174,6 @@ exports.enforceNaming = (0, eslint_devkit_2.createRule)({
|
|
|
203
174
|
reportViolation(node.key, violatedTerm);
|
|
204
175
|
}
|
|
205
176
|
},
|
|
206
|
-
// Check method definitions
|
|
207
177
|
MethodDefinition(node) {
|
|
208
178
|
if (node.key.type !== 'Identifier')
|
|
209
179
|
return;
|
|
@@ -215,4 +185,3 @@ exports.enforceNaming = (0, eslint_devkit_2.createRule)({
|
|
|
215
185
|
};
|
|
216
186
|
},
|
|
217
187
|
});
|
|
218
|
-
//# sourceMappingURL=enforce-naming.js.map
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.enforceRestConventions = void 0;
|
|
9
4
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -83,29 +78,19 @@ exports.enforceRestConventions = (0, eslint_devkit_2.createRule)({
|
|
|
83
78
|
],
|
|
84
79
|
create(context, [options = {}]) {
|
|
85
80
|
const { checkStatusCodes = true, checkResourceNaming = true, } = options || {};
|
|
86
|
-
/**
|
|
87
|
-
* Check CallExpression for REST API patterns
|
|
88
|
-
*/
|
|
89
81
|
function checkCallExpression(node) {
|
|
90
|
-
// Check for Express/Fastify route handlers: app.get(), router.post(), etc.
|
|
91
82
|
if (node.callee.type === 'MemberExpression') {
|
|
92
83
|
const property = node.callee.property;
|
|
93
84
|
if (property.type === 'Identifier') {
|
|
94
85
|
const methodName = property.name.toLowerCase();
|
|
95
86
|
const httpMethods = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options'];
|
|
96
87
|
if (httpMethods.includes(methodName)) {
|
|
97
|
-
// NOTE: every name in `httpMethods` is by construction a valid REST
|
|
98
|
-
// HTTP method, so a "checkHttpMethods" validation here was dead
|
|
99
|
-
// code and has been removed.
|
|
100
|
-
// Check resource naming (first argument should be a path)
|
|
101
88
|
if (checkResourceNaming && node.arguments.length > 0) {
|
|
102
89
|
const pathArg = node.arguments[0];
|
|
103
90
|
if (pathArg.type === 'Literal' && typeof pathArg.value === 'string') {
|
|
104
91
|
const path = pathArg.value;
|
|
105
|
-
// Check if path uses plural nouns (basic check)
|
|
106
92
|
if (path.startsWith('/') && path.length > 1) {
|
|
107
93
|
const resource = path.split('/')[1];
|
|
108
|
-
// Basic check: resource should be plural or have :id
|
|
109
94
|
if (!path.includes(':') && !resource.endsWith('s') && resource.length > 3) {
|
|
110
95
|
context.report({
|
|
111
96
|
node: pathArg,
|
|
@@ -125,12 +110,9 @@ exports.enforceRestConventions = (0, eslint_devkit_2.createRule)({
|
|
|
125
110
|
}
|
|
126
111
|
}
|
|
127
112
|
}
|
|
128
|
-
// Check for status code usage: res.status(200)
|
|
129
113
|
if (checkStatusCodes && node.callee.type === 'MemberExpression') {
|
|
130
114
|
const property = node.callee.property;
|
|
131
115
|
if (property.type === 'Identifier' && property.name === 'status') {
|
|
132
|
-
// Check if status code is appropriate (would need to track HTTP method)
|
|
133
|
-
// This is simplified - full implementation would track the HTTP method from parent
|
|
134
116
|
}
|
|
135
117
|
}
|
|
136
118
|
}
|
|
@@ -139,4 +121,3 @@ exports.enforceRestConventions = (0, eslint_devkit_2.createRule)({
|
|
|
139
121
|
};
|
|
140
122
|
},
|
|
141
123
|
});
|
|
142
|
-
//# sourceMappingURL=enforce-rest-conventions.js.map
|
|
@@ -1,25 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.noExternalApiCallsInUtils = void 0;
|
|
9
4
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
10
5
|
const eslint_devkit_2 = require("@interlace/eslint-devkit");
|
|
11
|
-
/**
|
|
12
|
-
* Check if file is a utility file
|
|
13
|
-
*/
|
|
14
6
|
function isUtilityFile(filename, patterns) {
|
|
15
7
|
return patterns.some(pattern => {
|
|
16
8
|
const regex = new RegExp(pattern.replace(/\*\*/g, '.*').replace(/\*/g, '[^/]*'));
|
|
17
9
|
return regex.test(filename);
|
|
18
10
|
});
|
|
19
11
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Check if call is a network call
|
|
22
|
-
*/
|
|
23
12
|
function isNetworkCall(node, networkMethods) {
|
|
24
13
|
if (node.callee.type === 'Identifier') {
|
|
25
14
|
return networkMethods.includes(node.callee.name);
|
|
@@ -119,9 +108,6 @@ exports.noExternalApiCallsInUtils = (0, eslint_devkit_2.createRule)({
|
|
|
119
108
|
if (!isUtility) {
|
|
120
109
|
return {};
|
|
121
110
|
}
|
|
122
|
-
/**
|
|
123
|
-
* Check for network calls
|
|
124
|
-
*/
|
|
125
111
|
function checkCallExpression(node) {
|
|
126
112
|
if (isNetworkCall(node, networkMethods)) {
|
|
127
113
|
context.report({
|
|
@@ -149,4 +135,3 @@ exports.noExternalApiCallsInUtils = (0, eslint_devkit_2.createRule)({
|
|
|
149
135
|
};
|
|
150
136
|
},
|
|
151
137
|
});
|
|
152
|
-
//# sourceMappingURL=no-external-api-calls-in-utils.js.map
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.noMutableExports = void 0;
|
|
9
4
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -43,7 +38,6 @@ exports.noMutableExports = (0, eslint_devkit_1.createRule)({
|
|
|
43
38
|
messageId: 'noMutableExport',
|
|
44
39
|
data: { kind: decl.kind },
|
|
45
40
|
fix(fixer) {
|
|
46
|
-
// Replace `let` or `var` keyword with `const`
|
|
47
41
|
const sourceCode = context.sourceCode;
|
|
48
42
|
const kindToken = sourceCode.getFirstToken(decl);
|
|
49
43
|
if (!kindToken)
|
|
@@ -55,4 +49,3 @@ exports.noMutableExports = (0, eslint_devkit_1.createRule)({
|
|
|
55
49
|
};
|
|
56
50
|
},
|
|
57
51
|
});
|
|
58
|
-
//# sourceMappingURL=no-mutable-exports.js.map
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,6EAAuE;AACvE,yFAAmF;AACnF,2DAAuD;AACvD,+EAA0E;AAC1E,2FAAmF;AACnF,mEAA8D;AAI9D;;GAEG;AACU,QAAA,KAAK,GAAoE;IACpF,yBAAyB,EAAE,8CAAoB;IAC/C,+BAA+B,EAAE,0DAA0B;IAC3D,gBAAgB,EAAE,8BAAa;IAC/B,0BAA0B,EAAE,iDAAsB;IAClD,gCAAgC,EAAE,0DAAyB;IAC3D,oBAAoB,EAAE,qCAAgB;CACmC,CAAC;AAE5E;;GAEG;AACU,QAAA,MAAM,GAA+B;IAChD,IAAI,EAAE;QACJ,IAAI,EAAE,0BAA0B;QAChC,OAAO,EAAE,OAAO;KACjB;IACD,KAAK,EAAL,aAAK;CAC+B,CAAC;AAEvC;;GAEG;AACH,MAAM,gBAAgB,GAAkD;IACtE,oCAAoC,EAAE,MAAM;IAC5C,0CAA0C,EAAE,OAAO;IACnD,2BAA2B,EAAE,MAAM;IACnC,qCAAqC,EAAE,OAAO;IAC9C,2CAA2C,EAAE,OAAO;IACpD,+BAA+B,EAAE,MAAM;CACxC,CAAC;AAEW,QAAA,OAAO,GAA+C;IACjE,WAAW,EAAE;QACX,OAAO,EAAE;YACP,YAAY,EAAE,cAAM;SACrB;QACD,KAAK,EAAE,gBAAgB;KACa;IAEtC,MAAM,EAAE;QACN,OAAO,EAAE;YACP,YAAY,EAAE,cAAM;SACrB;QACD,KAAK,EAAE,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,IAAI,CAAC,aAAK,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,cAAc,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC,CACxE;KACmC;CACvC,CAAC;AAEF,kBAAe,cAAM,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function eslintPluginModularity(): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-plugin-modularity.js","sourceRoot":"","sources":["../../../src/lib/eslint-plugin-modularity.ts"],"names":[],"mappings":";;AAAA,wDAEC;AAFD,SAAgB,sBAAsB;IACpC,OAAO,0BAA0B,CAAC;AACpC,CAAC"}
|
package/src/oxlint.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oxlint.js","sourceRoot":"","sources":["../../src/oxlint.ts"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH;;;;;;;;;;;;GAYG;AAEH,mCAAiC;AAEjC,iBAAS,cAAM,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: ddd-anemic-domain-model
|
|
8
|
-
* Detects entities with only getters/setters and no business logic
|
|
9
|
-
* Priority 1: Domain-Driven Design
|
|
10
|
-
*
|
|
11
|
-
* @see https://martinfowler.com/bliki/AnemicDomainModel.html
|
|
12
|
-
*/
|
|
13
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
14
|
-
type MessageIds = 'anemicDomainModel' | 'addBusinessLogic' | 'migrateToRichModel' | 'identifyAggregateRoot';
|
|
15
|
-
export interface Options {
|
|
16
|
-
/** Minimum methods required to not be considered anemic. Default: 1 */
|
|
17
|
-
minBusinessMethods?: number;
|
|
18
|
-
/** Ignore DTOs and data transfer objects. Default: true */
|
|
19
|
-
ignoreDtos?: boolean;
|
|
20
|
-
/** Patterns for DTO identification. Default: ['DTO', 'Dto', 'Data', 'Request', 'Response'] */
|
|
21
|
-
dtoPatterns?: string[];
|
|
22
|
-
}
|
|
23
|
-
type RuleOptions = [Options?];
|
|
24
|
-
export declare const dddAnemicDomainModel: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
25
|
-
name: string;
|
|
26
|
-
};
|
|
27
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ddd-anemic-domain-model.js","sourceRoot":"","sources":["../../../src/rules/ddd-anemic-domain-model.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAUH,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CAAC;YAED,MAAM,mBAAmB,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;YAEvD,IAAI,mBAAmB,GAAG,kBAAkB,EAAE,CAAC;gBAC7C,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,mBAAmB;oBAC9B,IAAI,EAAE;wBACJ,SAAS;qBACV;oBACD,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,kBAAkB;4BAC7B,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI;4BACf,IAAI,EAAE;gCACJ,SAAS;6BACV;yBACF;wBACD;4BACE,SAAS,EAAE,oBAAoB;4BAC/B,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI;yBAChB;wBACD;4BACE,SAAS,EAAE,uBAAuB;4BAClC,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI;yBAChB;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO;YACL,gBAAgB,EAAE,UAAU;YAC5B,eAAe,EAAE,UAAU;SAC5B,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: ddd-value-object-immutability
|
|
8
|
-
* Validates value objects are properly immutable
|
|
9
|
-
* Priority 1: Domain-Driven Design
|
|
10
|
-
*
|
|
11
|
-
* @see https://martinfowler.com/bliki/ValueObject.html
|
|
12
|
-
*/
|
|
13
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
14
|
-
type MessageIds = 'mutableValueObject' | 'mutableNestedType' | 'addReadonly' | 'useObjectFreeze' | 'makeImmutable';
|
|
15
|
-
export interface Options {
|
|
16
|
-
/** Patterns to identify value objects. Default: ['Value', 'VO', 'ValueObject'] */
|
|
17
|
-
valueObjectPatterns?: string[];
|
|
18
|
-
/** Require readonly modifiers. Default: true */
|
|
19
|
-
requireReadonly?: boolean;
|
|
20
|
-
/** Check for Object.freeze usage. Default: true */
|
|
21
|
-
checkObjectFreeze?: boolean;
|
|
22
|
-
}
|
|
23
|
-
type RuleOptions = [Options?];
|
|
24
|
-
export declare const dddValueObjectImmutability: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
25
|
-
name: string;
|
|
26
|
-
};
|
|
27
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ddd-value-object-immutability.js","sourceRoot":"","sources":["../../../src/rules/ddd-value-object-immutability.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAUH,4DAA0E;AAC1E,4DAAsD;AAsBtD;;GAEG;AACH,SAAS,aAAa,CACpB,SAAiB,EACjB,QAAkB;IAElB,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,IAAiC;IAC5D,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CACvB,IAA0D;IAE1D,4CAA4C;IAC5C,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACpC,IAAI,MAAM,CAAC,IAAI,KAAK,kBAAkB,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;YACxE,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC;YACjC,IAAI,WAAW,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;gBAC9C,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;gBAC9B,IAAI,IAAI,CAAC,IAAI,KAAK,gBA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AAM,GAAG,CAAC,EAAE,CAAC;gBACjC,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,oBAAoB;oBAC/B,IAAI,EAAE;wBACJ,SAAS;qBACV;oBACD,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,aAAa;4BACxB,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,yCAAyC;yBAC3D;wBACD;4BACE,SAAS,EAAE,iBAAiB;4BAC5B,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI;yBAChB;wBACD;4BACE,SAAS,EAAE,eAAe;4BAC1B,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI;yBAChB;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO;YACL,gBAAgB,EAAE,UAAU;YAC5B,eAAe,EAAE,UAAU;SAC5B,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: enforce-naming
|
|
8
|
-
* Enforce domain-specific naming conventions with business context
|
|
9
|
-
*/
|
|
10
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
11
|
-
type MessageIds = 'wrongTerminology' | 'useDomainTerm' | 'viewGlossary';
|
|
12
|
-
interface DomainTerm {
|
|
13
|
-
incorrect: string | RegExp;
|
|
14
|
-
correct: string;
|
|
15
|
-
context: string;
|
|
16
|
-
examples?: string[];
|
|
17
|
-
}
|
|
18
|
-
export interface Options {
|
|
19
|
-
/** Domain context for naming conventions (e.g., 'ecommerce', 'healthcare') */
|
|
20
|
-
domain?: string;
|
|
21
|
-
/** Array of domain-specific terminology rules */
|
|
22
|
-
terms?: DomainTerm[];
|
|
23
|
-
/** URL to domain glossary documentation */
|
|
24
|
-
glossaryUrl?: string;
|
|
25
|
-
}
|
|
26
|
-
type RuleOptions = [Options?];
|
|
27
|
-
export declare const enforceNaming: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
28
|
-
name: string;
|
|
29
|
-
};
|
|
30
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enforce-naming.js","sourceRoot":"","sources":["../../../src/rules/enforce-naming.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAOH,4DAA0E;AAC1E,4DAAsD;AAwBzC,QAAA,aAAa,GAAG,IAAA,0BAAU,EAA0B;IAC/D,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,GAAG,EAAE,gHAAgH;YACrH,WAAW,EAAE,kEAAkE;YAC/E,GAAG,EAAE,SAAS;YACd,IAAI,EAAE,CAAC;SACR;QACD,OAAO,EAAE,MAAM;QACf,cAAc,EAAE,IAAI;QACpB,QAAQ,EAAE;YACR,4FAA4F;YAC5F,gBAAgB,EAAE,IAAA,gCAAgB,EAAC;gBACjC,IAAI,EAAE,4BAAY,CAAC,OAAO;gBAC1B,SAAS,EAAE,6BAA6B;gBACxC,GAAG,EAAE,SAAS;gBACd,WAAW,EAAE,6BAA6B;gBAC1C,QAAQ,EAAE,QAAQ;gBAClB,GAAG,EAAE,uEAAuE;gBAC5E,iBAAiB,EAAE,iBAAiB;aACrC,CAAC;YACF,aAAa,EAAE,IAAA,gCAAgB,EAAC;gBAC9B,IAAI,EAAE,4BAAY,CAAC,IAAI;gBACvB,SAAS,EAAE,iBAAiB;gBAC5B,WAAW,EAAE,iCAAiC;gBAC9C,QAAQ,EAAE,KAAK;gBACf,GAAG,EAAE,+BAA+B;gBACpC,iBAAiB,EAAE,wDAAwD;aAC5E,CAAC;YACF,YAAY,EAAE,IAAA,gCAAgB,EAAC;gBAC7B,I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AAC,CAAC;gBACpD,IAAI,YAAY,EAAE,CAAC;oBACjB,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;gBAC1C,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: enforce-rest-conventions
|
|
8
|
-
* Validates REST endpoint design against best practices
|
|
9
|
-
* Priority 6: API Design & Evolution
|
|
10
|
-
*
|
|
11
|
-
* @see https://restfulapi.net/
|
|
12
|
-
*/
|
|
13
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
14
|
-
type MessageIds = 'restConventionViolation' | 'useProperHttpMethod' | 'useProperStatusCode' | 'fixResourceNaming';
|
|
15
|
-
export interface Options {
|
|
16
|
-
/** Check HTTP methods. Default: true */
|
|
17
|
-
checkHttpMethods?: boolean;
|
|
18
|
-
/** Check status codes. Default: true */
|
|
19
|
-
checkStatusCodes?: boolean;
|
|
20
|
-
/** Check resource naming. Default: true */
|
|
21
|
-
checkResourceNaming?: boolean;
|
|
22
|
-
}
|
|
23
|
-
type RuleOptions = [Options?];
|
|
24
|
-
export declare const enforceRestConventions: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
25
|
-
name: string;
|
|
26
|
-
};
|
|
27
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enforce-rest-conventions.js","sourceRoot":"","sources":["../../../src/rules/enforce-rest-conventions.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAUH,4DAA0E;AAC1E,4DAAsD;AAqBzC,QAAA,sBAAsB,GAAG,IAAA,0BAAU,EAA0B;IACx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wE;oBACxE,mFAAmF;gBACrF,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO;YACL,cAAc,EAAE,mBAAmB;SACpC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: no-external-api-calls-in-utils
|
|
8
|
-
* Detects network calls in utility functions
|
|
9
|
-
*
|
|
10
|
-
* @see https://rules.sonarsource.com/javascript/RSPEC-1075/
|
|
11
|
-
*/
|
|
12
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
13
|
-
type MessageIds = 'externalApiCallInUtils' | 'useDependencyInjection' | 'extractToService' | 'passApiClient';
|
|
14
|
-
export interface Options {
|
|
15
|
-
ignoreInTests?: boolean;
|
|
16
|
-
networkMethods?: string[];
|
|
17
|
-
utilityPatterns?: string[];
|
|
18
|
-
}
|
|
19
|
-
type RuleOptions = [Options?];
|
|
20
|
-
export declare const noExternalApiCallsInUtils: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
21
|
-
name: string;
|
|
22
|
-
};
|
|
23
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-external-api-calls-in-utils.js","sourceRoot":"","sources":["../../../src/rules/no-external-api-calls-in-utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AASH,4DAA0E;AAC1E,4DAAsD;AAgBtD;;GAEG;AACH,SAAS,aAAa,CAAC,QAAgB,EAAE,QAAkB;IACzD,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;QAC7B,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,IA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AC,EAAE,CAAC;gBACxC,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,wBAAwB;oBACnC,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,wBAAwB;4BACnC,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI;yBAChB;wBACD;4BACE,SAAS,EAAE,kBAAkB;4BAC7B,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI;yBAChB;wBACD;4BACE,SAAS,EAAE,eAAe;4BAC1B,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI;yBAChB;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO;YACL,cAAc,EAAE,mBAAmB;SACpC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: no-mutable-exports
|
|
8
|
-
* Disallow `export let` and `export var` — module exports should be immutable
|
|
9
|
-
* constants so that importers share a stable reference.
|
|
10
|
-
*
|
|
11
|
-
* Mutable module-level exports (`let`/`var`) allow a module to silently change
|
|
12
|
-
* the value seen by all importers. Importers get the _live binding_ and may
|
|
13
|
-
* observe different values over time, which is almost always unintentional and
|
|
14
|
-
* leads to subtle race-condition-like bugs.
|
|
15
|
-
*
|
|
16
|
-
* Correct patterns:
|
|
17
|
-
* export const FOO = 1; // immutable primitive
|
|
18
|
-
* export function foo() { ... } // function declaration (always immutable)
|
|
19
|
-
* export class Foo { ... } // class declaration (always immutable)
|
|
20
|
-
*/
|
|
21
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
22
|
-
export interface Options {
|
|
23
|
-
}
|
|
24
|
-
type RuleOptions = [Options?];
|
|
25
|
-
export declare const noMutableExports: TSESLint.RuleModule<"noMutableExport", RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
26
|
-
name: string;
|
|
27
|
-
};
|
|
28
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-mutable-exports.js","sourceRoot":"","sources":["../../../src/rules/no-mutable-exports.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAkBH,4DAAsD;AACtD,4DAA0E;AAS7D,QAAA,gBAAgB,GAAG,IAAA,0BAAU,EAA0B;IAClE,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,GAAG,EAAE,oHAAoH;YACzH,WAAW,EAAE,oDAAoD;SAClE;QACD,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE;YACR,eAAe,EAAE,IAAA,gCAAgB,EAAC;gBAChC,IAAI,EAAE,4BAAY,CAAC,OAAO;gBAC1B,SAAS,EAAE,gBAAgB;gBAC3B,WAAW,EACT,iHAAiH;gBACnH,QAAQ,EAAE,QAAQ;gBAClB,GAAG,EAAE,4CAA4C;gBACjD,iBAAiB,EACf,qFAAqF;aACxF,CAAC;SACH;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAsD;QAC3D,OAAO;YACL,sBAAsB,CAAC,IAAqC;gBAC1D,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC;gBAC9B,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,qBAAqB;oBAAE,OAAO;gBACzD,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK;oBAAE,OAAO;gBAEvD,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,EAAE,IAAI;oBACV,SAAS,EAAE,iBAAiB;oBAC5B,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;oBACzB,G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