файл пакета→ .shtukbase/packages/std-editorconfig/checks/ec01_present.ts
checks/ec01_present.ts
13 строк, 821 Б.
Файл как есть в пакете: код и комментарии в нём не переводятся.
- // EC-R01: the project has an .editorconfig (in its root or above) and the search ends at one with `root = true`.
- import { Ec, PKG } from './eclib.ts';
- import { finish, norm, ROOT } from './lib/std.ts';
- const n = norm(PKG, 'EC-R01', 'enforce');
- const out: string[] = [];
- if (n.active) {
- const chain = new Ec().chain(ROOT);
- if (!chain.length) out.push('.editorconfig: there is no such file in the project root or above → create .editorconfig with root = true and a [*] section');
- else if (!chain[0].root) out.push(`${chain[chain.length - 1].path}: no root = true line — the editor will look for settings above the project → add root = true as the first line`);
- else if (!chain.some((e) => e.sections.length)) out.push(`${chain[0].path}: not a single [glob] section — no rules are set`);
- }
- finish(n, out);