@20baht/strict 0.0.0-stage → 0.1.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.
@@ -0,0 +1,241 @@
1
+ /**
2
+ * Architecture boundaries as a dependency-cruiser config. Rules are generic; paths and the
3
+ * module graph are parameters.
4
+ *
5
+ * server app.ts / index.ts / worker.ts (composition)
6
+ * modules/<name>/ (features; MODULE_DEPS lists what each may import)
7
+ * shared/ (infrastructure, knows no feature)
8
+ * web app/shell/ app/pages/<name>/ (features)
9
+ * app/shared/ (UI building blocks)
10
+ * app/core/ (API + auth + interceptors)
11
+ * federation (opt-in, a Native Federation host and its remotes)
12
+ * apps/<host|remote>/src/app/modules/ (pages, reached through the router)
13
+ * apps/<remote>/src/app/services|shared/ (lower layers, know no page)
14
+ * apps/<host>/src/app/core/ (lower layer, knows no page)
15
+ * packages/<name>/ (shared code, knows no app)
16
+ */
17
+
18
+ const TESTS = '\\.(test|spec)\\.ts$';
19
+ const alt = (names) => names.map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|');
20
+
21
+ /**
22
+ * @param {import('./index.d.ts').DepcruiseOptions} options
23
+ * @returns {object}
24
+ */
25
+ export function makeConfig({
26
+ serverApps = [],
27
+ webApps = [],
28
+ moduleDeps = {},
29
+ overrides = {},
30
+ testSupport = 'src/shared/test/',
31
+ generic = false,
32
+ federation,
33
+ packages = [],
34
+ packagesMayImport = [],
35
+ } = {}) {
36
+ const server = alt(serverApps);
37
+ const web = alt(webApps);
38
+ const serverSrc = `^apps/(?:${server})/src/`;
39
+ const webSrc = `^apps/(?:${web})/src/`;
40
+ const webApp = `^apps/(?:${web})/src/app/`;
41
+ const testSupportRe = server ? `^apps/(?:${server})/${testSupport}` : undefined;
42
+ const crossPageAllowed = overrides.webCrossPageAllowed ?? [];
43
+
44
+ const moduleRules = server
45
+ ? Object.entries(moduleDeps).map(([name, allowed]) => ({
46
+ name: `server-module-${name}-imports`,
47
+ severity: 'error',
48
+ comment: `modules/${name} may import ${allowed.length ? allowed.join(', ') : 'no other module'}. Add the edge to moduleDeps if it is intended.`,
49
+ from: { path: `${serverSrc}modules/${name}/`, pathNot: TESTS },
50
+ to: {
51
+ path: `${serverSrc}modules/`,
52
+ pathNot: `${serverSrc}modules/(${[name, ...allowed].join('|')})/`,
53
+ },
54
+ }))
55
+ : [];
56
+
57
+ const serverRules = server
58
+ ? [
59
+ ...moduleRules,
60
+ {
61
+ name: 'server-shared-knows-no-feature',
62
+ severity: 'error',
63
+ comment: 'shared/ is infrastructure; a feature that shared/ needs belongs in a module.',
64
+ from: { path: `${serverSrc}shared/`, pathNot: [TESTS, testSupportRe] },
65
+ to: { path: `${serverSrc}modules/` },
66
+ },
67
+ {
68
+ name: 'server-modules-not-composition',
69
+ severity: 'error',
70
+ comment: 'app.ts / index.ts / worker.ts compose the modules; nothing imports them back.',
71
+ from: { path: `${serverSrc}(modules|shared)/`, pathNot: [TESTS, testSupportRe] },
72
+ to: { path: `${serverSrc}(app|index|worker)\\.ts$` },
73
+ },
74
+ ]
75
+ : [];
76
+
77
+ const serverWebRules =
78
+ server && web
79
+ ? [
80
+ {
81
+ name: 'server-not-web',
82
+ severity: 'error',
83
+ from: { path: `^apps/(?:${server})/` },
84
+ to: { path: `^apps/(?:${web})/` },
85
+ },
86
+ {
87
+ name: 'web-server-types-only',
88
+ severity: 'error',
89
+ comment:
90
+ 'The web app shares the server only as types (the eden App type). No server runtime code in the bundle.',
91
+ from: { path: webSrc },
92
+ to: { path: `^apps/(?:${server})/`, dependencyTypesNot: ['type-only'] },
93
+ },
94
+ ]
95
+ : [];
96
+
97
+ const webRules = web
98
+ ? [
99
+ {
100
+ name: 'web-shared-and-core-know-no-feature',
101
+ severity: 'error',
102
+ from: { path: `${webApp}(shared|core)/` },
103
+ to: { path: `${webApp}(pages|shell)/` },
104
+ },
105
+ {
106
+ name: 'web-core-below-shared',
107
+ severity: 'error',
108
+ comment:
109
+ 'core/ (API, auth) is the lowest layer; shared/ UI builds on it, not the reverse.',
110
+ from: { path: `${webApp}core/` },
111
+ to: { path: `${webApp}shared/` },
112
+ },
113
+ {
114
+ name: 'web-shell-no-pages',
115
+ severity: 'error',
116
+ comment: 'Pages are reached through the router, never imported by the shell.',
117
+ from: { path: `${webApp}shell/` },
118
+ to: { path: `${webApp}pages/` },
119
+ },
120
+ {
121
+ name: 'web-no-cross-page',
122
+ severity: 'error',
123
+ comment: `A page does not import another page.${
124
+ crossPageAllowed.length
125
+ ? ` Composition pages allowed: ${crossPageAllowed.join(', ')}.`
126
+ : ''
127
+ }`,
128
+ from: {
129
+ path: `${webApp}pages/([^/]+)/`,
130
+ ...(crossPageAllowed.length && {
131
+ pathNot: `${webApp}pages/(${alt(crossPageAllowed)})/`,
132
+ }),
133
+ },
134
+ to: { path: `${webApp}pages/([^/]+)/`, pathNot: `${webApp}pages/$1/` },
135
+ },
136
+ ]
137
+ : [];
138
+
139
+ const allApps = alt([...serverApps, ...webApps]);
140
+ const productionRule = allApps
141
+ ? [
142
+ {
143
+ name: 'production-not-tests',
144
+ severity: 'error',
145
+ from: {
146
+ path: `^apps/(?:${allApps})/src/`,
147
+ pathNot: [TESTS, testSupportRe].filter(Boolean),
148
+ },
149
+ to: { path: [TESTS, testSupportRe].filter(Boolean) },
150
+ },
151
+ ]
152
+ : [];
153
+
154
+ // Layout-agnostic rules for `bahtui new` workspaces: `(apps|packages)/<name>/src`.
155
+ const genericRules = generic
156
+ ? [
157
+ { name: 'no-circular', severity: 'error', from: {}, to: { circular: true } },
158
+ {
159
+ name: 'workspace-production-not-tests',
160
+ severity: 'error',
161
+ from: { path: '^(apps|packages)/[^/]+/src/', pathNot: TESTS },
162
+ to: { path: TESTS },
163
+ },
164
+ ]
165
+ : [];
166
+
167
+ return {
168
+ forbidden: [
169
+ ...genericRules,
170
+ ...serverRules,
171
+ ...serverWebRules,
172
+ ...webRules,
173
+ ...productionRule,
174
+ ...federationRules(federation),
175
+ ...packageRules(packages, packagesMayImport),
176
+ ],
177
+ options: {
178
+ doNotFollow: { path: 'node_modules' },
179
+ tsPreCompilationDeps: true,
180
+ exclude: { path: ['/dist/', '\\.angular/', '\\.gen\\.ts$'] },
181
+ reporterOptions: { text: { highlightFocused: true } },
182
+ },
183
+ };
184
+ }
185
+
186
+ /**
187
+ * A Native Federation host and its remotes meet only at runtime (the manifest and
188
+ * remoteEntry.json): no app imports another, and each app's lower layers know no page.
189
+ * @param {import('./index.d.ts').FederationOptions | undefined} federation
190
+ */
191
+ function federationRules(federation) {
192
+ if (!federation) return [];
193
+ const {
194
+ host,
195
+ remotes,
196
+ pages = 'modules',
197
+ remoteLayers = ['services', 'shared'],
198
+ hostLayers = ['core'],
199
+ } = federation;
200
+ const apps = [host, ...remotes];
201
+ const apart = apps.map((app) => ({
202
+ name: `${app}-imports-no-other-app`,
203
+ severity: 'error',
204
+ comment:
205
+ 'Web apps never import each other: a static import would bundle one app into another build. Share code through packages/.',
206
+ from: { path: `^apps/${alt([app])}/src/` },
207
+ to: { path: `^apps/(?!${alt([app])}/)(?:${alt(apps)})/` },
208
+ }));
209
+ const layers = apps
210
+ .map((app) => ({ app, names: app === host ? hostLayers : remoteLayers }))
211
+ .filter(({ names }) => names.length > 0)
212
+ .map(({ app, names }) => ({
213
+ name: `${app}-lower-layers-know-no-page`,
214
+ severity: 'error',
215
+ comment: `${names.join(', ')} know no page; pages are reached through the router.`,
216
+ from: { path: `^apps/${alt([app])}/src/app/(${alt(names)})/` },
217
+ to: { path: `^apps/${alt([app])}/src/app/${alt([pages])}/` },
218
+ }));
219
+ return [...apart, ...layers];
220
+ }
221
+
222
+ /**
223
+ * Workspace packages sit below the apps.
224
+ * @param {string[]} packages
225
+ * @param {string[]} mayImport
226
+ */
227
+ function packageRules(packages, mayImport) {
228
+ if (packages.length === 0) return [];
229
+ return [
230
+ {
231
+ name: 'packages-know-no-app',
232
+ severity: 'error',
233
+ comment: `packages/ (${packages.join(', ')}) are below the apps and import none of them.`,
234
+ from: { path: `^packages/(?:${alt(packages)})/` },
235
+ to: {
236
+ path: '^apps/',
237
+ ...(mayImport.length > 0 && { pathNot: mayImport.map((p) => `^apps/${p}`) }),
238
+ },
239
+ },
240
+ ];
241
+ }
@@ -0,0 +1,335 @@
1
+ /**
2
+ * ESLint rules that keep an app on the bahtui design system (@20baht/ui / -store /
3
+ * -validator). Two surfaces:
4
+ *
5
+ * - Angular templates (`*.html` + inline `template:`): no raw HTML controls, no hand-placed
6
+ * `<baht-*>` field primitives (forms are JSON-driven).
7
+ * - Component CSS: every `var(--baht-*)` must exist in the installed tokens.css (or the app's
8
+ * own overrides), and colours are tokens, not literals.
9
+ *
10
+ * Plain ESLint rule objects, wired as the `bahtui` plugin.
11
+ */
12
+ import { existsSync, readFileSync, readdirSync } from 'node:fs';
13
+ import { createRequire } from 'node:module';
14
+ import * as path from 'node:path';
15
+ import { dirname, join, relative, sep } from 'node:path';
16
+ const childrenOf = (node) => {
17
+ const c = node.children;
18
+ if (!c) return [];
19
+ return Array.isArray(c) ? c : c.toArray();
20
+ };
21
+ const elementLoc = (context, node) =>
22
+ context.sourceCode?.parserServices?.convertElementSourceSpanToLoc?.(context, node) ?? node.loc;
23
+ const RAW_CONTROLS = {
24
+ button:
25
+ '<baht-button> (variant="primary|secondary|ghost|danger", size="sm"); icon-only buttons take aria-label',
26
+ input:
27
+ 'a field in the JSON <baht-form> definition; chip filters are <baht-filter>; file pickers are <baht-upload>',
28
+ select: 'a `select` field in the JSON <baht-form> definition',
29
+ textarea: 'a `textarea` field in the JSON <baht-form> definition',
30
+ table: '<baht-table> with [columns] / [rows]',
31
+ dialog: '<baht-modal>',
32
+ progress: '<baht-progress>',
33
+ meter: '<baht-meter>',
34
+ };
35
+ const noRawControl = {
36
+ meta: {
37
+ type: 'suggestion',
38
+ docs: { description: 'Use the @20baht/ui element instead of a native HTML control.' },
39
+ schema: [
40
+ {
41
+ type: 'object',
42
+ properties: { allow: { type: 'array', items: { type: 'string' } } },
43
+ additionalProperties: false,
44
+ },
45
+ ],
46
+ messages: {
47
+ raw: 'Native <{{name}}> bypasses the design system. Use {{instead}}.',
48
+ anchor:
49
+ 'Plain <a href> bypasses the design system. Use <baht-link href label [external]>; anchors with routerLink are fine.',
50
+ },
51
+ },
52
+ create(context) {
53
+ const [opts] = context.options;
54
+ const allow = new Set(opts?.allow ?? []);
55
+ return {
56
+ Element(node) {
57
+ const name = node.name.toLowerCase();
58
+ if (allow.has(name)) return;
59
+ const instead = RAW_CONTROLS[name];
60
+ if (instead) {
61
+ context.report({
62
+ loc: elementLoc(context, node),
63
+ messageId: 'raw',
64
+ data: { name, instead },
65
+ });
66
+ return;
67
+ }
68
+ if (name === 'a') {
69
+ const attrs = node.attributes.map((a) => a.name);
70
+ const inputs = node.inputs.map((i) => i.name);
71
+ const routed = [...attrs, ...inputs].some((n) => n === 'routerLink');
72
+ const hasHref = attrs.includes('href') || inputs.includes('href');
73
+ if (hasHref && !routed) {
74
+ context.report({ loc: elementLoc(context, node), messageId: 'anchor' });
75
+ }
76
+ }
77
+ },
78
+ };
79
+ },
80
+ };
81
+ const FIELD_PRIMITIVES = new Set([
82
+ 'baht-input',
83
+ 'baht-number',
84
+ 'baht-currency',
85
+ 'baht-textarea',
86
+ 'baht-markdown',
87
+ 'baht-select',
88
+ 'baht-multiselect',
89
+ 'baht-typeahead',
90
+ 'baht-radio',
91
+ 'baht-checkbox',
92
+ 'baht-toggle',
93
+ 'baht-datepicker',
94
+ 'baht-file',
95
+ 'baht-upload',
96
+ 'baht-otp',
97
+ 'baht-range',
98
+ 'baht-rating',
99
+ 'baht-keyvalue-editor',
100
+ 'baht-reference-picker',
101
+ 'baht-repeater',
102
+ 'baht-fieldset',
103
+ 'baht-section',
104
+ ]);
105
+ const noHandPlacedField = {
106
+ meta: {
107
+ type: 'problem',
108
+ docs: {
109
+ description:
110
+ 'Field components come from a JSON FormDefinition rendered by <baht-form>, never placed directly in a template.',
111
+ },
112
+ schema: [],
113
+ messages: {
114
+ field:
115
+ '<{{name}}> is a form-builder field: describe it in the JSON FormDefinition and render it through <baht-form> / <baht-workflow>. If the builder cannot express it, extend @20baht/ui rather than bypassing it here.',
116
+ },
117
+ },
118
+ create(context) {
119
+ return {
120
+ Element(node) {
121
+ const name = node.name.toLowerCase();
122
+ if (FIELD_PRIMITIVES.has(name)) {
123
+ context.report({ loc: elementLoc(context, node), messageId: 'field', data: { name } });
124
+ }
125
+ },
126
+ };
127
+ },
128
+ };
129
+ const tokenCache = new Map();
130
+ function libDist(from) {
131
+ const require = createRequire(from);
132
+ return dirname(require.resolve('@20baht/ui/tokens.css'));
133
+ }
134
+ function definedTokens(cwd, from, extraFiles) {
135
+ const dist = libDist(from);
136
+ const key = `${dist}::${extraFiles.join(',')}`;
137
+ const cached = tokenCache.get(key);
138
+ if (cached) return cached;
139
+ const files = [join(dist, 'tokens.css')];
140
+ const cssDir = join(dist, 'css');
141
+ if (existsSync(cssDir)) {
142
+ files.push(
143
+ ...readdirSync(cssDir)
144
+ .filter((f) => f.endsWith('.css'))
145
+ .map((f) => join(cssDir, f)),
146
+ );
147
+ }
148
+ files.push(...extraFiles.map((f) => join(cwd, f)).filter((f) => existsSync(f)));
149
+ const set = new Set();
150
+ for (const file of files) {
151
+ for (const m of readFileSync(file, 'utf8').matchAll(/(--baht-[a-z0-9-]+)\s*:/g)) {
152
+ if (m[1]) set.add(m[1]);
153
+ }
154
+ }
155
+ if (set.size === 0) throw new Error(`bahtui/known-token: no --baht-* tokens found in ${dist}`);
156
+ tokenCache.set(key, set);
157
+ return set;
158
+ }
159
+ // The kind of value a --baht-* token holds, read from its name, so the message names what the
160
+ // page loses ("size", "colour", ...) rather than assuming every token is a colour.
161
+ const TOKEN_KINDS = [
162
+ [
163
+ /^--baht-(?:space|radius|size|text|tracking|leading)-|-(?:size|width|height|gap|pad|padding)(?:-|$)/,
164
+ 'size',
165
+ ],
166
+ [/^--baht-font(?:-|$)/, 'font'],
167
+ [/^--baht-shadow(?:-|$)/, 'shadow'],
168
+ [/^--baht-(?:dur|ease)(?:-|$)/, 'timing'],
169
+ [
170
+ /^--baht-(?:color|chart|calendar|heatmap|meter|border|focus|row|accent|primary|secondary|neutral|base|info|success|warning|error|gray|slate|green|lime|olive|gold|cream|rose|red|carbon)(?:-|$)/,
171
+ 'colour',
172
+ ],
173
+ ];
174
+ function tokenKind(token) {
175
+ for (const [re, kind] of TOKEN_KINDS) if (re.test(token)) return kind;
176
+ return 'value';
177
+ }
178
+ const knownToken = {
179
+ meta: {
180
+ type: 'problem',
181
+ docs: {
182
+ description:
183
+ 'var(--baht-*) must reference a token that @20baht/ui (or the app stylesheet) actually defines.',
184
+ },
185
+ schema: [
186
+ {
187
+ type: 'object',
188
+ properties: { extraFiles: { type: 'array', items: { type: 'string' } } },
189
+ additionalProperties: false,
190
+ },
191
+ ],
192
+ messages: {
193
+ unknown:
194
+ '{{token}} is not defined by the installed @20baht/ui tokens.css nor the app stylesheet — {{outcome}}. Check `@20baht/ui/tokens.css` for the current name.',
195
+ },
196
+ },
197
+ create(context) {
198
+ const [opts] = context.options;
199
+ const extra = opts?.extraFiles ?? [];
200
+ const defined = definedTokens(context.cwd, context.filename, extra);
201
+ const local = new Set();
202
+ const uses = [];
203
+ return {
204
+ Declaration(node) {
205
+ if (node.property?.startsWith('--baht-')) local.add(node.property);
206
+ },
207
+ Function(node) {
208
+ if (node.name !== 'var') return;
209
+ const children = childrenOf(node);
210
+ const first = children[0];
211
+ if (first?.type === 'Identifier' && first.name?.startsWith('--baht-')) {
212
+ uses.push({ node: first, token: first.name, fallback: children.length > 1 });
213
+ }
214
+ },
215
+ 'StyleSheet:exit'() {
216
+ for (const { node, token, fallback } of uses) {
217
+ if (defined.has(token) || local.has(token)) continue;
218
+ const kind = tokenKind(token);
219
+ const outcome = fallback
220
+ ? `the fallback ${kind} is what actually renders`
221
+ : `with no fallback the declaration is dropped and the ${kind} is the inherited or initial one`;
222
+ context.report({ node, messageId: 'unknown', data: { token, outcome } });
223
+ }
224
+ },
225
+ };
226
+ },
227
+ };
228
+ const COLOR_LITERAL_RE = /#[0-9a-f]{3,8}\b|\b(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\(/i;
229
+ const COLOR_FUNCTIONS = new Set([
230
+ 'rgb',
231
+ 'rgba',
232
+ 'hsl',
233
+ 'hsla',
234
+ 'hwb',
235
+ 'lab',
236
+ 'lch',
237
+ 'oklab',
238
+ 'oklch',
239
+ 'color',
240
+ ]);
241
+ /** `file` relative to `cwd`, with `/` separators, so it compares against config paths. */
242
+ function fromCwd(cwd, file) {
243
+ return relative(cwd, file).split(sep).join('/');
244
+ }
245
+ const tidy = (p) => p.replace(/^\.\//, '');
246
+ /** Whether `file` is one of the `themeFiles` (paths or globs relative to `cwd`). */
247
+ function isThemeFile(cwd, file, themeFiles) {
248
+ const rel = fromCwd(cwd, file);
249
+ return themeFiles.some((entry) => {
250
+ const want = tidy(entry);
251
+ if (want === rel) return true;
252
+ // path.matchesGlob: Node 22.5+; on an older Node an entry only matches as a plain path.
253
+ return /[*?[{]/.test(want) && typeof path.matchesGlob === 'function'
254
+ ? path.matchesGlob(rel, want)
255
+ : false;
256
+ });
257
+ }
258
+ const noRawColor = {
259
+ meta: {
260
+ type: 'suggestion',
261
+ docs: {
262
+ description:
263
+ 'Colour literals belong in tokens.css / the --baht-* overrides in the theme file; components read var(--baht-*).',
264
+ },
265
+ schema: [
266
+ {
267
+ type: 'object',
268
+ properties: { themeFiles: { type: 'array', items: { type: 'string' } } },
269
+ additionalProperties: false,
270
+ },
271
+ ],
272
+ messages: {
273
+ literal:
274
+ 'Colour literal `{{value}}`: use a design token (var(--baht-color-*), var(--baht-*-tint), …). If a var() fallback, drop it — the token is defined.',
275
+ outsideTheme:
276
+ 'Colour literal `{{value}}` in a --baht-* definition outside the theme file: a palette belongs in {{files}}. Here, point the token at another one (var(--baht-color-*)).',
277
+ },
278
+ },
279
+ create(context) {
280
+ const [opts] = context.options;
281
+ // Without `themeFiles` a --baht-* definition may hold a literal in any file (the old rule).
282
+ const themeFiles = opts?.themeFiles;
283
+ const definitionsFree = !themeFiles || isThemeFile(context.cwd, context.filename, themeFiles);
284
+ let definingToken = 0;
285
+ const report = (node, value) => {
286
+ if (definingToken === 0) context.report({ node, messageId: 'literal', data: { value } });
287
+ };
288
+ return {
289
+ Declaration(node) {
290
+ if (!node.property?.startsWith('--baht-')) return;
291
+ definingToken++;
292
+ // A custom property's value parses as one Raw node: read the literal from its text.
293
+ if (definitionsFree || node.value?.type !== 'Raw') return;
294
+ const literal = COLOR_LITERAL_RE.exec(node.value.value ?? '')?.[0];
295
+ if (!literal) return;
296
+ const files = themeFiles?.length ? themeFiles.join(', ') : 'no file (themeFiles is empty)';
297
+ context.report({
298
+ node: node.value,
299
+ messageId: 'outsideTheme',
300
+ data: { value: literal.trim(), files },
301
+ });
302
+ },
303
+ 'Declaration:exit'(node) {
304
+ if (node.property?.startsWith('--baht-')) definingToken--;
305
+ },
306
+ Hash(node) {
307
+ report(node, `#${node.value ?? ''}`);
308
+ },
309
+ Function(node) {
310
+ if (definingToken !== 0 || !node.name) return;
311
+ if (COLOR_FUNCTIONS.has(node.name.toLowerCase())) {
312
+ report(node, `${node.name}(…)`);
313
+ return;
314
+ }
315
+ if (node.name === 'var') {
316
+ for (const child of childrenOf(node)) {
317
+ if (child.type !== 'Raw' || !child.value) continue;
318
+ const literal = COLOR_LITERAL_RE.exec(child.value)?.[0];
319
+ if (literal) report(child, literal.trim());
320
+ }
321
+ }
322
+ },
323
+ };
324
+ },
325
+ };
326
+ const rules = {
327
+ 'no-raw-control': noRawControl,
328
+ 'no-hand-placed-field': noHandPlacedField,
329
+ 'known-token': knownToken,
330
+ 'no-raw-color': noRawColor,
331
+ };
332
+ export const bahtui = {
333
+ meta: { name: 'bahtui', version: '1.0.0' },
334
+ rules,
335
+ };
@@ -0,0 +1,36 @@
1
+ import type { ESLint, Linter } from 'eslint';
2
+
3
+ export interface RestrictedImport {
4
+ name: string;
5
+ message?: string;
6
+ allowTypeImports?: boolean;
7
+ importNames?: string[];
8
+ }
9
+
10
+ export interface AngularOptions {
11
+ /** Globs of the Angular app sources, e.g. `apps/web/src/**`. */
12
+ files: string[];
13
+ /** Overrides the derived `*.html` globs. */
14
+ templateFiles?: string[];
15
+ /** App-specific `@typescript-eslint/no-restricted-imports` paths. */
16
+ restrictedImports?: RestrictedImport[];
17
+ }
18
+
19
+ export interface BahtuiOptions {
20
+ /** Globs of the app sources, e.g. `apps/web/src/**`. */
21
+ files: string[];
22
+ templateFiles?: string[];
23
+ cssFiles?: string[];
24
+ /**
25
+ * App stylesheets that declare their own `--baht-*` tokens (paths relative to the eslint cwd).
26
+ * They are also the theme files of `bahtui/no-raw-color`: once given, a `--baht-*` definition
27
+ * holding a colour literal is allowed only in them.
28
+ */
29
+ tokenFiles?: string[];
30
+ }
31
+
32
+ export declare const bahtuiPlugin: ESLint.Plugin;
33
+ export declare const base: Linter.Config[];
34
+ export declare function angular(options: AngularOptions): Linter.Config[];
35
+ export declare function bahtui(options: BahtuiOptions): Linter.Config[];
36
+ export declare function cssRules(options?: { files?: string[] }): Linter.Config[];