Files
huachuang/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/internal/lint-configs/oxfmt-config/src/index.ts

136 lines
3.2 KiB
TypeScript
Raw Normal View History

2026-07-08 15:08:41 +08:00
import { defineConfig as defineOxfmtConfig } from 'oxfmt';
type OxfmtConfig = Parameters<typeof defineOxfmtConfig>[0];
/**
* oxfmt
* https://oxc.rs/docs/guide/usage/formatter/config-file-reference.html
*/
const oxfmtConfig: OxfmtConfig = defineOxfmtConfig({
/**
* oxfmt prettier 80
* Default100
*/
printWidth: 80,
/**
*
* Default2
*/
tabWidth: 2,
/**
* MarkdownMDXYAML
* type: always | never | preserve
* Default: preserve
*/
proseWrap: 'never',
/**
*
* Defaulttrue
*/
semi: true,
/**
* 使
* Defaultfalse
*/
singleQuote: true,
/**
*
* Defaultas-needed
*/
quoteProps: 'as-needed',
/**
* >
* Defaultfalse
*/
bracketSameLine: false,
/**
*
* Defaulttrue
*/
bracketSpacing: true,
/**
* 使
* type: always | avoid
* Defaultalways
*/
arrowParens: 'always',
/**
* package.json oxfmt pnpm-workspace
* 使 eslint eslint-plugin-pnpm eslint-plugin-yml package.json pnpm-workspace.yaml
* Defaulttrue
*/
sortPackageJson: false,
/**
* import 使 eslint-plugin-perfectionist oxfmt export
* customGroups ts-equals-import
* Defaultfalse
*/
sortImports: false,
/**
*
* Defaultall
*/
trailingComma: 'all',
/**
*
* type: lf | crlf | cr
* Default: lf
*/
endOfLine: 'lf',
/**
*
* Defaulttrue
*/
insertFinalNewline: true,
/**
* CSS-in-JS JS-in-Vue
* Defaultauto
*/
embeddedLanguageFormatting: 'auto',
/**
* Vue/HTML/Angular/Handlebars oxfmt <template>
* type: css | strict | ignore
* Defaultcss
*/
htmlWhitespaceSensitivity: 'css',
/**
* vue eslint-plugin-better-tailwindcss
* eslint-plugin-better-tailwindcss配置在 oxlint vue文 ts等正常
* Default
*/
// sortTailwindcss: {
// functions: ['clsx', 'cn', 'cva', 'tw'],
// stylesheet: './internal/tailwind-config/src/theme.css',
// preserveWhitespace: true,
// },
overrides: [
{
files: [
'*.json',
'*.json5',
'*.jsonc',
'*.code-workspace',
'**/*.json',
'**/*.json5',
'**/*.jsonc',
'**/*.code-workspace',
],
options: {
trailingComma: 'none',
quoteProps: 'preserve',
singleQuote: false,
},
},
],
});
function defineConfig(config: OxfmtConfig = {}): OxfmtConfig {
return defineOxfmtConfig({
...oxfmtConfig,
...config,
});
}
export { defineConfig, oxfmtConfig };
export type { OxfmtConfig };