2024-03-07 20:45:00 +08:00
|
|
|
module.exports = {
|
2024-10-12 15:56:47 +08:00
|
|
|
plugins: [
|
|
|
|
'prettier-plugin-sql',
|
|
|
|
'prettier-plugin-packagejson',
|
|
|
|
'@ianvs/prettier-plugin-sort-imports',
|
|
|
|
'prettier-plugin-sort-json',
|
|
|
|
],
|
2024-03-07 20:45:00 +08:00
|
|
|
singleQuote: true,
|
|
|
|
trailingComma: 'all',
|
|
|
|
printWidth: 120,
|
2024-05-23 12:50:54 +08:00
|
|
|
importOrder: [
|
|
|
|
'^react$',
|
|
|
|
'<BUILTIN_MODULES>', // Node.js built-in modules
|
|
|
|
'^@tachybase/(.*)$',
|
|
|
|
'',
|
|
|
|
'<THIRD_PARTY_MODULES>', // Imports not matched by other special words or groups.
|
|
|
|
'',
|
|
|
|
'^[.]', // relative imports
|
|
|
|
],
|
|
|
|
importOrderTypeScriptVersion: '5.4.5',
|
2024-05-24 01:06:06 +08:00
|
|
|
importOrderParserPlugins: ['typescript', 'jsx', 'decorators-legacy'],
|
2024-03-07 20:45:00 +08:00
|
|
|
overrides: [
|
|
|
|
{
|
|
|
|
files: '.prettierrc',
|
2024-10-12 15:56:47 +08:00
|
|
|
options: {
|
|
|
|
parser: 'json',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: 'packages/**/locale/**/*.json',
|
|
|
|
options: {
|
|
|
|
parser: 'json',
|
|
|
|
plugins: ['prettier-plugin-sort-json'],
|
|
|
|
// 字母按字典顺序排序
|
|
|
|
jsonSortOrder: '{ "/^[^\\\\d+]/": "lexical", "/^\\\\d+/": "numeric" }',
|
|
|
|
},
|
2024-03-07 20:45:00 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
files: '*.sql',
|
|
|
|
options: {
|
|
|
|
language: 'postgresql',
|
|
|
|
parser: 'sql',
|
|
|
|
keywordCase: 'upper',
|
|
|
|
paramTypes: JSON.stringify({
|
|
|
|
custom: [{ regex: String.raw`\$\{[a-zA-Z0-9_]+\}|:[a-zA-Z0-9_]+` }],
|
|
|
|
}),
|
|
|
|
formatter: 'sql-formatter',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|