Skip to content

Commit

Permalink
Fixes code review issue
Browse files Browse the repository at this point in the history
  • Loading branch information
walmazacn committed Nov 19, 2024
1 parent ebb72b0 commit c96dd9c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
19 changes: 12 additions & 7 deletions code_quality.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,21 @@ const groupFilesByExtension = (files) => {
*/
const prettifyFile = async (file, config) => {
try {
const text = fs.readFileSync(file).toString();
const check = await prettier.check(text, config);
if (check || config?.excludedFiles?.includes(file)) {
if (config?.excludedFiles?.includes(file)) {
return;
}

console.log('Running prettier on the file: ' + file);
const format = await prettier.format(text, config);
fs.writeFileSync(file, format);
return true;
const fileContent = fs.readFileSync(file).toString();
const isFormatted = await prettier.check(fileContent, config);

if (!isFormatted) {
console.log('Running prettier on the file: ' + file);
const format = await prettier.format(fileContent, config);
fs.writeFileSync(file, format);
return true;
}

return false;
} catch (error) {
console.log('Error in running prettier the file ' + file + ': \n' + error);
}
Expand Down
2 changes: 1 addition & 1 deletion container/src/LuigiCompoundContainer.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<svelte:options
customElement={{
tag: '',
tag: null,
shadow: 'none',
props: {
activeFeatureToggleList: { type: 'Array', reflect: false, attribute: 'active-feature-toggle-list' },
Expand Down
2 changes: 1 addition & 1 deletion container/src/LuigiContainer.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<svelte:options
customElement={{
tag: '',
tag: null,
shadow: 'none',
props: {
activeFeatureToggleList: { type: 'Array', reflect: false, attribute: 'active-feature-toggle-list' },
Expand Down

0 comments on commit c96dd9c

Please sign in to comment.