@ddd-ts-kit/eslint-plugin 0.103.0 → 0.104.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/project/locate.js +13 -2
- package/dist/project/locate.js.map +1 -1
- package/dist/rules/domain-no-generic-error.d.ts +2 -1
- package/dist/rules/domain-no-generic-error.d.ts.map +1 -1
- package/dist/rules/domain-no-generic-error.js +36 -8
- package/dist/rules/domain-no-generic-error.js.map +1 -1
- package/dist/rules/layer-application-inward.d.ts +1 -1
- package/dist/rules/layer-application-inward.d.ts.map +1 -1
- package/dist/rules/layer-application-inward.js +6 -11
- package/dist/rules/layer-application-inward.js.map +1 -1
- package/dist/rules/layer-domain-purity.d.ts +1 -1
- package/dist/rules/layer-domain-purity.d.ts.map +1 -1
- package/dist/rules/layer-domain-purity.js +6 -7
- package/dist/rules/layer-domain-purity.js.map +1 -1
- package/dist/rules/ports-abstract-class.d.ts +1 -1
- package/dist/rules/ports-abstract-class.d.ts.map +1 -1
- package/dist/rules/ports-abstract-class.js +14 -2
- package/dist/rules/ports-abstract-class.js.map +1 -1
- package/dist/support/globals/ambient-name.d.ts +4 -2
- package/dist/support/globals/ambient-name.d.ts.map +1 -1
- package/dist/support/globals/ambient-name.js +38 -7
- package/dist/support/globals/ambient-name.js.map +1 -1
- package/dist/support/outside-concerns/judge-package.d.ts +15 -0
- package/dist/support/outside-concerns/judge-package.d.ts.map +1 -0
- package/dist/support/outside-concerns/judge-package.js +18 -0
- package/dist/support/outside-concerns/judge-package.js.map +1 -0
- package/dist/support/outside-concerns/outer-entry.d.ts +5 -0
- package/dist/support/outside-concerns/outer-entry.d.ts.map +1 -0
- package/dist/support/outside-concerns/outer-entry.js +21 -0
- package/dist/support/outside-concerns/outer-entry.js.map +1 -0
- package/dist/support/purity-rule.d.ts.map +1 -1
- package/dist/support/purity-rule.js +31 -0
- package/dist/support/purity-rule.js.map +1 -1
- package/dist/support/tests/test-call.d.ts +3 -2
- package/dist/support/tests/test-call.d.ts.map +1 -1
- package/dist/support/tests/test-call.js +7 -5
- package/dist/support/tests/test-call.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/rules/domain-no-generic-error.fr.md +6 -2
- package/docs/rules/domain-no-generic-error.md +5 -1
- package/docs/rules/layer-application-inward.fr.md +2 -1
- package/docs/rules/layer-application-inward.md +1 -0
- package/docs/rules/layer-domain-purity.fr.md +2 -1
- package/docs/rules/layer-domain-purity.md +1 -0
- package/docs/rules/ports-abstract-class.fr.md +3 -2
- package/docs/rules/ports-abstract-class.md +2 -1
- package/docs/rules/purity-no-ambient-randomness.fr.md +2 -1
- package/docs/rules/purity-no-ambient-randomness.md +1 -0
- package/docs/rules/purity-no-environment.fr.md +2 -1
- package/docs/rules/purity-no-environment.md +1 -0
- package/docs/rules/purity-no-system-clock.fr.md +2 -1
- package/docs/rules/purity-no-system-clock.md +1 -0
- package/docs/rules/test-no-mocks.fr.md +2 -1
- package/docs/rules/test-no-mocks.md +1 -0
- package/docs/rules/test-no-only-no-skip.fr.md +2 -2
- package/docs/rules/test-no-only-no-skip.md +1 -1
- package/package.json +1 -1
package/dist/project/locate.js
CHANGED
|
@@ -45,12 +45,23 @@ const MODULE_TEST_FOLDERS = ['unit', 'integration'];
|
|
|
45
45
|
* A module of the model is one folder of the context holding its layers (`<module>/domain/...`),
|
|
46
46
|
* one folder of the test folders of its specs (`test/unit/<module>/...`), or, as 0.86 and 0.87 laid it out,
|
|
47
47
|
* one folder under domain/ and application/: left out, the rest of the path is what it would be
|
|
48
|
-
* without modules, so every role keeps its place.
|
|
48
|
+
* without modules, so every role keeps its place. At its root, `<module>.module.ts` registers what
|
|
49
|
+
* the module holds in the explicit style: a part of the module file of the context, read as one.
|
|
49
50
|
*/
|
|
50
51
|
function moduleLocation(modules, context, parts) {
|
|
51
|
-
const placed =
|
|
52
|
+
const placed = moduleFile(modules, parts) ??
|
|
53
|
+
inFolderOfModule(modules, parts) ??
|
|
54
|
+
inTestFolder(modules, parts) ??
|
|
55
|
+
inEarlierPlace(modules, parts);
|
|
52
56
|
return placed === undefined ? undefined : { area: 'context', context, ...placed };
|
|
53
57
|
}
|
|
58
|
+
/** `<module>/<module>.module.ts`. */
|
|
59
|
+
function moduleFile(modules, parts) {
|
|
60
|
+
const [module = '', file, ...rest] = parts;
|
|
61
|
+
return modules.includes(module) && file === `${module}.module.ts` && rest.length === 0
|
|
62
|
+
? { layer: 'module', inside: [], module }
|
|
63
|
+
: undefined;
|
|
64
|
+
}
|
|
54
65
|
/** `<module>/<layer>/...`. */
|
|
55
66
|
function inFolderOfModule(modules, [first = '', second = '', ...rest]) {
|
|
56
67
|
const layer = MODULE_LAYERS.find((candidate) => candidate === second);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locate.js","sourceRoot":"","sources":["../../src/project/locate.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,GAAqB;IAC/B,QAAQ;IACR,aAAa;IACb,gBAAgB;IAChB,cAAc;IACd,oBAAoB;IACpB,MAAM;CACP,CAAC;AAEF,0FAA0F;AAC1F,MAAM,UAAU,MAAM,CAAC,MAAc,EAAE,IAAY;IACjD,IAAI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;QACtC,OAAO,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC;QAC1C,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;QACtC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAC9B,CAAC;IAED,IAAI,IAAI,KAAK,GAAG,MAAM,CAAC,UAAU,UAAU,EAAE,CAAC;QAC5C,OAAO,EAAE,IAAI,EA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EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAC1E,CAAC;AAED;;;;;GAKG;AACH,SAAS,aAAa,CAAC,OAAe,EAAE,IAAY;IAClD,IAAI,IAAI,KAAK,GAAG,OAAO,QAAQ,EAAE,CAAC;QAChC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,CAAC;IACvF,CAAC;IAED,OAAO,IAAI,KAAK,GAAG,OAAO,cAAc;QACtC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,eAAe,EAAE,GAAG,OAAO,iBAAiB,CAAC,EAAE;QAC5G,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED,SAAS,OAAO,CAAC,IAAY,EAAE,SAAiB;IAC9C,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
export declare const domainNoGenericError: TSESLint.RuleModule<"generic" | "genericNamed", [], import("../index.js").RuleDocs, TSESLint.RuleListener>;
|
|
2
3
|
//# sourceMappingURL=domain-no-generic-error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-no-generic-error.d.ts","sourceRoot":"","sources":["../../src/rules/domain-no-generic-error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"domain-no-generic-error.d.ts","sourceRoot":"","sources":["../../src/rules/domain-no-generic-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,QAAQ,EAAiB,MAAM,0BAA0B,CAAC;AAgB7F,eAAO,MAAM,oBAAoB,mGAmC/B,CAAC"}
|
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
1
|
+
import { ASTUtils, AST_NODE_TYPES, TSESLint } from '@typescript-eslint/utils';
|
|
2
2
|
import { defineRule } from '../support/rule/define-rule.js';
|
|
3
3
|
import { ambientName } from '../support/globals/ambient-name.js';
|
|
4
|
+
/** The constructors of the language: none of them says what was refused, nor carries a code. */
|
|
5
|
+
const GENERIC_ERRORS = new Set([
|
|
6
|
+
'Error',
|
|
7
|
+
'TypeError',
|
|
8
|
+
'RangeError',
|
|
9
|
+
'ReferenceError',
|
|
10
|
+
'SyntaxError',
|
|
11
|
+
'EvalError',
|
|
12
|
+
'URIError',
|
|
13
|
+
'AggregateError',
|
|
14
|
+
]);
|
|
4
15
|
export const domainNoGenericError = defineRule({
|
|
5
16
|
id: 'domain/no-generic-error',
|
|
6
17
|
type: 'problem',
|
|
7
18
|
recommended: 'error',
|
|
8
|
-
description: 'No `throw new Error(...)` in domain/ or application
|
|
19
|
+
description: 'No `throw new Error(...)` in domain/ or application/, nor of `TypeError`, `RangeError` or another error of the language, thrown directly or through a `const`: an expected failure is a DomainError with a stable code.',
|
|
9
20
|
messages: {
|
|
10
21
|
generic: 'A generic Error says nothing a caller can act on. Throw a DomainError with a stable code, built by a factory of the error class of its concept (`ddd-ts-kit generate error {{context}} <Concept> <refusal>`): presentation maps the code to a status in one place.',
|
|
22
|
+
genericNamed: 'A generic Error says nothing a caller can act on. Throw a refusal with a stable code, a class named after what is refused and built by a factory named after what it is about, `throw <Refusal>.for<Subject>(...)` (`ddd-ts-kit generate error {{context}} <Refusal> for<Subject>`): presentation maps the code to a status in one place.',
|
|
11
23
|
},
|
|
12
24
|
create({ file, sourceCode, report }) {
|
|
13
25
|
const { location } = file;
|
|
@@ -16,17 +28,33 @@ export const domainNoGenericError = defineRule({
|
|
|
16
28
|
(location.layer !== 'domain' && location.layer !== 'application')) {
|
|
17
29
|
return {};
|
|
18
30
|
}
|
|
31
|
+
const messageId = file.config.stack.refusals === 'named' ? 'genericNamed' : 'generic';
|
|
19
32
|
return {
|
|
20
33
|
ThrowStatement(node) {
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
if (ambientName(sourceCode, thrown.callee) === 'Error') {
|
|
26
|
-
report({ node: thrown, messageId: 'generic', data: { context: location.context } });
|
|
34
|
+
const built = construction(sourceCode, node.argument);
|
|
35
|
+
if (built !== undefined && GENERIC_ERRORS.has(ambientName(sourceCode, built.callee) ?? '')) {
|
|
36
|
+
report({ node: node.argument, messageId, data: { context: location.context } });
|
|
27
37
|
}
|
|
28
38
|
},
|
|
29
39
|
};
|
|
30
40
|
},
|
|
31
41
|
});
|
|
42
|
+
/** What a throw builds: `new Error(..)` itself, or the `const` it throws, `const failure = new Error(..)`. */
|
|
43
|
+
function construction(sourceCode, thrown) {
|
|
44
|
+
const value = thrown.type === AST_NODE_TYPES.Identifier ? constValue(sourceCode, thrown) : thrown;
|
|
45
|
+
return value !== undefined && isConstruction(value) ? value : undefined;
|
|
46
|
+
}
|
|
47
|
+
/** What a `const` declared once holds. */
|
|
48
|
+
function constValue(sourceCode, identifier) {
|
|
49
|
+
const [definition, ...others] = ASTUtils.findVariable(sourceCode.getScope(identifier), identifier.name)?.defs ?? [];
|
|
50
|
+
if (definition?.type !== TSESLint.Scope.DefinitionType.Variable ||
|
|
51
|
+
others.length > 0 ||
|
|
52
|
+
definition.parent.kind !== 'const') {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
return definition.node.init ?? undefined;
|
|
56
|
+
}
|
|
57
|
+
function isConstruction(node) {
|
|
58
|
+
return node.type === AST_NODE_TYPES.NewExpression || node.type === AST_NODE_TYPES.CallExpression;
|
|
59
|
+
}
|
|
32
60
|
//# sourceMappingURL=domain-no-generic-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-no-generic-error.js","sourceRoot":"","sources":["../../src/rules/domain-no-generic-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"domain-no-generic-error.js","sourceRoot":"","sources":["../../src/rules/domain-no-generic-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAiB,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,gGAAgG;AAChG,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,OAAO;IACP,WAAW;IACX,YAAY;IACZ,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,UAAU;IACV,gBAAgB;CACjB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAA6B;IACzE,EAAE,EAAE,yBAAyB;IAC7B,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,OAAO;IACpB,WAAW,EACT,yNAAyN;IAC3N,QAAQ,EAAE;QACR,OAAO,EACL,oQAAoQ;QACtQ,YAAY,EACV,2UAA2U;KAC9U;IACD,MAAM,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE;QACjC,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAE1B,IACE,QAAQ,CAAC,IAAI,KAAK,SAAS;YAC3B,IAAI,CAAC,MAAM;YACX,CAAC,QAAQ,CAAC,KAAK,KAAK,QAAQ,IAAI,QAAQ,CAAC,KAAK,KAAK,aAAa,CAAC,EACjE,CAAC;YACD,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CA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O,EAClC,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC;AAC3C,CAAC;AAED,SAAS,cAAc,CAAC,IAAyB;IAC/C,OAAO,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,aAAa,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,cAAc,CAAC;AACnG,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const layerApplicationInward: import("@typescript-eslint/utils/ts-eslint").RuleModule<"builtin" | "outsideConcern" | "outward" | "package", [], import("../index.js").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
1
|
+
export declare const layerApplicationInward: import("@typescript-eslint/utils/ts-eslint").RuleModule<"builtin" | "entry" | "outsideConcern" | "outward" | "package", [], import("../index.js").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
2
2
|
//# sourceMappingURL=layer-application-inward.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layer-application-inward.d.ts","sourceRoot":"","sources":["../../src/rules/layer-application-inward.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layer-application-inward.d.ts","sourceRoot":"","sources":["../../src/rules/layer-application-inward.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,sBAAsB,+MA6CjC,CAAC"}
|
|
@@ -5,7 +5,8 @@ import { describeTarget } from '../support/imports/describe-target.js';
|
|
|
5
5
|
import { importListener } from '../support/imports/import-listener.js';
|
|
6
6
|
import { inLayer } from '../support/imports/in-layer.js';
|
|
7
7
|
import { OUTSIDE_CONCERN_MESSAGE } from '../support/outside-concerns/outside-concern-message.js';
|
|
8
|
-
import {
|
|
8
|
+
import { judgePackage } from '../support/outside-concerns/judge-package.js';
|
|
9
|
+
import { OUTER_ENTRY_MESSAGE } from '../support/outside-concerns/outer-entry.js';
|
|
9
10
|
import { isBackgroundJobFile } from '../support/scheduling/is-background-job-file.js';
|
|
10
11
|
const INWARD = ['domain', 'application', 'published-language'];
|
|
11
12
|
export const layerApplicationInward = defineRule({
|
|
@@ -15,6 +16,7 @@ export const layerApplicationInward = defineRule({
|
|
|
15
16
|
description: 'application/ imports domain/, application/, published languages and the allowed kernel packages: never infrastructure/, presentation/, a framework or a driver. A background job (application/background/*.background-job.ts) also imports @ddd-ts-kit/validation and the validation library of the stack, for the schema of its payload.',
|
|
16
17
|
messages: {
|
|
17
18
|
outsideConcern: OUTSIDE_CONCERN_MESSAGE,
|
|
19
|
+
entry: OUTER_ENTRY_MESSAGE,
|
|
18
20
|
package: 'The application layer imports the package "{{name}}". Declare a port (an abstract class) in application/ports named after the need, implement it with "{{name}}" in infrastructure/, and bind it in {{context}}.module.ts (in the declared style, declare the adapter with `@Adapter`).',
|
|
19
21
|
builtin: 'The application layer imports the Node built-in "{{name}}". Hide the I/O behind a port in application/ports and implement it in infrastructure/external.',
|
|
20
22
|
outward: 'The application layer imports {{target}}. Depend on a port, the abstract class of application/ports or of domain/repositories, instead, and let the module file, or the declaration of the adapter, bind it.',
|
|
@@ -32,16 +34,9 @@ export const layerApplicationInward = defineRule({
|
|
|
32
34
|
return;
|
|
33
35
|
}
|
|
34
36
|
if (target.kind === 'package') {
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
-
report({
|
|
38
|
-
node,
|
|
39
|
-
messageId: 'outsideConcern',
|
|
40
|
-
data: { importer: 'The application layer', specifier, ...concern },
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
else if (!allowed.includes(target.name)) {
|
|
44
|
-
report({ node, messageId: 'package', data: { name: target.name, context: here.context } });
|
|
37
|
+
const judgment = judgePackage('The application layer', { name: target.name, specifier }, allowed);
|
|
38
|
+
if (judgment !== undefined) {
|
|
39
|
+
report({ node, messageId: judgment.messageId, data: { ...judgment.data, context: here.context } });
|
|
45
40
|
}
|
|
46
41
|
}
|
|
47
42
|
else if (target.kind === 'builtin') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layer-application-inward.js","sourceRoot":"","sources":["../../src/rules/layer-application-inward.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"layer-application-inward.js","sourceRoot":"","sources":["../../src/rules/layer-application-inward.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnF,MAAM,MAAM,GAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,oBAAoB,CAAC,CAAC;AAEjF,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAiE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outsideConcern' | 'builtin' | 'upstreamContract' | 'outerLayer';
|
|
1
|
+
type MessageId = 'package' | 'entry' | 'declarations' | 'outsideConcern' | 'builtin' | 'upstreamContract' | 'outerLayer';
|
|
2
2
|
export declare const layerDomainPurity: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageId, [], import("../index.js").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
3
3
|
export {};
|
|
4
4
|
//# sourceMappingURL=layer-domain-purity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layer-domain-purity.d.ts","sourceRoot":"","sources":["../../src/rules/layer-domain-purity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layer-domain-purity.d.ts","sourceRoot":"","sources":["../../src/rules/layer-domain-purity.ts"],"names":[],"mappings":"AAYA,KAAK,SAAS,GACV,SAAS,GACT,OAAO,GACP,cAAc,GACd,gBAAgB,GAChB,SAAS,GACT,kBAAkB,GAClB,YAAY,CAAC;AAEjB,eAAO,MAAM,iBAAiB,0JAqD5B,CAAC"}
|
|
@@ -5,7 +5,8 @@ import { describeTarget } from '../support/imports/describe-target.js';
|
|
|
5
5
|
import { importListener } from '../support/imports/import-listener.js';
|
|
6
6
|
import { inLayer } from '../support/imports/in-layer.js';
|
|
7
7
|
import { OUTSIDE_CONCERN_MESSAGE } from '../support/outside-concerns/outside-concern-message.js';
|
|
8
|
-
import {
|
|
8
|
+
import { judgePackage } from '../support/outside-concerns/judge-package.js';
|
|
9
|
+
import { OUTER_ENTRY_MESSAGE } from '../support/outside-concerns/outer-entry.js';
|
|
9
10
|
export const layerDomainPurity = defineRule({
|
|
10
11
|
id: 'layer/domain-purity',
|
|
11
12
|
type: 'problem',
|
|
@@ -13,6 +14,7 @@ export const layerDomainPurity = defineRule({
|
|
|
13
14
|
description: 'domain/ imports only its own domain/, the shared kernel and the allowed kernel packages: no framework, ORM, validation library or Node built-in.',
|
|
14
15
|
messages: {
|
|
15
16
|
outsideConcern: OUTSIDE_CONCERN_MESSAGE,
|
|
17
|
+
entry: OUTER_ENTRY_MESSAGE,
|
|
16
18
|
package: 'The domain imports the package "{{name}}". Remove the import: express the need as plain TypeScript or as a port (an abstract class) in application/ports, and keep decorators and schemas of "{{name}}" in infrastructure or presentation.',
|
|
17
19
|
declarations: `The domain imports "${DECLARATIONS_ENTRY}": the domain declares nothing. Aggregates, entities, value objects, events, services and repository ports carry no decorator and no dependency list. Remove the import: put the decorator on the class of application/ or infrastructure/ that plays the role, and keep ports as abstract classes in domain/repositories and application/ports.`,
|
|
18
20
|
builtin: 'The domain imports the Node built-in "{{name}}". Receive the value (an id, a date, a hash) as a parameter, produced by a port such as IdGenerator or Clock in the application layer.',
|
|
@@ -31,12 +33,9 @@ export const layerDomainPurity = defineRule({
|
|
|
31
33
|
report({ node, messageId: 'declarations' });
|
|
32
34
|
}
|
|
33
35
|
else if (target.kind === 'package') {
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
report({ node,
|
|
37
|
-
}
|
|
38
|
-
else if (!allowed.includes(target.name)) {
|
|
39
|
-
report({ node, messageId: 'package', data: { name: target.name } });
|
|
36
|
+
const judgment = judgePackage('The domain', { name: target.name, specifier }, allowed);
|
|
37
|
+
if (judgment !== undefined) {
|
|
38
|
+
report({ node, ...judgment });
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
else if (target.kind === 'builtin') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layer-domain-purity.js","sourceRoot":"","sources":["../../src/rules/layer-domain-purity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,oC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AAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,SAAS,CAAC,IAAqB,EAAE,MAA+C;IACvF,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC;IAE9B,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;QACnC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC;IAC7D,CAAC;IAED,0FAA0F;IAC1F,OAAO,KAAK,CAAC,KAAK,KAAK,oBAAoB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/E,CAAC;AAED,SAAS,SAAS,CAAC,MAA+C;IAChE,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3E,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const portsAbstractClass: import("@typescript-eslint/utils/ts-eslint").RuleModule<"concrete" | "interface" | "member", [], import("../index.js").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
1
|
+
export declare const portsAbstractClass: import("@typescript-eslint/utils/ts-eslint").RuleModule<"concrete" | "interface" | "member" | "noClass", [], import("../index.js").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
2
2
|
//# sourceMappingURL=ports-abstract-class.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ports-abstract-class.d.ts","sourceRoot":"","sources":["../../src/rules/ports-abstract-class.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ports-abstract-class.d.ts","sourceRoot":"","sources":["../../src/rules/ports-abstract-class.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,kBAAkB,gMAoD7B,CAAC"}
|
|
@@ -10,17 +10,21 @@ export const portsAbstractClass = defineRule({
|
|
|
10
10
|
id: 'ports/abstract-class',
|
|
11
11
|
type: 'problem',
|
|
12
12
|
recommended: 'error',
|
|
13
|
-
description: 'A port is an abstract class with abstract members only: no constructor, no private or protected member, no body, no initializer.',
|
|
13
|
+
description: 'A port is an abstract class with abstract members only: no constructor, no private or protected member, no body, no initializer; a port file declares one abstract class.',
|
|
14
14
|
messages: {
|
|
15
15
|
concrete: `{{className}} is declared in a port file but is not abstract. ${PORT} Write \`export abstract class {{className}}\` and move what it implements to an adapter in infrastructure/ that \`implements {{className}}\`.`,
|
|
16
16
|
member: `{{className}} has {{what}}. ${PORT} Keep \`abstract\` method signatures and \`abstract readonly\` properties here (and \`static readonly tokenKey\` when the port is published in a package), and move the rest to the adapter.`,
|
|
17
17
|
interface: '{{name}} is an interface in a port file. Declare the port as an abstract class: it is also its injection token. Write `export abstract class {{name}}` with `abstract` members; a data shape that travels through the port may stay a `type`.',
|
|
18
|
+
noClass: 'This port file declares no abstract class. Declare the port as `export abstract class` with `abstract` members: it is the contract and the injection token at once; a data shape that travels through the port may stay a `type` beside it.',
|
|
18
19
|
},
|
|
19
20
|
create({ file, report }) {
|
|
20
21
|
if (!isPortFile(file.config, file.path)) {
|
|
21
22
|
return {};
|
|
22
23
|
}
|
|
24
|
+
// A port written as a type or a set of functions is no contract a container can bind.
|
|
25
|
+
let declared = false;
|
|
23
26
|
const judge = (node) => {
|
|
27
|
+
declared = true;
|
|
24
28
|
if (!node.abstract) {
|
|
25
29
|
report({ node: node.id ?? node, messageId: 'concrete', data: { className: className(node) } });
|
|
26
30
|
}
|
|
@@ -34,7 +38,15 @@ export const portsAbstractClass = defineRule({
|
|
|
34
38
|
return {
|
|
35
39
|
ClassDeclaration: judge,
|
|
36
40
|
ClassExpression: judge,
|
|
37
|
-
'ExportNamedDeclaration > TSInterfaceDeclaration': (node) =>
|
|
41
|
+
'ExportNamedDeclaration > TSInterfaceDeclaration': (node) => {
|
|
42
|
+
declared = true;
|
|
43
|
+
report({ node: node.id, messageId: 'interface', data: { name: node.id.name } });
|
|
44
|
+
},
|
|
45
|
+
'Program:exit': (node) => {
|
|
46
|
+
if (!declared) {
|
|
47
|
+
report({ node, messageId: 'noClass' });
|
|
48
|
+
}
|
|
49
|
+
},
|
|
38
50
|
};
|
|
39
51
|
},
|
|
40
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ports-abstract-class.js","sourceRoot":"","sources":["../../src/rules/ports-abstract-class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,MAAM,IAAI,GACR,oHAAoH,CAAC;AAEvH,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"ports-abstract-class.js","sourceRoot":"","sources":["../../src/rules/ports-abstract-class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,U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,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC7F,CAAC;AAED,SAAS,UAAU,CAAC,MAA6B;IAC/C,OAAO,CACL,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,0BAA0B;QACzD,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,4BAA4B,CAC5D,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,MAA6B,EAAE,IAAY;IACjE,IAAI,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;QACpD,OAAO,cAAc,IAAI,cAAc,CAAC;IAC1C,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,kBAAkB,IAAI,MAAM,CAAC,KAAK,KAAK,IAAI;QAC/E,CAAC,CAAC,gBAAgB,IAAI,sBAAsB;QAC5C,CAAC,CAAC,cAAc,IAAI,uBAAuB,CAAC;AAChD,CAAC;AAED,kGAAkG;AAClG,SAAS,UAAU,CAAC,MAA6B;IAC/C,IACE,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,kBAAkB;QACjD,CAAC,MAAM,CAAC,MAAM;QACd,CAAC,MAAM,CAAC,QAAQ;QAChB,UAAU,CAAC,MAAM,CAAC,KAAK,UAAU,EACjC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,MAAM,CAAC,KAAK,KAAK,IAAI,IAAI,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC;AAC3E,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { TSESLint, type TSESTree } from '@typescript-eslint/utils';
|
|
2
2
|
/**
|
|
3
3
|
* The name under which `node` reaches something ambient: a global or an import binding
|
|
4
|
-
* (`crypto`), also through the global object (`globalThis.crypto`)
|
|
5
|
-
*
|
|
4
|
+
* (`crypto`), also through the global object (`globalThis.crypto`), under the name it is
|
|
5
|
+
* imported by (`vi` for `import { vi as mocks }`) and through a `const` alias of it
|
|
6
|
+
* (`const clock = Date`). Undefined when the name is a local declaration that merely shadows
|
|
7
|
+
* the global.
|
|
6
8
|
*/
|
|
7
9
|
export declare function ambientName(sourceCode: Readonly<TSESLint.SourceCode>, node: TSESTree.Node): string | undefined;
|
|
8
10
|
//# sourceMappingURL=ambient-name.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ambient-name.d.ts","sourceRoot":"","sources":["../../../src/support/globals/ambient-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"ambient-name.d.ts","sourceRoot":"","sources":["../../../src/support/globals/ambient-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ7F;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,MAAM,GAAG,SAAS,CAE9G"}
|
|
@@ -1,26 +1,57 @@
|
|
|
1
1
|
import { ASTUtils, AST_NODE_TYPES, TSESLint } from '@typescript-eslint/utils';
|
|
2
2
|
import { propertyName } from './property-name.js';
|
|
3
3
|
const GLOBAL_OBJECTS = new Set(['globalThis', 'window', 'self', 'global']);
|
|
4
|
+
/** How many `const` aliases are followed back to what they name: `const a = Date; const b = a;`. */
|
|
5
|
+
const ALIAS_DEPTH = 4;
|
|
4
6
|
/**
|
|
5
7
|
* The name under which `node` reaches something ambient: a global or an import binding
|
|
6
|
-
* (`crypto`), also through the global object (`globalThis.crypto`)
|
|
7
|
-
*
|
|
8
|
+
* (`crypto`), also through the global object (`globalThis.crypto`), under the name it is
|
|
9
|
+
* imported by (`vi` for `import { vi as mocks }`) and through a `const` alias of it
|
|
10
|
+
* (`const clock = Date`). Undefined when the name is a local declaration that merely shadows
|
|
11
|
+
* the global.
|
|
8
12
|
*/
|
|
9
13
|
export function ambientName(sourceCode, node) {
|
|
14
|
+
return nameOf(sourceCode, node, 0);
|
|
15
|
+
}
|
|
16
|
+
function nameOf(sourceCode, node, depth) {
|
|
10
17
|
if (node.type === AST_NODE_TYPES.Identifier) {
|
|
11
|
-
return
|
|
18
|
+
return identifierName(sourceCode, node, depth);
|
|
12
19
|
}
|
|
13
20
|
if (node.type !== AST_NODE_TYPES.MemberExpression || node.object.type !== AST_NODE_TYPES.Identifier) {
|
|
14
21
|
return undefined;
|
|
15
22
|
}
|
|
16
|
-
if (!GLOBAL_OBJECTS.has(node.object.name) ||
|
|
23
|
+
if (!GLOBAL_OBJECTS.has(node.object.name) || identifierName(sourceCode, node.object, depth) !== node.object.name) {
|
|
17
24
|
return undefined;
|
|
18
25
|
}
|
|
19
26
|
return propertyName(node);
|
|
20
27
|
}
|
|
21
|
-
function
|
|
28
|
+
function identifierName(sourceCode, identifier, depth) {
|
|
22
29
|
const variable = ASTUtils.findVariable(sourceCode.getScope(identifier), identifier.name);
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
if (variable === null) {
|
|
31
|
+
return identifier.name;
|
|
32
|
+
}
|
|
33
|
+
if (variable.defs.every((definition) => definition.type === TSESLint.Scope.DefinitionType.ImportBinding)) {
|
|
34
|
+
return importedName(variable.defs[0]?.node) ?? identifier.name;
|
|
35
|
+
}
|
|
36
|
+
const alias = aliasedValue(variable.defs);
|
|
37
|
+
return alias === undefined || depth >= ALIAS_DEPTH ? undefined : nameOf(sourceCode, alias, depth + 1);
|
|
38
|
+
}
|
|
39
|
+
/** `vi` for `import { vi as mocks }`; nothing for a default or a namespace import, named by the file. */
|
|
40
|
+
function importedName(node) {
|
|
41
|
+
if (node?.type !== AST_NODE_TYPES.ImportSpecifier) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
return node.imported.type === AST_NODE_TYPES.Identifier ? node.imported.name : node.imported.value;
|
|
45
|
+
}
|
|
46
|
+
/** What a `const` declared once names, `Date` for `const clock = Date`. */
|
|
47
|
+
function aliasedValue(definitions) {
|
|
48
|
+
const [definition, ...others] = definitions;
|
|
49
|
+
if (definition?.type !== TSESLint.Scope.DefinitionType.Variable ||
|
|
50
|
+
others.length > 0 ||
|
|
51
|
+
definition.parent.kind !== 'const' ||
|
|
52
|
+
definition.node.id.type !== AST_NODE_TYPES.Identifier) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
return definition.node.init ?? undefined;
|
|
25
56
|
}
|
|
26
57
|
//# sourceMappingURL=ambient-name.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ambient-name.js","sourceRoot":"","sources":["../../../src/support/globals/ambient-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAiB,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE3E
|
|
1
|
+
{"version":3,"file":"ambient-name.js","sourceRoot":"","sources":["../../../src/support/globals/ambient-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAiB,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE3E,oGAAoG;AACpG,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB;;;;;;GAM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ImportedPackage {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly specifier: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PackageJudgment {
|
|
7
|
+
readonly messageId: 'outsideConcern' | 'entry' | 'package';
|
|
8
|
+
readonly data: Readonly<Record<string, string>>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* What an inner layer (`importer`) is told about a package it imports: an outside concern
|
|
12
|
+
* whatever the allow-list says, a package outside the list, an outer entry of an allowed one.
|
|
13
|
+
*/
|
|
14
|
+
export declare function judgePackage(importer: string, { name, specifier }: ImportedPackage, allowed: readonly string[]): PackageJudgment | undefined;
|
|
15
|
+
//# sourceMappingURL=judge-package.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"judge-package.d.ts","sourceRoot":"","sources":["../../../src/support/outside-concerns/judge-package.ts"],"names":[],"mappings":"AAGA,0FAA0F;AAC1F,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,EAAE,gBAAgB,GAAG,OAAO,GAAG,SAAS,CAAC;IAC3D,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACjD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,eAAe,EACpC,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB,eAAe,GAAG,SAAS,CAc7B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { outerEntry } from './outer-entry.js';
|
|
2
|
+
import { outsideConcern } from './outside-concern.js';
|
|
3
|
+
/**
|
|
4
|
+
* What an inner layer (`importer`) is told about a package it imports: an outside concern
|
|
5
|
+
* whatever the allow-list says, a package outside the list, an outer entry of an allowed one.
|
|
6
|
+
*/
|
|
7
|
+
export function judgePackage(importer, { name, specifier }, allowed) {
|
|
8
|
+
const concern = outsideConcern(name);
|
|
9
|
+
if (concern !== undefined) {
|
|
10
|
+
return { messageId: 'outsideConcern', data: { importer, specifier, ...concern } };
|
|
11
|
+
}
|
|
12
|
+
if (!allowed.includes(name)) {
|
|
13
|
+
return { messageId: 'package', data: { name } };
|
|
14
|
+
}
|
|
15
|
+
const what = outerEntry(specifier, allowed);
|
|
16
|
+
return what === undefined ? undefined : { messageId: 'entry', data: { importer, specifier, what, name } };
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=judge-package.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"judge-package.js","sourceRoot":"","sources":["../../../src/support/outside-concerns/judge-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAanD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC1B,QAAgB,EAChB,EAAE,IAAI,EAAE,SAAS,EAAmB,EACpC,OAA0B;IAE1B,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAErC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,EAAE,CAAC;IACpF,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC;IAClD,CAAC;IAED,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAE5C,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;AAC5G,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** One message for the two inner layers, as the checker writes it. */
|
|
2
|
+
export declare const OUTER_ENTRY_MESSAGE = "{{importer}} imports \"{{specifier}}\", {{what}}: allowing \"{{name}}\" does not allow its entries for adapters, wiring and test doubles. Import it where it belongs: an adapter or the wiring in infrastructure/ or src/platform, a test double in a test.";
|
|
3
|
+
/** What the outer entry `specifier` holds, unless the allow-list names that entry itself. */
|
|
4
|
+
export declare function outerEntry(specifier: string, allowed: readonly string[]): string | undefined;
|
|
5
|
+
//# sourceMappingURL=outer-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outer-entry.d.ts","sourceRoot":"","sources":["../../../src/support/outside-concerns/outer-entry.ts"],"names":[],"mappings":"AAcA,sEAAsE;AACtE,eAAO,MAAM,mBAAmB,gQAC2N,CAAC;AAE5P,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAI5F"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entries of an allowed package of the kit that hold an adapter, the wiring of a container or
|
|
3
|
+
* test doubles: an allow-list that names the package does not name them, domain/ and
|
|
4
|
+
* application/ import one only when the allow-list names that entry itself.
|
|
5
|
+
*/
|
|
6
|
+
const OUTER_ENTRIES = {
|
|
7
|
+
'@ddd-ts-kit/auth/jwt': 'an authentication adapter',
|
|
8
|
+
'@ddd-ts-kit/auth/passport': 'an authentication adapter',
|
|
9
|
+
'@ddd-ts-kit/auth/rebac': 'the relation-based authorizer and its tuple stores',
|
|
10
|
+
'@ddd-ts-kit/auth/di': 'the wiring of authorization in a container',
|
|
11
|
+
'@ddd-ts-kit/auth/testing': 'test doubles',
|
|
12
|
+
'@ddd-ts-kit/kernel/testing': 'test doubles',
|
|
13
|
+
};
|
|
14
|
+
/** One message for the two inner layers, as the checker writes it. */
|
|
15
|
+
export const OUTER_ENTRY_MESSAGE = '{{importer}} imports "{{specifier}}", {{what}}: allowing "{{name}}" does not allow its entries for adapters, wiring and test doubles. Import it where it belongs: an adapter or the wiring in infrastructure/ or src/platform, a test double in a test.';
|
|
16
|
+
/** What the outer entry `specifier` holds, unless the allow-list names that entry itself. */
|
|
17
|
+
export function outerEntry(specifier, allowed) {
|
|
18
|
+
const entry = Object.entries(OUTER_ENTRIES).find(([name]) => specifier === name || specifier.startsWith(`${name}/`));
|
|
19
|
+
return entry === undefined || allowed.includes(entry[0]) ? undefined : entry[1];
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=outer-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outer-entry.js","sourceRoot":"","sources":["../../../src/support/outside-concerns/outer-entry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,aAAa,GAAqC;IACtD,sBAAsB,EAAE,2BAA2B;IACnD,2BAA2B,EAAE,2BAA2B;IACxD,wBAAwB,EAAE,oDAAoD;IAC9E,qBAAqB,EAAE,4CAA4C;IACnE,0BAA0B,EAAE,cAAc;IAC1C,4BAA4B,EAAE,cAAc;CAC7C,CAAC;AAEF,sEAAsE;AACtE,MAAM,CAAC,MAAM,mBAAmB,GAC9B,yPAAyP,CAAC;AAE5P,6FAA6F;AAC7F,MAAM,UAAU,UAAU,CAAC,SAAiB,EAAE,OAA0B;IACtE,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,SAAS,KAAK,IAAI,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;IAErH,OAAO,KAAK,KAAK,SAAS,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"purity-rule.d.ts","sourceRoot":"","sources":["../../src/support/purity-rule.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,2FAA2F;IAC3F,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;IAC9D,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,kFAAkF;IAClF,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,+FAA+F;IAC/F,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,wGAAwG;IACxG,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;CACpE;AAED,+GAA+G;AAC/G,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"purity-rule.d.ts","sourceRoot":"","sources":["../../src/support/purity-rule.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,2FAA2F;IAC3F,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;IAC9D,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,kFAAkF;IAClF,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,+FAA+F;IAC/F,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,wGAAwG;IACxG,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;CACpE;AAED,+GAA+G;AAC/G,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,sKAgCtC"}
|
|
@@ -29,6 +29,7 @@ export function purityRule(rule) {
|
|
|
29
29
|
MemberExpression: (node) => used(node, forbiddenMember(rule, ambient(node.object), propertyName(node))),
|
|
30
30
|
'CallExpression:exit': (node) => used(node, rule.calls.includes(ambient(node.callee)) ? `${ambient(node.callee)}()` : undefined),
|
|
31
31
|
NewExpression: (node) => used(node, forbiddenConstruction(rule, ambient(node.callee), node.arguments.length)),
|
|
32
|
+
VariableDeclarator: destructuringListener(rule, ambient, used),
|
|
32
33
|
};
|
|
33
34
|
},
|
|
34
35
|
});
|
|
@@ -79,6 +80,36 @@ function forbiddenMember(rule, object, property) {
|
|
|
79
80
|
}
|
|
80
81
|
return members.length === 0 || members.includes(property) ? `${object}.${property}` : undefined;
|
|
81
82
|
}
|
|
83
|
+
/** `const { env } = process` reads `process.env` as surely as the member expression does. */
|
|
84
|
+
function destructuringListener(rule, ambient, used) {
|
|
85
|
+
return (node) => {
|
|
86
|
+
const source = node.init === null ? '' : ambient(node.init);
|
|
87
|
+
for (const [property, name] of destructured(node)) {
|
|
88
|
+
used(property, forbiddenMember(rule, source, name));
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/** The properties a declarator takes out of its value by name, `env` of `const { env } = process`. */
|
|
93
|
+
function destructured(node) {
|
|
94
|
+
if (node.id.type !== AST_NODE_TYPES.ObjectPattern) {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
return node.id.properties.flatMap((property) => {
|
|
98
|
+
if (property.type !== AST_NODE_TYPES.Property) {
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
const name = keyName(property);
|
|
102
|
+
return name === undefined ? [] : [[property, name]];
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function keyName(property) {
|
|
106
|
+
if (property.key.type === AST_NODE_TYPES.Identifier && !property.computed) {
|
|
107
|
+
return property.key.name;
|
|
108
|
+
}
|
|
109
|
+
return property.key.type === AST_NODE_TYPES.Literal && typeof property.key.value === 'string'
|
|
110
|
+
? property.key.value
|
|
111
|
+
: undefined;
|
|
112
|
+
}
|
|
82
113
|
function forbiddenConstruction(rule, callee, argumentCount) {
|
|
83
114
|
if (rule.constructions.includes(callee)) {
|
|
84
115
|
return `new ${callee}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"purity-rule.js","sourceRoot":"","sources":["../../src/support/purity-rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,UAAU,EAAe,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAuB,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAm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,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC1E,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,cAAc,CAAC,OAAO,IAAI,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAK,KAAK,QAAQ;QAC3F,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK;QACpB,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED,SAAS,qBAAqB,CAAC,IAAY,EAAE,MAAc,EAAE,aAAqB;IAChF,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACxC,OAAO,OAAO,MAAM,EAAE,CAAC;IACzB,CAAC;IAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,aAAa,KAAK,CAAC;QACnE,CAAC,CAAC,OAAO,MAAM,qBAAqB;QACpC,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
|
|
@@ -13,8 +13,9 @@ export interface TestCall {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* The test or the group `node` declares, when it is one: `it(title, fn)`, `describe.each(rows)(title, fn)`,
|
|
16
|
-
* `test.todo(title)`, `xit(title, fn)
|
|
17
|
-
* the test, nor when `it` is a local of
|
|
16
|
+
* `test.todo(title)`, `xit(title, fn)`, also under an alias of the runner (`import { it as scenario }`).
|
|
17
|
+
* Nothing for `it.each(rows)` alone, whose own call declares the test, nor when `it` is a local of
|
|
18
|
+
* the file instead of the runner's.
|
|
18
19
|
*/
|
|
19
20
|
export declare function testCall(sourceCode: Readonly<TSESLint.SourceCode>, node: TSESTree.CallExpression): TestCall | undefined;
|
|
20
21
|
//# sourceMappingURL=test-call.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-call.d.ts","sourceRoot":"","sources":["../../../src/support/tests/test-call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AAQ,CAAC,UAAU,CAAC,EACzC,IAAI,EAAE,QAAQ,CAAC,cAAc,GAC5B,QAAQ,GAAG,SAAS,CAkBtB"}
|
|
@@ -25,8 +25,9 @@ const MODIFIERS = new Set([
|
|
|
25
25
|
const CURRIED = new Set(['each', 'for', 'skipIf', 'runIf']);
|
|
26
26
|
/**
|
|
27
27
|
* The test or the group `node` declares, when it is one: `it(title, fn)`, `describe.each(rows)(title, fn)`,
|
|
28
|
-
* `test.todo(title)`, `xit(title, fn)
|
|
29
|
-
* the test, nor when `it` is a local of
|
|
28
|
+
* `test.todo(title)`, `xit(title, fn)`, also under an alias of the runner (`import { it as scenario }`).
|
|
29
|
+
* Nothing for `it.each(rows)` alone, whose own call declares the test, nor when `it` is a local of
|
|
30
|
+
* the file instead of the runner's.
|
|
30
31
|
*/
|
|
31
32
|
export function testCall(sourceCode, node) {
|
|
32
33
|
const head = headOf(node.callee);
|
|
@@ -34,12 +35,13 @@ export function testCall(sourceCode, node) {
|
|
|
34
35
|
return undefined;
|
|
35
36
|
}
|
|
36
37
|
const { root, modifiers } = head;
|
|
37
|
-
const
|
|
38
|
-
|
|
38
|
+
const runner = ambientName(sourceCode, root);
|
|
39
|
+
const kind = runner === undefined ? undefined : kindOf(runner);
|
|
40
|
+
if (runner === undefined || kind === undefined) {
|
|
39
41
|
return undefined;
|
|
40
42
|
}
|
|
41
43
|
const [title, body] = node.arguments;
|
|
42
|
-
return { kind, root:
|
|
44
|
+
return { kind, root: runner, modifiers, head: node.callee, title, body };
|
|
43
45
|
}
|
|
44
46
|
/** The runner function and the modifiers a callee chains, or nothing when the chain holds anything else. */
|
|
45
47
|
function headOf(callee) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-call.js","sourceRoot":"","sources":["../../../src/support/tests/test-call.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAgC,MAAM,0BAA0B,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CA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IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAE9C,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AAChD,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.104.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.104.0';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](domain-no-generic-error.md) · **Français**
|
|
2
|
-
<!-- translation-of: domain-no-generic-error.md sha256:
|
|
2
|
+
<!-- translation-of: domain-no-generic-error.md sha256:1c1fcea456ade425 -->
|
|
3
3
|
|
|
4
4
|
# ddd-ts-kit/domain-no-generic-error
|
|
5
5
|
|
|
@@ -14,6 +14,10 @@ Un échec métier attendu a un nom et un code stable que la présentation fait c
|
|
|
14
14
|
## Signalé
|
|
15
15
|
|
|
16
16
|
- `throw new Error(...)` et `throw Error(...)`
|
|
17
|
+
- les autres erreurs du langage : `TypeError`, `RangeError`, `ReferenceError`, `SyntaxError`, `EvalError`, `URIError`, `AggregateError`
|
|
18
|
+
- l'une d'elles lancée par une `const` (`const failure = new Error('x'); throw failure;`) ou construite sous un alias `const` de sa classe (`const Failure = Error`)
|
|
19
|
+
|
|
20
|
+
Le message nomme l'étape qui écrit le refus dans la forme du projet : `generate error <context> <Refusal> for<Subject>` sous `"stack.refusals": "named"`, `generate error <context> <Concept> <refusal>` sous `factories` et `classes`.
|
|
17
21
|
|
|
18
22
|
Incorrect :
|
|
19
23
|
|
|
@@ -35,7 +39,7 @@ Aucune.
|
|
|
35
39
|
|
|
36
40
|
## Limites
|
|
37
41
|
|
|
38
|
-
-
|
|
42
|
+
- Une erreur construite sous un `let`, passée en paramètre ou rendue par une fonction avant d'être lancée n'est pas suivie.
|
|
39
43
|
- Une erreur générique renvoyée dans un `Result` (`err(new Error())`) ou rejetée (`Promise.reject`) n'est pas vue.
|
|
40
44
|
|
|
41
45
|
## Avec le checker de la CLI
|
|
@@ -13,6 +13,10 @@ An expected business failure has a name and a stable code that presentation maps
|
|
|
13
13
|
## Reported
|
|
14
14
|
|
|
15
15
|
- `throw new Error(...)` and `throw Error(...)`
|
|
16
|
+
- the other errors of the language: `TypeError`, `RangeError`, `ReferenceError`, `SyntaxError`, `EvalError`, `URIError`, `AggregateError`
|
|
17
|
+
- one of them thrown through a `const` (`const failure = new Error('x'); throw failure;`) or built under a `const` alias of its class (`const Failure = Error`)
|
|
18
|
+
|
|
19
|
+
The message names the step that writes the refusal in the form of the project: `generate error <context> <Refusal> for<Subject>` under `"stack.refusals": "named"`, `generate error <context> <Concept> <refusal>` under `factories` and `classes`.
|
|
16
20
|
|
|
17
21
|
Incorrect:
|
|
18
22
|
|
|
@@ -34,7 +38,7 @@ None.
|
|
|
34
38
|
|
|
35
39
|
## Limits
|
|
36
40
|
|
|
37
|
-
-
|
|
41
|
+
- An error built under a `let`, passed as a parameter or returned by a function before it is thrown is not followed.
|
|
38
42
|
- A generic error returned in a `Result` (`err(new Error())`) or rejected (`Promise.reject`) is not seen.
|
|
39
43
|
|
|
40
44
|
## With the CLI checker
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](layer-application-inward.md) · **Français**
|
|
2
|
-
<!-- translation-of: layer-application-inward.md sha256:
|
|
2
|
+
<!-- translation-of: layer-application-inward.md sha256:821d093b205975b2 -->
|
|
3
3
|
|
|
4
4
|
# ddd-ts-kit/layer-application-inward
|
|
5
5
|
|
|
@@ -14,6 +14,7 @@ Les cas d'usage orchestrent le domaine par des ports. Un import d'un adaptateur,
|
|
|
14
14
|
## Signalé
|
|
15
15
|
|
|
16
16
|
- un *package* hors de `applicationAllowedPackages`
|
|
17
|
+
- un point d'entrée d'un *package* autorisé du kit qui contient un adaptateur, le câblage d'un conteneur ou des doublures de test (`@ddd-ts-kit/auth/jwt`, `/passport`, `/rebac`, `/di`, `/testing`, `@ddd-ts-kit/kernel/testing`), sauf si `applicationAllowedPackages` nomme ce point d'entrée lui-même
|
|
17
18
|
- `@ddd-ts-kit/aspects`, `@ddd-ts-kit/audit`, `@ddd-ts-kit/redis`, `@ddd-ts-kit/s3`, `@ddd-ts-kit/scheduling`, `@ddd-ts-kit/sentry` et `@ddd-ts-kit/tracing`, par n'importe quelle entrée (`.`, `/decorators`, `/testing`, `/node`, ...), avec un message propre : ils appliquent ou enregistrent une préoccupation depuis l'extérieur des cas d'usage
|
|
18
19
|
- tout module natif de Node
|
|
19
20
|
- `infrastructure/`, `presentation/` ou le fichier de module du même contexte
|
|
@@ -13,6 +13,7 @@ Use cases orchestrate the domain through ports. An import of an adapter, a drive
|
|
|
13
13
|
## Reported
|
|
14
14
|
|
|
15
15
|
- a package outside `applicationAllowedPackages`
|
|
16
|
+
- an entry of an allowed package of the kit that holds an adapter, the wiring of a container or test doubles (`@ddd-ts-kit/auth/jwt`, `/passport`, `/rebac`, `/di`, `/testing`, `@ddd-ts-kit/kernel/testing`), unless `applicationAllowedPackages` names that entry itself
|
|
16
17
|
- `@ddd-ts-kit/aspects`, `@ddd-ts-kit/audit`, `@ddd-ts-kit/redis`, `@ddd-ts-kit/s3`, `@ddd-ts-kit/scheduling`, `@ddd-ts-kit/sentry` and `@ddd-ts-kit/tracing`, by any entry (`.`, `/decorators`, `/testing`, `/node`, ...), with a message of their own: they apply or record a concern from outside the use cases
|
|
17
18
|
- any Node built-in
|
|
18
19
|
- `infrastructure/`, `presentation/` or the module file of the same context
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](layer-domain-purity.md) · **Français**
|
|
2
|
-
<!-- translation-of: layer-domain-purity.md sha256:
|
|
2
|
+
<!-- translation-of: layer-domain-purity.md sha256:bba4b3cedef2b3ae -->
|
|
3
3
|
|
|
4
4
|
# ddd-ts-kit/layer-domain-purity
|
|
5
5
|
|
|
@@ -14,6 +14,7 @@ Le domaine est la partie du système qui doit survivre à un changement de frame
|
|
|
14
14
|
## Signalé
|
|
15
15
|
|
|
16
16
|
- un *package* hors de `domainAllowedPackages` (par défaut : `@ddd-ts-kit/kernel`)
|
|
17
|
+
- un point d'entrée d'un *package* autorisé du kit qui contient un adaptateur, le câblage d'un conteneur ou des doublures de test (`@ddd-ts-kit/kernel/testing`, `@ddd-ts-kit/auth/jwt`, `/passport`, `/rebac`, `/di`, `/testing`), sauf si `domainAllowedPackages` nomme ce point d'entrée lui-même
|
|
17
18
|
- `@ddd-ts-kit/aspects`, `@ddd-ts-kit/audit`, `@ddd-ts-kit/redis`, `@ddd-ts-kit/s3`, `@ddd-ts-kit/scheduling`, `@ddd-ts-kit/sentry` et `@ddd-ts-kit/tracing`, par n'importe quelle entrée (`.`, `/decorators`, `/testing`, `/node`, ...), avec un message propre : ils appliquent ou enregistrent une préoccupation depuis l'extérieur du modèle
|
|
18
19
|
- dans un projet de style déclaré (`stack.style: "declared"`) : `@ddd-ts-kit/kernel/declarations`, même si `@ddd-ts-kit/kernel` est permis, avec un message propre : le domaine ne déclare rien
|
|
19
20
|
- tout module natif de Node
|
|
@@ -13,6 +13,7 @@ The domain is the part of the system that must survive a change of framework, OR
|
|
|
13
13
|
## Reported
|
|
14
14
|
|
|
15
15
|
- a package outside `domainAllowedPackages` (default: `@ddd-ts-kit/kernel`)
|
|
16
|
+
- an entry of an allowed package of the kit that holds an adapter, the wiring of a container or test doubles (`@ddd-ts-kit/kernel/testing`, `@ddd-ts-kit/auth/jwt`, `/passport`, `/rebac`, `/di`, `/testing`), unless `domainAllowedPackages` names that entry itself
|
|
16
17
|
- `@ddd-ts-kit/aspects`, `@ddd-ts-kit/audit`, `@ddd-ts-kit/redis`, `@ddd-ts-kit/s3`, `@ddd-ts-kit/scheduling`, `@ddd-ts-kit/sentry` and `@ddd-ts-kit/tracing`, by any entry (`.`, `/decorators`, `/testing`, `/node`, ...), with a message of their own: they apply or record a concern from outside the model
|
|
17
18
|
- in a declared-style project (`stack.style: "declared"`): `@ddd-ts-kit/kernel/declarations`, even though `@ddd-ts-kit/kernel` is allowed, with a message of its own: the domain declares nothing
|
|
18
19
|
- any Node built-in
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](ports-abstract-class.md) · **Français**
|
|
2
|
-
<!-- translation-of: ports-abstract-class.md sha256:
|
|
2
|
+
<!-- translation-of: ports-abstract-class.md sha256:63f489319286169f -->
|
|
3
3
|
|
|
4
4
|
# ddd-ts-kit/ports-abstract-class
|
|
5
5
|
|
|
@@ -18,6 +18,7 @@ Un port est une classe abstraite qui n'a que des membres abstraits. La classe es
|
|
|
18
18
|
- un membre `private`, `protected` ou `#`
|
|
19
19
|
- une méthode avec un corps, une propriété avec un initialiseur, un membre qui n'est pas `abstract`
|
|
20
20
|
- une `interface` exportée : un port se déclare comme une classe abstraite
|
|
21
|
+
- un fichier de port qui ne déclare aucune classe, un type ou un jeton seul
|
|
21
22
|
|
|
22
23
|
Incorrect :
|
|
23
24
|
|
|
@@ -55,7 +56,7 @@ export abstract class InvoiceRepository extends Repository<Invoice> {}
|
|
|
55
56
|
|
|
56
57
|
Un port peut en étendre un autre : le `Repository<A>` du noyau, ou un port du même contexte. Un membre est permis en plus des membres abstraits : `static readonly tokenKey = '<package>.<Port>'`, un littéral de chaîne qui donne au port une seule identité quand son *package* est chargé deux fois. Une valeur qui n'est pas un port (des réglages, une connexion à la base de données) se type de la même façon, par une classe abstraite aux propriétés `abstract readonly`.
|
|
57
58
|
|
|
58
|
-
Un alias `type` exporté n'est pas signalé : la forme des données qui transitent par le port peut être un type. Une interface non exportée est laissée tranquille aussi.
|
|
59
|
+
Un alias `type` exporté à côté de la classe n'est pas signalé : la forme des données qui transitent par le port peut être un type. Une interface non exportée est laissée tranquille aussi. Un fichier sans classe ni interface exportée est signalé une fois, à sa première ligne.
|
|
59
60
|
|
|
60
61
|
## Options
|
|
61
62
|
|
|
@@ -17,6 +17,7 @@ A port is an abstract class with abstract members only. The class is the contrac
|
|
|
17
17
|
- a `private`, `protected` or `#` member
|
|
18
18
|
- a method with a body, a property with an initializer, a member that is not `abstract`
|
|
19
19
|
- an exported `interface`: a port is declared as an abstract class
|
|
20
|
+
- a port file that declares no class at all, a type or a token alone
|
|
20
21
|
|
|
21
22
|
Incorrect:
|
|
22
23
|
|
|
@@ -54,7 +55,7 @@ export abstract class InvoiceRepository extends Repository<Invoice> {}
|
|
|
54
55
|
|
|
55
56
|
A port may extend another one: the kernel `Repository<A>`, or a port of the same context. One member is allowed besides the abstract ones: `static readonly tokenKey = '<package>.<Port>'`, a string literal that gives the port one identity when its package is loaded twice. A value that is not a port (settings, a database handle) is typed the same way, by an abstract class with `abstract readonly` properties.
|
|
56
57
|
|
|
57
|
-
An exported `type` alias is not reported: the shape of the data that travels through the port may be a type. An interface that is not exported is left alone too.
|
|
58
|
+
An exported `type` alias beside the class is not reported: the shape of the data that travels through the port may be a type. An interface that is not exported is left alone too. A file with neither a class nor an exported interface is reported once, on its first line.
|
|
58
59
|
|
|
59
60
|
## Options
|
|
60
61
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](purity-no-ambient-randomness.md) · **Français**
|
|
2
|
-
<!-- translation-of: purity-no-ambient-randomness.md sha256:
|
|
2
|
+
<!-- translation-of: purity-no-ambient-randomness.md sha256:840bfb0683120f9d -->
|
|
3
3
|
|
|
4
4
|
# ddd-ts-kit/purity-no-ambient-randomness
|
|
5
5
|
|
|
@@ -40,6 +40,7 @@ Aucune.
|
|
|
40
40
|
|
|
41
41
|
- Une enveloppe autour de l'accès interdit (un auxiliaire de la plateforme qui appelle `Date.now()`) n'est pas vue ici ; les règles de couche arrêtent l'import de cet auxiliaire.
|
|
42
42
|
- Une déclaration locale qui masque la globale (`const process = ...`) n'est pas signalée.
|
|
43
|
+
- Un membre pris par déstructuration (`const { env } = process`, `const { now } = Date`) et un alias `const` de la globale (`const clock = Date; clock.now()`) sont lus ; un alias par un `let`, un paramètre ou une propriété n'est pas suivi.
|
|
43
44
|
|
|
44
45
|
## Avec le checker de la CLI
|
|
45
46
|
|
|
@@ -39,6 +39,7 @@ None.
|
|
|
39
39
|
|
|
40
40
|
- A wrapper around the forbidden access (a helper of the platform that calls `Date.now()`) is not seen here; the layer rules stop the import of that helper.
|
|
41
41
|
- A local declaration that shadows the global (`const process = ...`) is not reported.
|
|
42
|
+
- A member taken by destructuring (`const { env } = process`, `const { now } = Date`) and a `const` alias of the global (`const clock = Date; clock.now()`) are read; an alias through a `let`, a parameter or a property is not followed.
|
|
42
43
|
|
|
43
44
|
## With the CLI checker
|
|
44
45
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](purity-no-environment.md) · **Français**
|
|
2
|
-
<!-- translation-of: purity-no-environment.md sha256:
|
|
2
|
+
<!-- translation-of: purity-no-environment.md sha256:101d62840f5a83f6 -->
|
|
3
3
|
|
|
4
4
|
# ddd-ts-kit/purity-no-environment
|
|
5
5
|
|
|
@@ -42,6 +42,7 @@ Aucune.
|
|
|
42
42
|
|
|
43
43
|
- Une enveloppe autour de l'accès interdit (un auxiliaire de la plateforme qui appelle `Date.now()`) n'est pas vue ici ; les règles de couche arrêtent l'import de cet auxiliaire.
|
|
44
44
|
- Une déclaration locale qui masque la globale (`const process = ...`) n'est pas signalée.
|
|
45
|
+
- Un membre pris par déstructuration (`const { env } = process`, `const { now } = Date`) et un alias `const` de la globale (`const clock = Date; clock.now()`) sont lus ; un alias par un `let`, un paramètre ou une propriété n'est pas suivi.
|
|
45
46
|
|
|
46
47
|
## Avec le checker de la CLI
|
|
47
48
|
|
|
@@ -41,6 +41,7 @@ None.
|
|
|
41
41
|
|
|
42
42
|
- A wrapper around the forbidden access (a helper of the platform that calls `Date.now()`) is not seen here; the layer rules stop the import of that helper.
|
|
43
43
|
- A local declaration that shadows the global (`const process = ...`) is not reported.
|
|
44
|
+
- A member taken by destructuring (`const { env } = process`, `const { now } = Date`) and a `const` alias of the global (`const clock = Date; clock.now()`) are read; an alias through a `let`, a parameter or a property is not followed.
|
|
44
45
|
|
|
45
46
|
## With the CLI checker
|
|
46
47
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](purity-no-system-clock.md) · **Français**
|
|
2
|
-
<!-- translation-of: purity-no-system-clock.md sha256:
|
|
2
|
+
<!-- translation-of: purity-no-system-clock.md sha256:c65cf44ae7b01eb5 -->
|
|
3
3
|
|
|
4
4
|
# ddd-ts-kit/purity-no-system-clock
|
|
5
5
|
|
|
@@ -46,6 +46,7 @@ Aucune.
|
|
|
46
46
|
|
|
47
47
|
- Une enveloppe autour de l'accès interdit (un auxiliaire de la plateforme qui appelle `Date.now()`) n'est pas vue ici ; les règles de couche arrêtent l'import de cet auxiliaire.
|
|
48
48
|
- Une déclaration locale qui masque la globale (`const process = ...`) n'est pas signalée.
|
|
49
|
+
- Un membre pris par déstructuration (`const { env } = process`, `const { now } = Date`) et un alias `const` de la globale (`const clock = Date; clock.now()`) sont lus ; un alias par un `let`, un paramètre ou une propriété n'est pas suivi.
|
|
49
50
|
|
|
50
51
|
## Avec le checker de la CLI
|
|
51
52
|
|
|
@@ -45,6 +45,7 @@ None.
|
|
|
45
45
|
|
|
46
46
|
- A wrapper around the forbidden access (a helper of the platform that calls `Date.now()`) is not seen here; the layer rules stop the import of that helper.
|
|
47
47
|
- A local declaration that shadows the global (`const process = ...`) is not reported.
|
|
48
|
+
- A member taken by destructuring (`const { env } = process`, `const { now } = Date`) and a `const` alias of the global (`const clock = Date; clock.now()`) are read; an alias through a `let`, a parameter or a property is not followed.
|
|
48
49
|
|
|
49
50
|
## With the CLI checker
|
|
50
51
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](test-no-mocks.md) · **Français**
|
|
2
|
-
<!-- translation-of: test-no-mocks.md sha256:
|
|
2
|
+
<!-- translation-of: test-no-mocks.md sha256:27b7e66c3cea9b14 -->
|
|
3
3
|
|
|
4
4
|
# ddd-ts-kit/test-no-mocks
|
|
5
5
|
|
|
@@ -44,6 +44,7 @@ Aucune.
|
|
|
44
44
|
## Limites
|
|
45
45
|
|
|
46
46
|
- Les tests hors d'un contexte (`test/e2e`) ne sont pas jugés.
|
|
47
|
+
- `vi` et `jest` sont lus sous un alias d'import (`import { vi as mocks } from 'vitest'`) et un alias `const` ; un lanceur passé en paramètre n'est pas suivi.
|
|
47
48
|
|
|
48
49
|
## Avec le checker de la CLI
|
|
49
50
|
|
|
@@ -43,6 +43,7 @@ None.
|
|
|
43
43
|
## Limits
|
|
44
44
|
|
|
45
45
|
- Tests outside a context (`test/e2e`) are not judged.
|
|
46
|
+
- `vi` and `jest` are read under an import alias (`import { vi as mocks } from 'vitest'`) and a `const` alias; a runner passed as a parameter is not followed.
|
|
46
47
|
|
|
47
48
|
## With the CLI checker
|
|
48
49
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](test-no-only-no-skip.md) · **Français**
|
|
2
|
-
<!-- translation-of: test-no-only-no-skip.md sha256:
|
|
2
|
+
<!-- translation-of: test-no-only-no-skip.md sha256:0f9a49cfc5f76ea6 -->
|
|
3
3
|
|
|
4
4
|
# ddd-ts-kit/test-no-only-no-skip
|
|
5
5
|
|
|
@@ -48,7 +48,7 @@ Aucune.
|
|
|
48
48
|
|
|
49
49
|
## Limites
|
|
50
50
|
|
|
51
|
-
-
|
|
51
|
+
- Le lanceur est lu sous un alias d'import (`import { it as scenario } from 'vitest'`) et un alias `const` (`const scenario = it`) ; un modificateur pris à part (`const only = it.only`) ou un lanceur tiré de `it.extend(...)` n'est pas suivi.
|
|
52
52
|
- Une condition constante sans être un littéral (`const NEVER = false; it.skipIf(!NEVER)`) est lue comme une condition.
|
|
53
53
|
|
|
54
54
|
## Avec le checker de la CLI
|
|
@@ -47,7 +47,7 @@ None.
|
|
|
47
47
|
|
|
48
48
|
## Limits
|
|
49
49
|
|
|
50
|
-
-
|
|
50
|
+
- The runner is read under an import alias (`import { it as scenario } from 'vitest'`) and a `const` alias (`const scenario = it`); a modifier taken apart (`const only = it.only`) or a runner taken from `it.extend(...)` is not followed.
|
|
51
51
|
- A condition that is constant without being a literal (`const NEVER = false; it.skipIf(!NEVER)`) is read as a condition.
|
|
52
52
|
|
|
53
53
|
## With the CLI checker
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddd-ts-kit/eslint-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.104.0",
|
|
4
4
|
"description": "AST-accurate ESLint rules for DDD and Clean Architecture in TypeScript: layer and context isolation, domain purity, clean code ordering.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ddd",
|