tachybase_todo/.prettierrc.js
bai.zixv eb3d0e9fe7 chore(构建): 给json文件配置格式化,内容字段按字典顺序排序,比如翻译文件 (#1592)
Reviewed-on: daoyoucloud/tachybase#1592
Reviewed-by: sealday <zhanglin@daoyoucloud.com>
Co-authored-by: bai.zixv <bai.zixv@foxmail.com>
Co-committed-by: bai.zixv <bai.zixv@foxmail.com>
2024-10-12 15:56:47 +08:00

52 lines
1.3 KiB
JavaScript

module.exports = {
plugins: [
'prettier-plugin-sql',
'prettier-plugin-packagejson',
'@ianvs/prettier-plugin-sort-imports',
'prettier-plugin-sort-json',
],
singleQuote: true,
trailingComma: 'all',
printWidth: 120,
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',
importOrderParserPlugins: ['typescript', 'jsx', 'decorators-legacy'],
overrides: [
{
files: '.prettierrc',
options: {
parser: 'json',
},
},
{
files: 'packages/**/locale/**/*.json',
options: {
parser: 'json',
plugins: ['prettier-plugin-sort-json'],
// 字母按字典顺序排序
jsonSortOrder: '{ "/^[^\\\\d+]/": "lexical", "/^\\\\d+/": "numeric" }',
},
},
{
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',
},
},
],
};