mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
workspace: fix eslint
This commit is contained in:
3 files changed
+10
-12
No files matched your search
+6
-6
@@ -150,18 +150,18 @@ const pluginsConfig = {
|
|||||||
};
|
};
|
||||||
fs.writeFileSync(path.resolve(process.cwd(), 'plugins', 'tsconfig.json'), JSON.stringify(pluginsConfig));
|
fs.writeFileSync(path.resolve(process.cwd(), 'plugins', 'tsconfig.json'), JSON.stringify(pluginsConfig));
|
||||||
|
|
||||||
for (const package of modules) {
|
for (const pkg of modules) {
|
||||||
const basedir = path.resolve(process.cwd(), package);
|
const basedir = path.resolve(process.cwd(), pkg);
|
||||||
const files = fs.readdirSync(basedir);
|
const files = fs.readdirSync(basedir);
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line import/no-dynamic-require
|
// eslint-disable-next-line import/no-dynamic-require
|
||||||
const name = require(path.join(basedir, 'package.json')).name;
|
const name = require(path.join(basedir, 'package.json')).name;
|
||||||
fs.symlinkSync(basedir, path.join(nm, name), 'dir');
|
fs.symlinkSync(basedir, path.join(nm, name), 'dir');
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
if (!files.includes('src') && !files.filter((i) => i.endsWith('.ts')).length && package !== 'packages/utils') continue;
|
if (!files.includes('src') && !files.filter((i) => i.endsWith('.ts')).length && pkg !== 'packages/utils') continue;
|
||||||
config.references.push({ path: package });
|
config.references.push({ path: pkg });
|
||||||
const origConfig = (files.includes('src') ? configSrc : configFlat)(package);
|
const origConfig = (files.includes('src') ? configSrc : configFlat)(pkg);
|
||||||
const expectedConfig = JSON.stringify(package.startsWith('modules/') ? withoutTypes(origConfig) : origConfig);
|
const expectedConfig = JSON.stringify(pkg.startsWith('modules/') ? withoutTypes(origConfig) : origConfig);
|
||||||
const configPath = path.resolve(basedir, 'tsconfig.json');
|
const configPath = path.resolve(basedir, 'tsconfig.json');
|
||||||
const currentConfig = fs.existsSync(configPath) ? fs.readFileSync(configPath, 'utf-8') : '';
|
const currentConfig = fs.existsSync(configPath) ? fs.readFileSync(configPath, 'utf-8') : '';
|
||||||
if (expectedConfig !== currentConfig) fs.writeFileSync(configPath, expectedConfig);
|
if (expectedConfig !== currentConfig) fs.writeFileSync(configPath, expectedConfig);
|
||||||
|
|||||||
@@ -10,14 +10,12 @@ const base = yaml.load(fs.readFileSync('base.yaml', 'utf8')) as any;
|
|||||||
const react = yaml.load(fs.readFileSync('react.yaml', 'utf8')) as any;
|
const react = yaml.load(fs.readFileSync('react.yaml', 'utf8')) as any;
|
||||||
|
|
||||||
function sort<T>(obj: Record<string, T>): Record<string, T> {
|
function sort<T>(obj: Record<string, T>): Record<string, T> {
|
||||||
const clone = { ...obj };
|
return Object.keys(obj).sort().reduce(
|
||||||
Object.keys(clone).sort().reduce(
|
|
||||||
(acc, key) => {
|
(acc, key) => {
|
||||||
acc[key] = clone[key];
|
acc[key] = obj[key];
|
||||||
return acc;
|
return acc;
|
||||||
},
|
},
|
||||||
);
|
) as any;
|
||||||
return clone;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: oxlint doesn't support most stylistic rules
|
// NOTE: oxlint doesn't support most stylistic rules
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "react.yaml",
|
"main": "react.yaml",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@stylistic/eslint-plugin": "^4.2.0",
|
"@stylistic/eslint-plugin": "^3.1.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.26.0",
|
"@typescript-eslint/eslint-plugin": "^8.26.0",
|
||||||
"@typescript-eslint/parser": "^8.26.0",
|
"@typescript-eslint/parser": "^8.26.0",
|
||||||
"eslint-config-airbnb": "^19.0.4",
|
"eslint-config-airbnb": "^19.0.4",
|
||||||
|
|||||||
Reference in new issue
Block a user