@ddd-ts-kit/eslint-plugin 0.1.1 → 0.3.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/README.md +6 -1
- package/dist/project/config.d.ts +6 -0
- package/dist/project/config.d.ts.map +1 -1
- package/dist/project/is-judged.d.ts +5 -0
- package/dist/project/is-judged.d.ts.map +1 -0
- package/dist/project/is-judged.js +7 -0
- package/dist/project/is-judged.js.map +1 -0
- package/dist/project/parse-config.d.ts.map +1 -1
- package/dist/project/parse-config.js +6 -0
- package/dist/project/parse-config.js.map +1 -1
- package/dist/project/resolve-import.d.ts.map +1 -1
- package/dist/project/resolve-import.js +4 -1
- package/dist/project/resolve-import.js.map +1 -1
- package/dist/project/specifier-suffix.d.ts +6 -0
- package/dist/project/specifier-suffix.d.ts.map +1 -0
- package/dist/project/specifier-suffix.js +8 -0
- package/dist/project/specifier-suffix.js.map +1 -0
- package/dist/project/to-alias.d.ts +3 -2
- package/dist/project/to-alias.d.ts.map +1 -1
- package/dist/project/to-alias.js +4 -3
- package/dist/project/to-alias.js.map +1 -1
- package/dist/rules/clean-one-export-per-file.js +7 -3
- package/dist/rules/clean-one-export-per-file.js.map +1 -1
- package/dist/rules/declarations-constructor-injection.d.ts +5 -0
- package/dist/rules/declarations-constructor-injection.d.ts.map +1 -0
- package/dist/rules/declarations-constructor-injection.js +80 -0
- package/dist/rules/declarations-constructor-injection.js.map +1 -0
- package/dist/rules/domain-no-generic-error.js +1 -1
- package/dist/rules/domain-no-generic-error.js.map +1 -1
- package/dist/rules/errors-constructor-not-public.d.ts +2 -0
- package/dist/rules/errors-constructor-not-public.d.ts.map +1 -0
- package/dist/rules/errors-constructor-not-public.js +41 -0
- package/dist/rules/errors-constructor-not-public.js.map +1 -0
- package/dist/rules/errors-factory-name.d.ts +4 -0
- package/dist/rules/errors-factory-name.d.ts.map +1 -0
- package/dist/rules/errors-factory-name.js +88 -0
- package/dist/rules/errors-factory-name.js.map +1 -0
- package/dist/rules/errors-through-factory.d.ts +2 -0
- package/dist/rules/errors-through-factory.d.ts.map +1 -0
- package/dist/rules/errors-through-factory.js +39 -0
- package/dist/rules/errors-through-factory.js.map +1 -0
- package/dist/rules/imports-alias-only.d.ts.map +1 -1
- package/dist/rules/imports-alias-only.js +7 -9
- package/dist/rules/imports-alias-only.js.map +1 -1
- package/dist/rules/imports-extension.d.ts +5 -0
- package/dist/rules/imports-extension.d.ts.map +1 -0
- package/dist/rules/imports-extension.js +45 -0
- package/dist/rules/imports-extension.js.map +1 -0
- package/dist/rules/ports-no-concrete-dependency.d.ts +3 -1
- package/dist/rules/ports-no-concrete-dependency.d.ts.map +1 -1
- package/dist/rules/ports-no-concrete-dependency.js +51 -3
- package/dist/rules/ports-no-concrete-dependency.js.map +1 -1
- package/dist/rules/rules.d.ts.map +1 -1
- package/dist/rules/rules.js +10 -0
- package/dist/rules/rules.js.map +1 -1
- package/dist/support/declarations/declared-roles.d.ts.map +1 -1
- package/dist/support/declarations/declared-roles.js +1 -0
- package/dist/support/declarations/declared-roles.js.map +1 -1
- package/dist/support/errors/constant-case.d.ts +3 -0
- package/dist/support/errors/constant-case.d.ts.map +1 -0
- package/dist/support/errors/constant-case.js +6 -0
- package/dist/support/errors/constant-case.js.map +1 -0
- package/dist/support/errors/is-error-class.d.ts +4 -0
- package/dist/support/errors/is-error-class.d.ts.map +1 -0
- package/dist/support/errors/is-error-class.js +6 -0
- package/dist/support/errors/is-error-class.js.map +1 -0
- package/dist/support/errors/is-error-file.d.ts +4 -0
- package/dist/support/errors/is-error-file.d.ts.map +1 -0
- package/dist/support/errors/is-error-file.js +10 -0
- package/dist/support/errors/is-error-file.js.map +1 -0
- package/dist/support/injection/language-types.d.ts +3 -0
- package/dist/support/injection/language-types.d.ts.map +1 -0
- package/dist/support/injection/language-types.js +20 -0
- package/dist/support/injection/language-types.js.map +1 -0
- package/dist/support/injection/not-classes.d.ts +4 -0
- package/dist/support/injection/not-classes.d.ts.map +1 -0
- package/dist/support/injection/not-classes.js +20 -0
- package/dist/support/injection/not-classes.js.map +1 -0
- package/dist/support/injection/parameter-reading.d.ts +9 -0
- package/dist/support/injection/parameter-reading.d.ts.map +1 -0
- package/dist/support/injection/parameter-reading.js +2 -0
- package/dist/support/injection/parameter-reading.js.map +1 -0
- package/dist/support/injection/read-parameter.d.ts +9 -0
- package/dist/support/injection/read-parameter.d.ts.map +1 -0
- package/dist/support/injection/read-parameter.js +41 -0
- package/dist/support/injection/read-parameter.js.map +1 -0
- package/dist/support/injection/written-name.d.ts +4 -0
- package/dist/support/injection/written-name.d.ts.map +1 -0
- package/dist/support/injection/written-name.js +13 -0
- package/dist/support/injection/written-name.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/rules/clean-one-export-per-file.md +1 -1
- package/docs/rules/context-declared-relationship.md +2 -2
- package/docs/rules/context-extractable.md +3 -3
- package/docs/rules/context-published-language-is-a-contract.md +1 -1
- package/docs/rules/context-published-language-only.md +2 -2
- package/docs/rules/declarations-constructor-injection.md +89 -0
- package/docs/rules/declarations-role-declared.md +15 -9
- package/docs/rules/domain-events-transactional-before-commit.md +1 -1
- package/docs/rules/errors-constructor-not-public.md +53 -0
- package/docs/rules/errors-factory-name.md +50 -0
- package/docs/rules/errors-through-factory.md +45 -0
- package/docs/rules/imports-alias-only.md +10 -9
- package/docs/rules/imports-extension.md +83 -0
- package/docs/rules/layer-application-inward.md +3 -3
- package/docs/rules/layer-domain-purity.md +3 -3
- package/docs/rules/layer-infrastructure-no-presentation.md +2 -2
- package/docs/rules/layer-presentation-no-infrastructure.md +2 -2
- package/docs/rules/ports-no-concrete-dependency.md +4 -3
- package/docs/rules/test-no-mocks.md +1 -1
- package/package.json +1 -1
|
@@ -23,7 +23,7 @@ Incorrect:
|
|
|
23
23
|
import { eq } from 'drizzle-orm';
|
|
24
24
|
import { retry } from '@ddd-ts-kit/aspects';
|
|
25
25
|
import { RedisCache } from '@ddd-ts-kit/redis';
|
|
26
|
-
import { DrizzleInvoiceRepository } from '@/contexts/billing/infrastructure/persistence/drizzle-invoice.repository
|
|
26
|
+
import { DrizzleInvoiceRepository } from '@/contexts/billing/infrastructure/persistence/drizzle-invoice.repository';
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
Correct:
|
|
@@ -31,8 +31,8 @@ Correct:
|
|
|
31
31
|
```ts
|
|
32
32
|
// a port is an abstract class: the type of the dependency and its injection token
|
|
33
33
|
import { Cache, Clock } from '@ddd-ts-kit/kernel';
|
|
34
|
-
import { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository
|
|
35
|
-
import { PaymentGateway } from '@/contexts/billing/application/ports/payment-gateway.port
|
|
34
|
+
import { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository';
|
|
35
|
+
import { PaymentGateway } from '@/contexts/billing/application/ports/payment-gateway.port';
|
|
36
36
|
|
|
37
37
|
// declared style
|
|
38
38
|
import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
|
|
@@ -24,7 +24,7 @@ Incorrect:
|
|
|
24
24
|
import { z } from 'zod';
|
|
25
25
|
import { randomUUID } from 'node:crypto';
|
|
26
26
|
import { Logged } from '@ddd-ts-kit/aspects/decorators';
|
|
27
|
-
import type { InvoiceRow } from '@/contexts/billing/infrastructure/persistence/billing.schema
|
|
27
|
+
import type { InvoiceRow } from '@/contexts/billing/infrastructure/persistence/billing.schema';
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
Correct:
|
|
@@ -32,8 +32,8 @@ Correct:
|
|
|
32
32
|
```ts
|
|
33
33
|
// src/contexts/billing/domain/aggregates/invoice.aggregate.ts
|
|
34
34
|
import { AggregateRoot } from '@ddd-ts-kit/kernel';
|
|
35
|
-
import type { Amount } from '@/contexts/billing/domain/value-objects/amount.vo
|
|
36
|
-
import { Money } from '@/shared-kernel/money.vo
|
|
35
|
+
import type { Amount } from '@/contexts/billing/domain/value-objects/amount.vo';
|
|
36
|
+
import { Money } from '@/shared-kernel/money.vo';
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
## Details
|
|
@@ -16,13 +16,13 @@ Incorrect:
|
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
18
|
// src/contexts/billing/infrastructure/persistence/drizzle-invoice.repository.ts
|
|
19
|
-
import type { IssueInvoiceBody } from '@/contexts/billing/presentation/http/issue-invoice.dto
|
|
19
|
+
import type { IssueInvoiceBody } from '@/contexts/billing/presentation/http/issue-invoice.dto';
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
Correct:
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
|
-
import type { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository
|
|
25
|
+
import type { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository';
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## Details
|
|
@@ -16,13 +16,13 @@ Incorrect:
|
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
18
|
// src/contexts/billing/presentation/http/issue-invoice.route.ts
|
|
19
|
-
import { DrizzleInvoiceRepository } from '@/contexts/billing/infrastructure/persistence/drizzle-invoice.repository
|
|
19
|
+
import { DrizzleInvoiceRepository } from '@/contexts/billing/infrastructure/persistence/drizzle-invoice.repository';
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
Correct:
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
|
-
import { IssueInvoiceCommand } from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.command
|
|
25
|
+
import { IssueInvoiceCommand } from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.command';
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## Details
|
|
@@ -6,17 +6,18 @@ Applies to: every linted file.
|
|
|
6
6
|
|
|
7
7
|
## Why
|
|
8
8
|
|
|
9
|
-
A dependency
|
|
9
|
+
A dependency is named by its port, never by what implements it. A handler that is given `KnexInvoiceRepository` is wired to one technology, cannot be given a fake, and makes the application layer depend on infrastructure through its own registration. In the declared style a class states what it depends on in its constructor, so the types of its parameters are held like the entries of a list.
|
|
10
10
|
|
|
11
11
|
## Reported
|
|
12
12
|
|
|
13
13
|
- a class named in a dependency list and imported from `infrastructure/` of a context
|
|
14
14
|
- a class named in a dependency list and imported from `test/fakes/` of a context
|
|
15
|
+
- in a declared-style project, in a role file: a class of either place that types a constructor parameter of a class carrying a declaration decorator without a list (`constructor(private readonly invoices: KnexInvoiceRepository) {}`)
|
|
15
16
|
|
|
16
17
|
Incorrect:
|
|
17
18
|
|
|
18
19
|
```ts
|
|
19
|
-
import { KnexInvoiceRepository } from '@/contexts/billing/infrastructure/persistence/knex-invoice.repository
|
|
20
|
+
import { KnexInvoiceRepository } from '@/contexts/billing/infrastructure/persistence/knex-invoice.repository';
|
|
20
21
|
|
|
21
22
|
@CommandHandler(IssueInvoiceCommand, [KnexInvoiceRepository, Clock])
|
|
22
23
|
export class IssueInvoiceHandler {}
|
|
@@ -25,7 +26,7 @@ export class IssueInvoiceHandler {}
|
|
|
25
26
|
Correct:
|
|
26
27
|
|
|
27
28
|
```ts
|
|
28
|
-
import { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository
|
|
29
|
+
import { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository';
|
|
29
30
|
|
|
30
31
|
@CommandHandler(IssueInvoiceCommand, [InvoiceRepository, Clock])
|
|
31
32
|
export class IssueInvoiceHandler {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddd-ts-kit/eslint-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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
|
"license": "MIT",
|
|
6
6
|
"repository": {
|