Skip to content

Commit

Permalink
skipped formatting package.json and package-lock.json files
Browse files Browse the repository at this point in the history
  • Loading branch information
ketankshukla committed Sep 11, 2024
1 parent a22a6d2 commit 3ba6ba9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test_prettier.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const removeBlankLinesAndFormat = (filePath) => {
}
};

// Function to recursively search for all JSON files and skip node_modules
// Function to recursively search for all JSON files and skip node_modules and certain files
const findJsonFiles = (dir) => {
const files = fs.readdirSync(dir);

Expand All @@ -46,7 +46,11 @@ const findJsonFiles = (dir) => {
if (file === 'node_modules') return; // Skip node_modules directory
findJsonFiles(filePath); // Recurse into directories
} else if (filePath.endsWith('.json')) {
removeBlankLinesAndFormat(filePath); // Process JSON files
if (file === 'package.json' || file === 'package-lock.json') {
console.log(`Skipping ${filePath}`);
return; // Skip package.json and package-lock.json
}
removeBlankLinesAndFormat(filePath); // Process other JSON files
}
});
};
Expand Down

0 comments on commit 3ba6ba9

Please sign in to comment.