nene / prettier-plugin-sql-cst

Prettier SQL plugin that uses sql-parser-cst
https://nene.github.io/prettier-sql-playground/
GNU General Public License v3.0
123 stars 7 forks source link

`sqlDataTypeCase` and `sqlFunctionCase` options? #13

Open karlhorky opened 9 months ago

karlhorky commented 9 months ago

Similar to the dataTypeCase and functionCase in sql-formatter:

It seems like this would be much simpler to implement here, because according to SQL Explorer the node types already exist:

Screenshot 2023-12-03 at 12 37 22

Screenshot 2023-12-03 at 12 39 57

nene commented 9 months ago

Yeah. It's definitely much simpler to achieve in here.

nene commented 9 months ago

Also worth considering are the capitalization rules in SQLFluff. It implements 5 categories:

It might be good to align our implementation with that. Though on the other hand I'd like to avoid configuration options and keep this plugin opinionated... but capitalization is an area where I've already decided that it's better for it to be configurable. This still leaves the question of picking the best defaults.

karlhorky commented 9 months ago

Sounds reasonable to me 👍

Data types defaulting to uppercase is probably a good default too - the PostgreSQL docs seem like an outlier when it comes to their usage of lowercase data types