mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-27 12:26:29 -08:00
chore: fix oxlint diagnostics
This commit is contained in:
53 files changed
+801
-390
No files matched your search
@@ -182,7 +182,7 @@ const logger = new PrefixedLogger('[postinstall:knope]');
|
||||
const { dim, red, green } = createTextHelpers({ useColor: logger.useColor });
|
||||
|
||||
if (process.env.GITHUB_ACTIONS && process.env.CI) {
|
||||
logger.info(`${dim('Running in CI environment, skipping knope installation')}`);
|
||||
logger.info(dim('Running in CI environment, skipping knope installation'));
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ function collectReplacements(sourceFile, checker) {
|
||||
}
|
||||
|
||||
visit(sourceFile);
|
||||
return replacements.sort((left, right) => right.start - left.start);
|
||||
return replacements.toSorted((left, right) => right.start - left.start);
|
||||
}
|
||||
|
||||
async function main() {
|
||||
@@ -260,6 +260,7 @@ async function main() {
|
||||
const { dim, green } = createTextHelpers();
|
||||
|
||||
const changes = [];
|
||||
const writePromises = [];
|
||||
|
||||
for (const sourceFile of program.getSourceFiles()) {
|
||||
const filePath = path.normalize(sourceFile.fileName);
|
||||
@@ -272,7 +273,7 @@ async function main() {
|
||||
const updatedCode = applyTextReplacements(originalCode, replacements);
|
||||
|
||||
if (write) {
|
||||
await fs.writeFile(filePath, updatedCode, 'utf8');
|
||||
writePromises.push(fs.writeFile(filePath, updatedCode, 'utf8'));
|
||||
}
|
||||
|
||||
changes.push({
|
||||
@@ -281,8 +282,10 @@ async function main() {
|
||||
});
|
||||
}
|
||||
|
||||
await Promise.all(writePromises);
|
||||
|
||||
changes
|
||||
.sort((left, right) => left.file.localeCompare(right.file))
|
||||
.toSorted((left, right) => left.file.localeCompare(right.file))
|
||||
.forEach((change) => {
|
||||
console.log(
|
||||
`${dim(change.file)}: ${green(`${change.replacements} matrix import rewrite(s)`)}`
|
||||
|
||||
@@ -22,7 +22,7 @@ export const ANSI = {
|
||||
export function shouldUseColor() {
|
||||
if (process.env.NO_COLOR !== undefined) return false;
|
||||
if (process.env.FORCE_COLOR && process.env.FORCE_COLOR !== '0') return true;
|
||||
return Boolean(process.stdout.isTTY);
|
||||
return process.stdout.isTTY;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user