@shivaedev/quality 0.8.2 → 0.9.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/CHANGELOG.md +9 -0
- package/README.md +9 -7
- package/dist/rule.d.ts +1 -1
- package/dist/rule.d.ts.map +1 -1
- package/dist/rules/built-in.d.ts +1 -1
- package/dist/rules/comments/no-environment-pragma.js +1 -1
- package/dist/rules/comments/no-environment-pragma.js.map +1 -1
- package/package.json +7 -13
- package/src/rule.ts +1 -1
- package/src/rules/comments/no-environment-pragma.ts +1 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -5
- package/dist/index.js.map +0 -1
- package/src/index.ts +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.0 - 2026-10-04
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Breaking: no root entry and no module that re-exports another. `exports` maps one `"./*.ts"` pattern to every module (`src` under the `source` condition, `dist` otherwise), so you import the module that defines a name, and a bundler sees only the modules you use. Where each name now lives:
|
|
8
|
+
- `@shivaedev/quality`: `@shivaedev/quality/imports/fences/dsl.ts` (`fence`), `@shivaedev/quality/imports/fences/model.ts` (`Chain`, `ExampleStep`, `Examples`, `External`, `Fence`, `Target`), `@shivaedev/quality/imports/fences/selectors.ts` (`anyOf`, `anything`, `external`, `files`, `folders`, `modules`, `packages`, `scopes`, `workspace`), `@shivaedev/quality/config.ts` (`BuiltInRules`, `Level`, `QualityConfig`, `RuleSetting`, `RuleSettings`, `defineConfig`), `@shivaedev/quality/rule.ts` (`Configured`, `Finding`, `Findings`, `Rule`, `RuleContext`, `RuleInputs`, `SourceFile`, `defineRule`), `@shivaedev/quality/standard-schema.ts` (`StandardIssue`, `StandardResult`, `StandardSchemaV1`)
|
|
9
|
+
- `@shivaedev/quality/vitest`: `@shivaedev/quality/vitest.ts`
|
|
10
|
+
- A consumer `quality.config.ts` imports `defineConfig` from `@shivaedev/quality/config.ts`, `defineRule` from `rule.ts`, `fence` from `imports/fences/dsl.ts` and the selectors from `imports/fences/selectors.ts`. `./biome`, `./tsconfig/base.json` and `./tsconfig/package.json` are unchanged.
|
|
11
|
+
|
|
3
12
|
## 0.8.2 - 2026-10-04
|
|
4
13
|
|
|
5
14
|
### Changed
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Node 24 or later loads `quality.config.ts` directly (type stripping), so no buil
|
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
23
|
// quality.config.ts
|
|
24
|
-
import { defineConfig } from "@shivaedev/quality";
|
|
24
|
+
import { defineConfig } from "@shivaedev/quality/config.ts";
|
|
25
25
|
import { noConsoleLog } from "./quality/no-console-log.ts";
|
|
26
26
|
|
|
27
27
|
export default defineConfig({
|
|
@@ -243,7 +243,9 @@ The rule only reports; nothing rewrites the import. Whoever writes the import pi
|
|
|
243
243
|
A fence is one prohibition, stated in the config without patterns:
|
|
244
244
|
|
|
245
245
|
```ts
|
|
246
|
-
import { defineConfig
|
|
246
|
+
import { defineConfig } from "@shivaedev/quality/config.ts";
|
|
247
|
+
import { external, folders, packages } from "@shivaedev/quality/imports/fences/selectors.ts";
|
|
248
|
+
import { fence } from "@shivaedev/quality/imports/fences/dsl.ts";
|
|
247
249
|
|
|
248
250
|
const fences = [
|
|
249
251
|
fence("ui-never-imports-server")
|
|
@@ -251,8 +253,8 @@ const fences = [
|
|
|
251
253
|
.from(folders("packages/ui/src"))
|
|
252
254
|
.mayNotImport(packages("server"))
|
|
253
255
|
.demonstratedBy({
|
|
254
|
-
illegal: ["packages/ui/src/
|
|
255
|
-
legal: ["packages/ui/src/
|
|
256
|
+
illegal: ["packages/ui/src/app.ts", "packages/server/src/db.ts"],
|
|
257
|
+
legal: ["packages/ui/src/app.ts", external("effect")],
|
|
256
258
|
}),
|
|
257
259
|
];
|
|
258
260
|
|
|
@@ -278,7 +280,7 @@ A finding has its fence's name as its subject, so a registry entry with that sub
|
|
|
278
280
|
### Local rules
|
|
279
281
|
|
|
280
282
|
```ts
|
|
281
|
-
import { defineRule } from "@shivaedev/quality";
|
|
283
|
+
import { defineRule } from "@shivaedev/quality/rule.ts";
|
|
282
284
|
|
|
283
285
|
export const noConsoleLog = defineRule({
|
|
284
286
|
id: "local/no-console-log",
|
|
@@ -505,11 +507,11 @@ Both rules take a `suites` option, `.gitignore` patterns of folders that hold te
|
|
|
505
507
|
|
|
506
508
|
## Vitest projects
|
|
507
509
|
|
|
508
|
-
`@shivaedev/quality/vitest` sets up the tests of a package by file name, so no test file sets its environment with a pragma. It needs `vitest`, and `happy-dom` for DOM tests.
|
|
510
|
+
`@shivaedev/quality/vitest.ts` sets up the tests of a package by file name, so no test file sets its environment with a pragma. It needs `vitest`, and `happy-dom` for DOM tests.
|
|
509
511
|
|
|
510
512
|
```ts
|
|
511
513
|
// vitest.config.ts
|
|
512
|
-
import { testProjects } from "@shivaedev/quality/vitest";
|
|
514
|
+
import { testProjects } from "@shivaedev/quality/vitest.ts";
|
|
513
515
|
import { defineConfig } from "vitest/config";
|
|
514
516
|
|
|
515
517
|
export default defineConfig({ test: testProjects() });
|
package/dist/rule.d.ts
CHANGED
package/dist/rule.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../src/rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../src/rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE5E,MAAM,WAAW,OAAO;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;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AU,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,UAAU,EAAE,4BAA4B,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC"}
|
package/dist/rules/built-in.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare const builtInRules: readonly [import("../rule.ts").Rule<"structur
|
|
|
14
14
|
readonly rule: string;
|
|
15
15
|
}[];
|
|
16
16
|
}>, import("../rule.ts").Rule<"biome", undefined>, import("../rule.ts").Rule<"imports/cycles", undefined>, import("../rule.ts").Rule<"imports/fences", {
|
|
17
|
-
readonly fences?: readonly import("../
|
|
17
|
+
readonly fences?: readonly import("../imports/fences/model.ts").Fence[];
|
|
18
18
|
}>, import("../rule.ts").Rule<"imports/resolvable", {
|
|
19
19
|
readonly generated?: readonly string[];
|
|
20
20
|
}>, import("../rule.ts").Rule<"imports/aliased", undefined>, import("../rule.ts").Rule<"manifests/sorted", undefined>, import("../rule.ts").Rule<"files/named-after-export", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { definePatternRule } from "./pattern-rule.js";
|
|
2
2
|
export const noEnvironmentPragma = definePatternRule({
|
|
3
|
-
description: "A test file gets its environment from its name, not from a pragma: `*.dom.test.ts` runs in a DOM, every other test in Node. `@shivaedev/quality/vitest` sets up the Vitest projects that read the name.",
|
|
3
|
+
description: "A test file gets its environment from its name, not from a pragma: `*.dom.test.ts` runs in a DOM, every other test in Node. `@shivaedev/quality/vitest.ts` sets up the Vitest projects that read the name.",
|
|
4
4
|
id: "comments/no-environment-pragma",
|
|
5
5
|
message: (match) => `Sets the test environment with "${match}". Name the file *.dom.test.ts or *.dom.test.tsx instead.`,
|
|
6
6
|
patterns: [/^@(?:vitest|jest)-environment(?:-options)?(?=\s|$)/mu],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-environment-pragma.js","sourceRoot":"","sources":["../../../src/rules/comments/no-environment-pragma.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;IACpD,WAAW,EACV,
|
|
1
|
+
{"version":3,"file":"no-environment-pragma.js","sourceRoot":"","sources":["../../../src/rules/comments/no-environment-pragma.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;IACpD,WAAW,EACV,4MAA4M;IAC7M,EAAE,EAAE,gCAAgC;IACpC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,mCAAmC,KAAK,2DAA2D;IACvH,QAAQ,EAAE,CAAC,sDAAsD,CAAC;CAClE,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/quality",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Repository quality gate with typed rules, a baseline of existing debt and a registry of reasoned exceptions",
|
|
5
5
|
"homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/quality#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -23,19 +23,13 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"exports": {
|
|
26
|
-
"
|
|
27
|
-
"types": "./dist
|
|
28
|
-
"source": "./src
|
|
29
|
-
"import": "./dist
|
|
30
|
-
"default": "./dist
|
|
26
|
+
"./*.ts": {
|
|
27
|
+
"types": "./dist/*.d.ts",
|
|
28
|
+
"source": "./src/*.ts",
|
|
29
|
+
"import": "./dist/*.js",
|
|
30
|
+
"default": "./dist/*.js"
|
|
31
31
|
},
|
|
32
32
|
"./biome": "./biome/preset.json",
|
|
33
|
-
"./vitest": {
|
|
34
|
-
"types": "./dist/vitest.d.ts",
|
|
35
|
-
"source": "./src/vitest.ts",
|
|
36
|
-
"import": "./dist/vitest.js",
|
|
37
|
-
"default": "./dist/vitest.js"
|
|
38
|
-
},
|
|
39
33
|
"./tsconfig/base.json": "./tsconfig/base.json",
|
|
40
34
|
"./tsconfig/package.json": "./tsconfig/package.json",
|
|
41
35
|
"./package.json": "./package.json"
|
|
@@ -53,7 +47,7 @@
|
|
|
53
47
|
],
|
|
54
48
|
"dependencies": {
|
|
55
49
|
"@biomejs/biome": "2.5.14",
|
|
56
|
-
"@shivaedev/types": "0.
|
|
50
|
+
"@shivaedev/types": "0.2.0",
|
|
57
51
|
"ignore": "7.0.6",
|
|
58
52
|
"sort-package-json": "4.0.0",
|
|
59
53
|
"typescript": "npm:@typescript/typescript6@6.0.2"
|
package/src/rule.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { definePatternRule } from "./pattern-rule.ts";
|
|
|
2
2
|
|
|
3
3
|
export const noEnvironmentPragma = definePatternRule({
|
|
4
4
|
description:
|
|
5
|
-
"A test file gets its environment from its name, not from a pragma: `*.dom.test.ts` runs in a DOM, every other test in Node. `@shivaedev/quality/vitest` sets up the Vitest projects that read the name.",
|
|
5
|
+
"A test file gets its environment from its name, not from a pragma: `*.dom.test.ts` runs in a DOM, every other test in Node. `@shivaedev/quality/vitest.ts` sets up the Vitest projects that read the name.",
|
|
6
6
|
id: "comments/no-environment-pragma",
|
|
7
7
|
message: (match) => `Sets the test environment with "${match}". Name the file *.dom.test.ts or *.dom.test.tsx instead.`,
|
|
8
8
|
patterns: [/^@(?:vitest|jest)-environment(?:-options)?(?=\s|$)/mu],
|
package/dist/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { fence } from "#imports/fences/dsl.ts";
|
|
2
|
-
export type { Chain, ExampleStep, Examples, External, Fence, Target } from "#imports/fences/model.ts";
|
|
3
|
-
export { anyOf, anything, external, files, folders, modules, packages, scopes, workspace } from "#imports/fences/selectors.ts";
|
|
4
|
-
export type { BuiltInRules, Level, QualityConfig, RuleSetting, RuleSettings } from "./config.ts";
|
|
5
|
-
export { defineConfig } from "./config.ts";
|
|
6
|
-
export type { Configured, Finding, Findings, Rule, RuleContext, RuleInputs, SourceFile } from "./rule.ts";
|
|
7
|
-
export { defineRule } from "./rule.ts";
|
|
8
|
-
export type { StandardIssue, StandardResult, StandardSchemaV1 } from "./standard-schema.ts";
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACtG,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC/H,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC1G,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { fence } from "#imports/fences/dsl.ts";
|
|
2
|
-
export { anyOf, anything, external, files, folders, modules, packages, scopes, workspace } from "#imports/fences/selectors.ts";
|
|
3
|
-
export { defineConfig } from "./config.js";
|
|
4
|
-
export { defineRule } from "./rule.js";
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE/H,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC"}
|
package/src/index.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { fence } from "#imports/fences/dsl.ts";
|
|
2
|
-
export type { Chain, ExampleStep, Examples, External, Fence, Target } from "#imports/fences/model.ts";
|
|
3
|
-
export { anyOf, anything, external, files, folders, modules, packages, scopes, workspace } from "#imports/fences/selectors.ts";
|
|
4
|
-
export type { BuiltInRules, Level, QualityConfig, RuleSetting, RuleSettings } from "./config.ts";
|
|
5
|
-
export { defineConfig } from "./config.ts";
|
|
6
|
-
export type { Configured, Finding, Findings, Rule, RuleContext, RuleInputs, SourceFile } from "./rule.ts";
|
|
7
|
-
export { defineRule } from "./rule.ts";
|
|
8
|
-
export type { StandardIssue, StandardResult, StandardSchemaV1 } from "./standard-schema.ts";
|