Files
SnowLuma/.pnpm-store/v11/files/04/adf9bc641f0b24a4f57f56999f2b869257fc263823a2e0c0355154ca00e17b45a773bba8071faedbc019c5215cdc0232e6b4905fd20a5388be3bb2aa8f3b1c
TanTan 2a69b23b47
Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

45 lines
1.1 KiB
Plaintext

import { f as createRule } from "../utils.js";
const tabRegex = /\t+/gu;
const anyNonWhitespaceRegex = /\S/u;
var no_tabs_default = createRule({
name: "no-tabs",
meta: {
type: "layout",
docs: { description: "Disallow all tabs" },
schema: [{
type: "object",
properties: { allowIndentationTabs: { type: "boolean" } },
additionalProperties: false
}],
defaultOptions: [{ allowIndentationTabs: false }],
messages: { unexpectedTab: "Unexpected tab character." }
},
create(context, [options]) {
const sourceCode = context.sourceCode;
const { allowIndentationTabs } = options;
return { Program(node) {
sourceCode.getLines().forEach((line, index) => {
let match;
while ((match = tabRegex.exec(line)) !== null) {
if (allowIndentationTabs && !anyNonWhitespaceRegex.test(line.slice(0, match.index))) continue;
context.report({
node,
loc: {
start: {
line: index + 1,
column: match.index
},
end: {
line: index + 1,
column: match.index + match[0].length
}
},
messageId: "unexpectedTab"
});
}
});
} };
}
});
export { no_tabs_default as t };