(fileContent: string, prettierOpts = {})
| 14 | export { CONFIG_FILE }; |
| 15 | |
| 16 | export function format(fileContent: string, prettierOpts = {}) { |
| 17 | try { |
| 18 | return prettier.format(fileContent, { |
| 19 | parser: 'typescript', |
| 20 | trailingComma: 'all', |
| 21 | singleQuote: true, |
| 22 | ...prettierOpts |
| 23 | }); |
| 24 | } catch (e) { |
| 25 | error(`代码格式化错误!${e.toString()}`); |
| 26 | return fileContent; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | export function getDuplicateById<T>(arr: T[], idKey = 'name'): null | T { |
| 31 | if (!arr || !arr.length) { |
no test coverage detected