Update XO configurations (#10859)

This commit is contained in:
LitoMore 2024-05-03 04:54:43 +08:00 committed by GitHub
parent 7c3da05ba8
commit c9f9494eda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 14 deletions

View file

@ -3,9 +3,6 @@
"space": 2, "space": 2,
"plugins": ["import"], "plugins": ["import"],
"rules": { "rules": {
"n/no-unsupported-features": "off",
"n/no-unsupported-features/node-builtins": "off",
"n/file-extension-in-import": "off",
"sort-imports": [ "sort-imports": [
"error", "error",
{ {
@ -29,7 +26,8 @@
"warnOnUnassignedImports": true, "warnOnUnassignedImports": true,
"newlines-between": "never" "newlines-between": "never"
} }
] ],
"no-console": ["error", {"allow": ["warn", "error"]}]
}, },
"overrides": [ "overrides": [
{ {

View file

@ -121,9 +121,10 @@ try {
: undefined, : undefined,
}; };
console.log( process.stdout.write(
'About to write the following to simple-icons.json:\n' + 'About to write the following to simple-icons.json:\n' +
JSON.stringify(answers, null, 4), JSON.stringify(answers, null, 4) +
'\n',
); );
if ( if (
@ -134,14 +135,14 @@ try {
iconsData.icons.push(answers); iconsData.icons.push(answers);
iconsData.icons.sort((a, b) => collator.compare(a.title, b.title)); iconsData.icons.sort((a, b) => collator.compare(a.title, b.title));
await writeIconsData(iconsData); await writeIconsData(iconsData);
console.log(chalk.green('\nData written successfully.')); process.stdout.write(chalk.green('\nData written successfully.\n'));
} else { } else {
console.log(chalk.red('\nAborted.')); process.stdout.write(chalk.red('\nAborted.\n'));
process.exit(1); process.exit(1);
} }
} catch (error) { } catch (error) {
if (error instanceof ExitPromptError) { if (error instanceof ExitPromptError) {
console.log(chalk.red('\nAborted.')); process.stdout.write(chalk.red('\nAborted.\n'));
process.exit(1); process.exit(1);
} }

View file

@ -14,5 +14,7 @@ if (process.argv.length < 3) {
} else { } else {
const brandName = process.argv[2]; const brandName = process.argv[2];
const filename = titleToSlug(brandName); const filename = titleToSlug(brandName);
console.log(`For '${brandName}' use the file 'icons/${filename}.svg'`); process.stdout.write(
`For '${brandName}' use the file 'icons/${filename}.svg'\n`,
);
} }

View file

@ -36,9 +36,10 @@ const generateSdkMts = async () => {
); );
} catch (error) { } catch (error) {
await fs.writeFile(sdkMjs, originalSdkMjsContent); await fs.writeFile(sdkMjs, originalSdkMjsContent);
console.log( process.stdout.write(
`Error ${error.status} generating Typescript` + `Error ${error.status} generating Typescript` +
` definitions: '${error.message}'`, ` definitions: '${error.message}'` +
'\n',
); );
process.exit(1); process.exit(1);
} }
@ -67,9 +68,10 @@ const generateSdkTs = async () => {
try { try {
execSync('npx prettier -w sdk.d.ts'); execSync('npx prettier -w sdk.d.ts');
} catch (error) { } catch (error) {
console.log( process.stdout.write(
`Error ${error.status} executing Prettier` + `Error ${error.status} executing Prettier` +
` to prettify SDK TS definitions: '${error.message}'`, ` to prettify SDK TS definitions: '${error.message}'` +
'\n',
); );
process.exit(1); process.exit(1);
} }