update to smartconfig

This commit is contained in:
2026-03-24 16:10:51 +00:00
parent eda67395fe
commit d0d922e53b
41 changed files with 425 additions and 2091 deletions

View File

@@ -21,7 +21,7 @@ export class PrettierFormatter extends BaseFormatter {
const rootConfigFiles = [
'package.json',
'tsconfig.json',
'smartconfig.json',
'.smartconfig.json',
'.prettierrc',
'.prettierrc.json',
'.prettierrc.js',
@@ -79,12 +79,9 @@ export class PrettierFormatter extends BaseFormatter {
// Remove duplicates
const uniqueFiles = [...new Set(allFiles)];
// Get all files that match the pattern
const files = uniqueFiles;
// Ensure we only process actual files (not directories)
const validFiles: string[] = [];
for (const file of files) {
for (const file of uniqueFiles) {
try {
const stats = await plugins.smartfs.file(file).stat();
if (!stats.isDirectory) {
@@ -96,14 +93,7 @@ export class PrettierFormatter extends BaseFormatter {
}
}
// Check which files need formatting
for (const file of validFiles) {
// Skip files that haven't changed
if (!(await this.shouldProcessFile(file))) {
logVerbose(`Skipping ${file} - no changes detected`);
continue;
}
changes.push({
type: 'modify',
path: file,
@@ -232,7 +222,7 @@ export class PrettierFormatter extends BaseFormatter {
private async getPrettierConfig(): Promise<any> {
// Try to load prettier config from the project
const prettierConfig = new plugins.npmextra.Smartconfig();
const prettierConfig = new plugins.smartconfig.Smartconfig();
return prettierConfig.dataFor('prettier', {
// Default prettier config
singleQuote: true,