Open bockensm opened 3 years ago
This request would take a bit more work, but again, I think it is doable in principle. However, this too would be tricky with regards to backwards compatibility, as right now the struct.quote_keys
setting is a boolean setting. Switching from a boolean setting would break backwards compatibility, and I am not eager to define another setting, and then figure out what the interplay would be between the current setting and the additional setting. This is also made trickier by the fact that it wouldn’t just change how things are formatted, it could additionally make everyone’s current settings files invalid.
Would it be possible to expand formatting rule for when struct keys need to be quoted to be a bit more like ESLint's rule? https://eslint.org/docs/rules/quote-props
While I generally don't have a need to require that struct keys be quoted or not, I do want to enforce consistency so we don't end up with half the keys quoted and half not quoted in the same struct definition. I'm referring to struct shorthand here:
The
consistent
option from ESLint would be a great addition to the rules here.consistent-as-needed
would also be nice but I know it's not possible for a tool to know that I've quoted all of the keys for a specific reason even though there aren't any invalid key characters.consistent
would probably have to see quote all props if a single one is quoted. The main difference to the current settings would be that it would only quote all props if one is quoted vs forcing all to be quoted all the time.