-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
117 lines (116 loc) · 4 KB
/
Copy patheslint.config.js
File metadata and controls
117 lines (116 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// @ts-check
import { defineConfig } from 'eslint/config';
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import boundaries from 'eslint-plugin-boundaries';
import prettierConfig from 'eslint-config-prettier';
export default defineConfig(
{
ignores: ['dist/', 'coverage/', 'node_modules/', '.veripatch/'],
},
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: ['*.js'],
},
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
// A swallowed rejection can silently corrupt a verification verdict.
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
'no-console': 'error',
},
},
{
// Layer boundaries: cli → services → core ← adapters (core is pure, imports nothing but shared)
files: ['src/**/*.ts'],
plugins: { boundaries },
settings: {
'import/resolver': {
typescript: { alwaysTryTypes: true },
},
'boundaries/elements': [
{ type: 'cli', pattern: 'src/cli' },
{ type: 'services', pattern: 'src/services' },
{ type: 'core', pattern: 'src/core' },
{ type: 'adapters', pattern: 'src/adapters' },
{ type: 'shared', pattern: 'src/shared' },
],
},
rules: {
'boundaries/dependencies': [
'error',
{
default: 'disallow',
rules: [
{
from: { type: 'cli' },
allow: {
to: [
{ type: 'cli' },
{ type: 'services' },
{ type: 'core' },
{ type: 'shared' },
{ type: 'adapters' },
],
},
},
{
from: { type: 'services' },
allow: { to: [{ type: 'services' }, { type: 'core' }, { type: 'shared' }] },
},
{ from: { type: 'core' }, allow: { to: [{ type: 'core' }, { type: 'shared' }] } },
{
from: { type: 'adapters' },
allow: { to: [{ type: 'adapters' }, { type: 'core' }, { type: 'shared' }] },
},
{ from: { type: 'shared' }, allow: { to: [{ type: 'shared' }] } },
],
},
],
},
},
{
// core/ must stay pure: no filesystem, network, child processes, or Docker.
files: ['src/core/**/*.ts'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{ name: 'fs', message: 'core/ is pure — do I/O in adapters/.' },
{ name: 'node:fs', message: 'core/ is pure — do I/O in adapters/.' },
{ name: 'fs/promises', message: 'core/ is pure — do I/O in adapters/.' },
{ name: 'node:fs/promises', message: 'core/ is pure — do I/O in adapters/.' },
{ name: 'child_process', message: 'core/ is pure — no process spawning.' },
{ name: 'node:child_process', message: 'core/ is pure — no process spawning.' },
{ name: 'http', message: 'core/ is pure — do network in adapters/.' },
{ name: 'node:http', message: 'core/ is pure — do network in adapters/.' },
{ name: 'https', message: 'core/ is pure — do network in adapters/.' },
{ name: 'node:https', message: 'core/ is pure — do network in adapters/.' },
{ name: 'dockerode', message: 'core/ is pure — Docker lives in adapters/sandbox.' },
],
},
],
},
},
{
files: ['tests/**/*.ts', '*.config.ts'],
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
{
files: ['**/*.js'],
extends: [tseslint.configs.disableTypeChecked],
},
prettierConfig,
);