You've already forked simple-icons
mirror of
https://github.com/simple-icons/simple-icons.git
synced 2025-07-12 22:21:23 +02:00
Add XO linter (#10643)
This commit is contained in:
@ -1,17 +1,17 @@
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs/promises';
|
||||
import { getDirnameFromImportMeta, getIconDataPath } from '../sdk.mjs';
|
||||
import path from 'node:path';
|
||||
import {getDirnameFromImportMeta, getIconDataPath} from '../sdk.mjs';
|
||||
|
||||
const __dirname = getDirnameFromImportMeta(import.meta.url);
|
||||
|
||||
/**
|
||||
* Get JSON schema data.
|
||||
* @param {String} rootDir Path to the root directory of the project.
|
||||
* @param {String} rootDirectory Path to the root directory of the project.
|
||||
*/
|
||||
export const getJsonSchemaData = async (
|
||||
rootDir = path.resolve(__dirname, '..'),
|
||||
rootDirectory = path.resolve(__dirname, '..'),
|
||||
) => {
|
||||
const jsonSchemaPath = path.resolve(rootDir, '.jsonschema.json');
|
||||
const jsonSchemaPath = path.resolve(rootDirectory, '.jsonschema.json');
|
||||
const jsonSchemaString = await fs.readFile(jsonSchemaPath, 'utf8');
|
||||
return JSON.parse(jsonSchemaString);
|
||||
};
|
||||
@ -19,14 +19,14 @@ export const getJsonSchemaData = async (
|
||||
/**
|
||||
* Write icons data to _data/simple-icons.json.
|
||||
* @param {Object} iconsData Icons data object.
|
||||
* @param {String} rootDir Path to the root directory of the project.
|
||||
* @param {String} rootDirectory Path to the root directory of the project.
|
||||
*/
|
||||
export const writeIconsData = async (
|
||||
iconsData,
|
||||
rootDir = path.resolve(__dirname, '..'),
|
||||
rootDirectory = path.resolve(__dirname, '..'),
|
||||
) => {
|
||||
await fs.writeFile(
|
||||
getIconDataPath(rootDir),
|
||||
getIconDataPath(rootDirectory),
|
||||
`${JSON.stringify(iconsData, null, 4)}\n`,
|
||||
'utf8',
|
||||
);
|
||||
|
Reference in New Issue
Block a user