mirror of
https://github.com/supabase/supabase.git
synced 2026-05-22 17:00:43 +08:00
* Add prettier plugin for sorting imports. * Migrate the prettier config to a js file. Make the sort imports conditional which will work only in code editors. * Remove unneeded commands for running prettier. * Fix the regex to be more specific. * Another fix for the import regex.
32 lines
782 B
JavaScript
32 lines
782 B
JavaScript
let options = {
|
|
trailingComma: 'es5',
|
|
tabWidth: 2,
|
|
semi: false,
|
|
singleQuote: true,
|
|
printWidth: 100,
|
|
endOfLine: 'lf',
|
|
sqlKeywordCase: 'lower',
|
|
plugins: ['prettier-plugin-sql-cst'],
|
|
overrides: [
|
|
{
|
|
files: '**/*.json',
|
|
options: { parser: 'json' },
|
|
},
|
|
],
|
|
}
|
|
|
|
// Disable sorting imports when running a prettier command in CI. This is to make the sorting work in editors
|
|
// for easier migration.
|
|
if (process.env.SORT_IMPORTS !== 'false') {
|
|
options = {
|
|
...options,
|
|
plugins: [...options.plugins, '@trivago/prettier-plugin-sort-imports'],
|
|
importOrder: ['<THIRD_PARTY_MODULES>', '^(@|\.{1,2})\/(.*)$'],
|
|
importOrderSeparation: true,
|
|
importOrderSortSpecifiers: true,
|
|
importOrderSideEffects: false,
|
|
}
|
|
}
|
|
|
|
export default options
|