@brutalway/check-tree 0.4.0 → 0.5.1
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 +49 -20
- package/dist/checkTree.d.ts +1 -2
- package/dist/checkTree.js +15 -8
- package/dist/treeViolations-DzriZgEc.js +156 -0
- package/dist/treeViolations.d.ts +5 -1
- package/dist/treeViolations.js +1 -89
- package/package.json +28 -4
package/README.md
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
# @brutalway/check-tree
|
|
2
2
|
|
|
3
|
-
Checks the folders of a source tree, which a linter does not see:
|
|
3
|
+
Checks the folders of a source tree, which a linter does not see: no empty folder, no category folder with a single child, and files of one kind grouped in that kind's folder once there are two of them.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install --save-dev @brutalway/check-tree
|
|
9
|
+
npx check-tree src
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
### Use your own category folders
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npx check-tree src --categories components,hooks,utils
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The grouping rule only applies to the kinds listed in the table below that are also in this list.
|
|
21
|
+
|
|
22
|
+
### Keep the entry points of a published package
|
|
23
|
+
|
|
24
|
+
A published package keeps its entry points at the root of `src/`, one file per bin or export, whatever their kind. `--root-entries` leaves the files at the root of the checked folder where they are, and checks everything below as usual:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npx check-tree src --root-entries
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Run the check from code
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { treeViolations } from '@brutalway/check-tree/treeViolations';
|
|
34
|
+
|
|
35
|
+
const violations = treeViolations('src');
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
It takes the category folders as second argument and `{ rootEntries: true }` as third, like `--categories` and `--root-entries`.
|
|
39
|
+
|
|
40
|
+
## Reference
|
|
41
|
+
|
|
42
|
+
### Rules
|
|
4
43
|
|
|
5
44
|
- no empty folder
|
|
6
45
|
- a category folder (`components`, `hooks`, `stores`…) does not hold a single child: move the child up and delete the folder
|
|
@@ -12,12 +51,13 @@ Checks the folders of a source tree, which a linter does not see:
|
|
|
12
51
|
| `orchestrators/`, inside `components/` | components named `XContainer`, `XLayout` or `XPage` |
|
|
13
52
|
| `presenters/`, inside `components/` | the other components |
|
|
14
53
|
| `hooks/` | `useX.ts`, `useX.tsx` |
|
|
15
|
-
| `styles/` | `.css`
|
|
54
|
+
| `styles/` | `.css`, except `X.module.css`, which stays next to `X.tsx` |
|
|
16
55
|
| `types/` | `xTypes.ts` |
|
|
17
56
|
| `configs/` | `xConfig.ts` |
|
|
18
57
|
| `routes/` | `xRoutes.ts` |
|
|
19
58
|
| `services/` | `xService.ts` |
|
|
20
59
|
| `queries/` | `xQueries.ts` |
|
|
60
|
+
| `keys/` | `xKeys.ts`, query key factories |
|
|
21
61
|
| `schemas/` | `xSchemas.ts` |
|
|
22
62
|
| `clients/` | `xClient.ts` |
|
|
23
63
|
| `workers/` | `xWorker.ts` |
|
|
@@ -28,25 +68,14 @@ So a feature with two components puts them in `components/`, and a `components/`
|
|
|
28
68
|
|
|
29
69
|
Test files (`*.test.ts`, `*.test.tsx`) are not counted.
|
|
30
70
|
|
|
31
|
-
|
|
32
|
-
npm install --save-dev @brutalway/check-tree
|
|
33
|
-
npx check-tree src
|
|
34
|
-
```
|
|
71
|
+
### Output
|
|
35
72
|
|
|
36
73
|
It prints one line per problem and exits with code 1 if it found any.
|
|
37
74
|
|
|
38
|
-
|
|
75
|
+
### Options
|
|
39
76
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
The check is also exported as a function:
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
import { treeViolations } from '@brutalway/check-tree/treeViolations';
|
|
50
|
-
|
|
51
|
-
const violations = treeViolations('src');
|
|
52
|
-
```
|
|
77
|
+
| Option | Default |
|
|
78
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
79
|
+
| folder | `src` |
|
|
80
|
+
| `--categories <list>` | `components`, `orchestrators`, `presenters`, `hooks`, `styles`, `types`, `configs`, `stores`, `routes`, `services`, `queries`, `keys`, `schemas`, `clients`, `workers`, `lib` |
|
|
81
|
+
| `--root-entries` | off |
|
package/dist/checkTree.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export {};
|
|
1
|
+
export {}
|
package/dist/checkTree.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { t as treeViolations } from "./treeViolations-DzriZgEc.js";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { parseArgs } from "node:util";
|
|
5
|
+
// src/checkTree.ts
|
|
6
|
+
const { values, positionals } = parseArgs({
|
|
7
|
+
allowPositionals: true,
|
|
8
|
+
options: {
|
|
9
|
+
categories: { type: "string" },
|
|
10
|
+
"root-entries": { type: "boolean" }
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
const categories = values.categories?.split(",").map((category) => category.trim());
|
|
14
|
+
const violations = treeViolations(resolve(positionals[0] ?? "src"), categories, { rootEntries: values["root-entries"] === true });
|
|
15
|
+
for (const violation of violations) console.error(violation);
|
|
10
16
|
process.exitCode = violations.length === 0 ? 0 : 1;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { basename, join, relative } from "node:path";
|
|
2
|
+
import { readdirSync } from "node:fs";
|
|
3
|
+
// src/features/tree-violations/TreeViolationsConfig.ts
|
|
4
|
+
const DEFAULT_CATEGORY_FOLDERS = [
|
|
5
|
+
"components",
|
|
6
|
+
"orchestrators",
|
|
7
|
+
"presenters",
|
|
8
|
+
"hooks",
|
|
9
|
+
"styles",
|
|
10
|
+
"types",
|
|
11
|
+
"configs",
|
|
12
|
+
"stores",
|
|
13
|
+
"routes",
|
|
14
|
+
"services",
|
|
15
|
+
"queries",
|
|
16
|
+
"keys",
|
|
17
|
+
"schemas",
|
|
18
|
+
"clients",
|
|
19
|
+
"workers",
|
|
20
|
+
"lib"
|
|
21
|
+
];
|
|
22
|
+
const TEST_FILE = /\.test\.tsx?$/u;
|
|
23
|
+
const NAMED_FILE = /^use[A-Z]|(?:Types|Config|Store|Routes|Service|Queries|Keys|Schemas|Client|Worker|Env)\.ts$|Content\.tsx?$|\.d\.ts$/u;
|
|
24
|
+
const COMPONENT_FILE = /^[A-Z]\w*\.tsx$/u;
|
|
25
|
+
const ORCHESTRATOR_FILE = /(?:Container|Layout|Page)\.tsx$/u;
|
|
26
|
+
const COMPONENT_FOLDERS = /* @__PURE__ */ new Set([
|
|
27
|
+
"components",
|
|
28
|
+
"orchestrators",
|
|
29
|
+
"presenters"
|
|
30
|
+
]);
|
|
31
|
+
function isComponent(fileName) {
|
|
32
|
+
return COMPONENT_FILE.test(fileName) && !NAMED_FILE.test(fileName);
|
|
33
|
+
}
|
|
34
|
+
function outsideOwnFolder(folder) {
|
|
35
|
+
return (folderName) => folderName !== folder;
|
|
36
|
+
}
|
|
37
|
+
const FILE_GROUPS = [
|
|
38
|
+
{
|
|
39
|
+
folder: "components",
|
|
40
|
+
belongs: isComponent,
|
|
41
|
+
appliesIn: (folderName) => !COMPONENT_FOLDERS.has(folderName)
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
folder: "orchestrators",
|
|
45
|
+
belongs: (fileName) => isComponent(fileName) && ORCHESTRATOR_FILE.test(fileName),
|
|
46
|
+
appliesIn: (folderName) => folderName === "components"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
folder: "presenters",
|
|
50
|
+
belongs: (fileName) => isComponent(fileName) && !ORCHESTRATOR_FILE.test(fileName),
|
|
51
|
+
appliesIn: (folderName) => folderName === "components"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
folder: "hooks",
|
|
55
|
+
belongs: (fileName) => /^use[A-Z]\w*\.tsx?$/u.test(fileName),
|
|
56
|
+
appliesIn: outsideOwnFolder("hooks")
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
folder: "styles",
|
|
60
|
+
belongs: (fileName) => fileName.endsWith(".css") && !fileName.endsWith(".module.css"),
|
|
61
|
+
appliesIn: outsideOwnFolder("styles")
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
folder: "types",
|
|
65
|
+
belongs: (fileName) => fileName.endsWith("Types.ts"),
|
|
66
|
+
appliesIn: outsideOwnFolder("types")
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
folder: "configs",
|
|
70
|
+
belongs: (fileName) => fileName.endsWith("Config.ts"),
|
|
71
|
+
appliesIn: outsideOwnFolder("configs")
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
folder: "stores",
|
|
75
|
+
belongs: (fileName) => fileName.endsWith("Store.ts"),
|
|
76
|
+
appliesIn: outsideOwnFolder("stores")
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
folder: "routes",
|
|
80
|
+
belongs: (fileName) => fileName.endsWith("Routes.ts"),
|
|
81
|
+
appliesIn: outsideOwnFolder("routes")
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
folder: "services",
|
|
85
|
+
belongs: (fileName) => fileName.endsWith("Service.ts"),
|
|
86
|
+
appliesIn: outsideOwnFolder("services")
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
folder: "queries",
|
|
90
|
+
belongs: (fileName) => fileName.endsWith("Queries.ts"),
|
|
91
|
+
appliesIn: outsideOwnFolder("queries")
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
folder: "keys",
|
|
95
|
+
belongs: (fileName) => fileName.endsWith("Keys.ts"),
|
|
96
|
+
appliesIn: outsideOwnFolder("keys")
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
folder: "schemas",
|
|
100
|
+
belongs: (fileName) => fileName.endsWith("Schemas.ts"),
|
|
101
|
+
appliesIn: outsideOwnFolder("schemas")
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
folder: "clients",
|
|
105
|
+
belongs: (fileName) => fileName.endsWith("Client.ts"),
|
|
106
|
+
appliesIn: outsideOwnFolder("clients")
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
folder: "workers",
|
|
110
|
+
belongs: (fileName) => fileName.endsWith("Worker.ts"),
|
|
111
|
+
appliesIn: outsideOwnFolder("workers")
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
folder: "lib",
|
|
115
|
+
belongs: (fileName) => fileName.endsWith(".ts") && !NAMED_FILE.test(fileName),
|
|
116
|
+
appliesIn: outsideOwnFolder("lib")
|
|
117
|
+
}
|
|
118
|
+
];
|
|
119
|
+
// src/features/tree-violations/treeViolations.ts
|
|
120
|
+
function groupViolations(name, folderName, listing, categoryFolders) {
|
|
121
|
+
const violations = [];
|
|
122
|
+
for (const { folder, belongs, appliesIn } of FILE_GROUPS) {
|
|
123
|
+
if (!categoryFolders.has(folder) || !appliesIn(folderName)) continue;
|
|
124
|
+
const loose = listing.files.filter(belongs);
|
|
125
|
+
if (loose.length === 0) continue;
|
|
126
|
+
if (listing.folders.has(folder)) violations.push(`${name} has a ${folder}/ folder: move ${loose.join(", ")} into it`);
|
|
127
|
+
else if (loose.length > 1) violations.push(`${name} holds ${loose.length} ${folder} files (${loose.join(", ")}): move them into ${folder}/`);
|
|
128
|
+
}
|
|
129
|
+
return violations;
|
|
130
|
+
}
|
|
131
|
+
function folderListing(entries) {
|
|
132
|
+
return {
|
|
133
|
+
files: entries.filter((entry) => entry.isFile()).map((entry) => entry.name).toSorted(),
|
|
134
|
+
folders: new Set(entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name))
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function shapeViolations(name, count, isCategory) {
|
|
138
|
+
if (count === 0) return [`${name} is empty: delete it`];
|
|
139
|
+
if (count === 1 && isCategory) return [`${name} holds a single child: move it up one level and delete the folder`];
|
|
140
|
+
return [];
|
|
141
|
+
}
|
|
142
|
+
function folderViolations(folder, name, categoryFolders, groupsFiles) {
|
|
143
|
+
const children = readdirSync(folder, { withFileTypes: true }).filter((entry) => !TEST_FILE.test(entry.name));
|
|
144
|
+
const violations = shapeViolations(name, children.length, categoryFolders.has(basename(folder)));
|
|
145
|
+
if (!groupsFiles) return violations;
|
|
146
|
+
const listing = folderListing(children);
|
|
147
|
+
return [...violations, ...groupViolations(name, basename(folder), listing, categoryFolders)];
|
|
148
|
+
}
|
|
149
|
+
function treeViolations(root, categoryFolders = DEFAULT_CATEGORY_FOLDERS, options = {}) {
|
|
150
|
+
const categories = new Set(categoryFolders);
|
|
151
|
+
function walk(folder) {
|
|
152
|
+
return [...folderViolations(folder, relative(join(root, ".."), folder), categories, folder !== root || options.rootEntries !== true), ...readdirSync(folder, { withFileTypes: true }).filter((entry) => entry.isDirectory()).flatMap((entry) => walk(join(folder, entry.name)))];
|
|
153
|
+
}
|
|
154
|
+
return walk(root);
|
|
155
|
+
}
|
|
156
|
+
export { treeViolations as t };
|
package/dist/treeViolations.d.ts
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
type TreeOptions = {
|
|
2
|
+
rootEntries?: boolean;
|
|
3
|
+
};
|
|
4
|
+
export declare function treeViolations(root: string, categoryFolders?: readonly string[], options?: TreeOptions): string[];
|
|
5
|
+
export {};
|
package/dist/treeViolations.js
CHANGED
|
@@ -1,89 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { basename, join, relative } from 'node:path';
|
|
3
|
-
const DEFAULT_CATEGORY_FOLDERS = [
|
|
4
|
-
'components',
|
|
5
|
-
'orchestrators',
|
|
6
|
-
'presenters',
|
|
7
|
-
'hooks',
|
|
8
|
-
'styles',
|
|
9
|
-
'types',
|
|
10
|
-
'configs',
|
|
11
|
-
'stores',
|
|
12
|
-
'routes',
|
|
13
|
-
'services',
|
|
14
|
-
'queries',
|
|
15
|
-
'schemas',
|
|
16
|
-
'clients',
|
|
17
|
-
'workers',
|
|
18
|
-
'lib',
|
|
19
|
-
];
|
|
20
|
-
const TEST_FILE = /\.test\.tsx?$/u;
|
|
21
|
-
const NAMED_FILE = /^use[A-Z]|(?:Types|Config|Store|Routes|Service|Queries|Schemas|Client|Worker|Env)\.ts$|Content\.tsx?$|\.d\.ts$/u;
|
|
22
|
-
const COMPONENT_FILE = /^[A-Z]\w*\.tsx$/u;
|
|
23
|
-
const ORCHESTRATOR_FILE = /(?:Container|Layout|Page)\.tsx$/u;
|
|
24
|
-
const COMPONENT_FOLDERS = new Set(['components', 'orchestrators', 'presenters']);
|
|
25
|
-
function isComponent(fileName) {
|
|
26
|
-
return COMPONENT_FILE.test(fileName) && !NAMED_FILE.test(fileName);
|
|
27
|
-
}
|
|
28
|
-
function outsideOwnFolder(folder) {
|
|
29
|
-
return (folderName) => folderName !== folder;
|
|
30
|
-
}
|
|
31
|
-
const FILE_GROUPS = [
|
|
32
|
-
{ folder: 'components', belongs: isComponent, appliesIn: (folderName) => !COMPONENT_FOLDERS.has(folderName) },
|
|
33
|
-
{ folder: 'orchestrators', belongs: (fileName) => isComponent(fileName) && ORCHESTRATOR_FILE.test(fileName), appliesIn: (folderName) => folderName === 'components' },
|
|
34
|
-
{ folder: 'presenters', belongs: (fileName) => isComponent(fileName) && !ORCHESTRATOR_FILE.test(fileName), appliesIn: (folderName) => folderName === 'components' },
|
|
35
|
-
{ folder: 'hooks', belongs: (fileName) => /^use[A-Z]\w*\.tsx?$/u.test(fileName), appliesIn: outsideOwnFolder('hooks') },
|
|
36
|
-
{ folder: 'styles', belongs: (fileName) => fileName.endsWith('.css'), appliesIn: outsideOwnFolder('styles') },
|
|
37
|
-
{ folder: 'types', belongs: (fileName) => fileName.endsWith('Types.ts'), appliesIn: outsideOwnFolder('types') },
|
|
38
|
-
{ folder: 'configs', belongs: (fileName) => fileName.endsWith('Config.ts'), appliesIn: outsideOwnFolder('configs') },
|
|
39
|
-
{ folder: 'stores', belongs: (fileName) => fileName.endsWith('Store.ts'), appliesIn: outsideOwnFolder('stores') },
|
|
40
|
-
{ folder: 'routes', belongs: (fileName) => fileName.endsWith('Routes.ts'), appliesIn: outsideOwnFolder('routes') },
|
|
41
|
-
{ folder: 'services', belongs: (fileName) => fileName.endsWith('Service.ts'), appliesIn: outsideOwnFolder('services') },
|
|
42
|
-
{ folder: 'queries', belongs: (fileName) => fileName.endsWith('Queries.ts'), appliesIn: outsideOwnFolder('queries') },
|
|
43
|
-
{ folder: 'schemas', belongs: (fileName) => fileName.endsWith('Schemas.ts'), appliesIn: outsideOwnFolder('schemas') },
|
|
44
|
-
{ folder: 'clients', belongs: (fileName) => fileName.endsWith('Client.ts'), appliesIn: outsideOwnFolder('clients') },
|
|
45
|
-
{ folder: 'workers', belongs: (fileName) => fileName.endsWith('Worker.ts'), appliesIn: outsideOwnFolder('workers') },
|
|
46
|
-
{ folder: 'lib', belongs: (fileName) => fileName.endsWith('.ts') && !NAMED_FILE.test(fileName), appliesIn: outsideOwnFolder('lib') },
|
|
47
|
-
];
|
|
48
|
-
function groupViolations(name, folderName, fileNames, folderNames, categoryFolders) {
|
|
49
|
-
const violations = [];
|
|
50
|
-
for (const { folder, belongs, appliesIn } of FILE_GROUPS) {
|
|
51
|
-
if (!categoryFolders.has(folder) || !appliesIn(folderName))
|
|
52
|
-
continue;
|
|
53
|
-
const loose = fileNames.filter(belongs);
|
|
54
|
-
if (loose.length === 0)
|
|
55
|
-
continue;
|
|
56
|
-
if (folderNames.has(folder))
|
|
57
|
-
violations.push(`${name} has a ${folder}/ folder: move ${loose.join(', ')} into it`);
|
|
58
|
-
else if (loose.length > 1)
|
|
59
|
-
violations.push(`${name} holds ${loose.length} ${folder} files (${loose.join(', ')}): move them into ${folder}/`);
|
|
60
|
-
}
|
|
61
|
-
return violations;
|
|
62
|
-
}
|
|
63
|
-
function folderViolations(folder, name, categoryFolders) {
|
|
64
|
-
const entries = readdirSync(folder, { withFileTypes: true });
|
|
65
|
-
const children = entries.filter((entry) => !TEST_FILE.test(entry.name));
|
|
66
|
-
const fileNames = children
|
|
67
|
-
.filter((entry) => entry.isFile())
|
|
68
|
-
.map((entry) => entry.name)
|
|
69
|
-
.toSorted();
|
|
70
|
-
const folderNames = new Set(children.filter((entry) => entry.isDirectory()).map((entry) => entry.name));
|
|
71
|
-
const violations = [];
|
|
72
|
-
if (children.length === 0)
|
|
73
|
-
violations.push(`${name} is empty: delete it`);
|
|
74
|
-
if (children.length === 1 && categoryFolders.has(basename(folder)))
|
|
75
|
-
violations.push(`${name} holds a single child: move it up one level and delete the folder`);
|
|
76
|
-
return [...violations, ...groupViolations(name, basename(folder), fileNames, folderNames, categoryFolders)];
|
|
77
|
-
}
|
|
78
|
-
export function treeViolations(root, categoryFolders = DEFAULT_CATEGORY_FOLDERS) {
|
|
79
|
-
const categories = new Set(categoryFolders);
|
|
80
|
-
function walk(folder) {
|
|
81
|
-
return [
|
|
82
|
-
...folderViolations(folder, relative(join(root, '..'), folder), categories),
|
|
83
|
-
...readdirSync(folder, { withFileTypes: true })
|
|
84
|
-
.filter((entry) => entry.isDirectory())
|
|
85
|
-
.flatMap((entry) => walk(join(folder, entry.name))),
|
|
86
|
-
];
|
|
87
|
-
}
|
|
88
|
-
return walk(root);
|
|
89
|
-
}
|
|
1
|
+
export { t as treeViolations } from "./treeViolations-DzriZgEc.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brutalway/check-tree",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Checks a source tree: no empty folder, no category folder holding a single child, stylesheets grouped in styles/.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lint",
|
|
@@ -18,9 +18,11 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"author": "elnop",
|
|
20
20
|
"type": "module",
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=26"
|
|
23
|
+
},
|
|
21
24
|
"files": [
|
|
22
|
-
"dist"
|
|
23
|
-
"!dist/tsconfig.tsbuildinfo"
|
|
25
|
+
"dist"
|
|
24
26
|
],
|
|
25
27
|
"bin": {
|
|
26
28
|
"check-tree": "./dist/checkTree.js"
|
|
@@ -29,6 +31,28 @@
|
|
|
29
31
|
"./treeViolations": "./dist/treeViolations.js"
|
|
30
32
|
},
|
|
31
33
|
"scripts": {
|
|
32
|
-
"
|
|
34
|
+
"build": "tsdown",
|
|
35
|
+
"typecheck": "tsc -p .",
|
|
36
|
+
"lint": "oxlint --type-aware src oxlint.config.ts tsdown.config.ts",
|
|
37
|
+
"deps": "depcruise --output-type err-long src",
|
|
38
|
+
"tree": "node src/checkTree.ts src --root-entries",
|
|
39
|
+
"duplicates": "jscpd src",
|
|
40
|
+
"check": "npm run typecheck && npm run lint && npm run deps && npm run tree && npm run duplicates",
|
|
41
|
+
"test": "node --test 'src/**/*.test.ts'"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@brutalway/dependency-cruiser-config": "0.5.0",
|
|
45
|
+
"@brutalway/oxlint-config-node": "0.2.1",
|
|
46
|
+
"@brutalway/oxlint-config-node-test": "0.1.0",
|
|
47
|
+
"@brutalway/tsconfig": "0.4.0",
|
|
48
|
+
"dependency-cruiser": "18.7.2",
|
|
49
|
+
"jscpd": "5.4.2",
|
|
50
|
+
"oxlint": "1.91.0",
|
|
51
|
+
"oxlint-tsgolint": "7.0.2005",
|
|
52
|
+
"tsdown": "0.23.5",
|
|
53
|
+
"typescript": "7.0.2"
|
|
54
|
+
},
|
|
55
|
+
"imports": {
|
|
56
|
+
"#src/*": "./src/*"
|
|
33
57
|
}
|
|
34
58
|
}
|