Website Structure

This commit is contained in:
supalerk-ar66 2026-01-13 10:46:40 +07:00
parent 62812f2090
commit 71f0676a62
22365 changed files with 4265753 additions and 791 deletions

View file

@ -0,0 +1,14 @@
import { Linter } from 'eslint';
/**
* Merge multiple processors into one
*
* @param processors
*/
declare function mergeProcessors(processors: Linter.Processor[]): Linter.Processor;
/**
* Pass-through the file itself
*/
declare const processorPassThrough: Linter.Processor;
export { mergeProcessors, processorPassThrough };

View file

@ -0,0 +1,14 @@
import { Linter } from 'eslint';
/**
* Merge multiple processors into one
*
* @param processors
*/
declare function mergeProcessors(processors: Linter.Processor[]): Linter.Processor;
/**
* Pass-through the file itself
*/
declare const processorPassThrough: Linter.Processor;
export { mergeProcessors, processorPassThrough };

View file

@ -0,0 +1,41 @@
function mergeProcessors(processors) {
const cache = /* @__PURE__ */ new Map();
return {
meta: {
name: `merged-processor:${processors.map((processor) => processor.meta?.name || "unknown").join("+")}`
},
supportsAutofix: true,
preprocess(text, filename) {
const counts = [];
cache.set(filename, counts);
return processors.flatMap((processor) => {
const result = processor.preprocess?.(text, filename) || [];
counts.push(result.length);
return result;
});
},
postprocess(messages, filename) {
const counts = cache.get(filename);
cache.delete(filename);
let index = 0;
return processors.flatMap((processor, idx) => {
const msgs = messages.slice(index, index + counts[idx]);
index += counts[idx];
return processor.postprocess?.(msgs, filename) || [];
});
}
};
}
const processorPassThrough = {
meta: {
name: "pass-through"
},
preprocess(text) {
return [text];
},
postprocess(messages) {
return messages[0];
}
};
export { mergeProcessors, processorPassThrough };