diff --git a/.oxfmtrc.json b/.oxfmtrc.json deleted file mode 100644 index d4c653a5b2..0000000000 --- a/.oxfmtrc.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "./node_modules/oxfmt/configuration_schema.json", - "semi": false, - "singleQuote": true, - "trailingComma": "all", - "printWidth": 80, - "sortPackageJson": false, - "svelte": {}, - "ignorePatterns": [ - "**/.next", - "**/.nx/cache", - "**/.svelte-kit", - "**/build", - "**/coverage", - "**/dist", - "**/query-codemods/**/__testfixtures__", - ".changeset/*.md", - "pnpm-lock.yaml", - "**/tsconfig.vitest-temp.json", - "docs/framework/*/reference" - ] -} diff --git a/oxfmt.config.ts b/oxfmt.config.ts new file mode 100644 index 0000000000..c49a240de7 --- /dev/null +++ b/oxfmt.config.ts @@ -0,0 +1,23 @@ +import { defineConfig } from 'oxfmt' + +export default defineConfig({ + semi: false, + singleQuote: true, + trailingComma: 'all', + printWidth: 80, + sortPackageJson: false, + svelte: {}, + ignorePatterns: [ + '**/.next', + '**/.nx/cache', + '**/.svelte-kit', + '**/build', + '**/coverage', + '**/dist', + '**/query-codemods/**/__testfixtures__', + '.changeset/*.md', + 'pnpm-lock.yaml', + '**/tsconfig.vitest-temp.json', + 'docs/framework/*/reference', + ], +}) diff --git a/scripts/generate-labeler-config.ts b/scripts/generate-labeler-config.ts index 664064a5c5..0e2c3794ea 100644 --- a/scripts/generate-labeler-config.ts +++ b/scripts/generate-labeler-config.ts @@ -1,6 +1,7 @@ import * as fs from 'node:fs' import * as path from 'node:path' import { format } from 'oxfmt' +import oxfmtConfig from '../oxfmt.config.ts' /** Pairs of package labels and their corresponding paths */ type LabelerPair = [string, string] @@ -52,16 +53,7 @@ async function generateLabelerYaml(pairs: Array): Promise { }) .join('\n') - // Read the oxfmt config. `format()` does not discover config files itself. - const oxfmtConfigPath = path.resolve('.oxfmtrc.json') - if (!fs.existsSync(oxfmtConfigPath)) { - throw new Error( - 'No oxfmt config file found. Please ensure `.oxfmtrc.json` exists in the project root.', - ) - } - console.info('using oxfmt config file at:', oxfmtConfigPath) - - const oxfmtConfig = JSON.parse(fs.readFileSync(oxfmtConfigPath, 'utf-8')) + // `format()` does not discover config files itself, so pass the config explicitly. console.info('using resolved oxfmt config:', oxfmtConfig) // Format the YAML string using oxfmt