-
Notifications
You must be signed in to change notification settings - Fork 371
chore(repo): Run format through turbo #6291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
559c9ca
chore/turbo-prettier
jacekradko 4f3a6cb
wip
jacekradko 256f109
verbose output
jacekradko dda0abc
wip
jacekradko 9b11591
wip
jacekradko 7b596ea
Merge branch 'main' into jr.chore/format-turbo
jacekradko c9bfd67
chore: empty changeset
jacekradko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default { | ||
arrowParens: 'avoid', | ||
bracketSpacing: true, | ||
jsxSingleQuote: true, | ||
plugins: ['prettier-plugin-packagejson', 'prettier-plugin-tailwindcss', 'prettier-plugin-astro'], | ||
printWidth: 120, | ||
semi: true, | ||
singleAttributePerLine: true, | ||
singleQuote: true, | ||
tabWidth: 2, | ||
trailingComma: 'all', | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/usr/bin/env node | ||
|
||
import { globby } from 'globby'; | ||
import { $ } from 'zx'; | ||
|
||
const ROOT_FILE_PATTERNS = ['*.cjs', '*.js', '*.json', '*.md', '*.mjs', '*.ts', '*.yaml']; | ||
const NON_WORKSPACE_PATTERNS = [ | ||
'docs/**/*.{js,jsx,ts,tsx,json,md,mdx}', | ||
'integration/**/*.{js,jsx,ts,tsx,json,md,mdx}', | ||
'playground/**/*.{js,jsx,ts,tsx,json,md,mdx}', | ||
'scripts/**/*.{js,jsx,ts,tsx,json,md,mdx}', | ||
]; | ||
|
||
async function getExistingFiles() { | ||
const existingFiles = []; | ||
|
||
for (const pattern of ROOT_FILE_PATTERNS) { | ||
try { | ||
const matches = await globby(pattern, { | ||
ignore: ['node_modules/**', '**/node_modules/**', 'packages/**'], | ||
}); | ||
existingFiles.push(...matches); | ||
} catch { | ||
// Pattern didn't match any files, skip it | ||
} | ||
} | ||
|
||
for (const pattern of NON_WORKSPACE_PATTERNS) { | ||
try { | ||
const matches = await globby(pattern, { | ||
ignore: [ | ||
'node_modules/**', | ||
'**/node_modules/**', | ||
'**/dist/**', | ||
'**/build/**', | ||
'**/coverage/**', | ||
'**/.turbo/**', | ||
'**/.next/**', | ||
'**/.tsup/**', | ||
'**/.cache/**', | ||
], | ||
}); | ||
existingFiles.push(...matches); | ||
} catch { | ||
// Pattern didn't match any files, skip it | ||
} | ||
} | ||
|
||
return existingFiles.filter(Boolean); | ||
} | ||
|
||
async function formatNonWorkspaceFiles() { | ||
const isCheck = process.argv.includes('--check'); | ||
const isVerbose = process.argv.includes('--verbose'); | ||
const baseArgs = isCheck | ||
? ['prettier', '--cache', '--check', '--ignore-unknown', '--ignore-path', '.prettierignore'] | ||
: ['prettier', '--write', '--ignore-unknown', '--ignore-path', '.prettierignore']; | ||
|
||
console.log(`${isCheck ? 'Checking' : 'Formatting'} non-workspace files...`); | ||
|
||
try { | ||
const existingFiles = await getExistingFiles(); | ||
|
||
if (existingFiles.length === 0) { | ||
console.log('ℹ️ No non-workspace files found to format'); | ||
return; | ||
} | ||
|
||
console.log(`📁 Found ${existingFiles.length} files/directories to format`); | ||
|
||
if (isVerbose) { | ||
console.log('\n📄 Files to be formatted:'); | ||
existingFiles.forEach((file, index) => { | ||
console.log(` ${index + 1}. ${file}`); | ||
}); | ||
console.log(''); | ||
} | ||
|
||
await $`pnpm ${baseArgs} ${existingFiles}`; | ||
console.log(`✅ Non-workspace files ${isCheck ? 'check passed' : 'formatted successfully'}`); | ||
} catch (error) { | ||
console.error(`❌ Non-workspace files ${isCheck ? 'check failed' : 'formatting failed'}`); | ||
if (error.stderr) { | ||
console.error(error.stderr); | ||
} | ||
process.exit(1); | ||
} | ||
} | ||
|
||
formatNonWorkspaceFiles().catch(console.error); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Improve error handling specificity.
The try-catch blocks are too broad and will catch all errors, not just cases where patterns don't match files. This could hide legitimate errors like permission issues or invalid glob patterns.
Consider more specific error handling:
📝 Committable suggestion
🤖 Prompt for AI Agents