Files
supabase/prettier.config.mjs
Ivan Vasilov 07b9702be3 chore: Add prettier plugin for sorting imports (#41608)
* 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.
2026-01-27 10:55:59 +01:00

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