Research prettier/CSS #710
Labels
No labels
_CRITICAL_
API
app
backEnd
Blocked, waiting for further changes
bug
cleanup
close
design
duplicate
enhancement
feature request
frontEnd
help wanted
invalid
low priority
needs input
needs review
project documentation
question
research
reviewed
script
security
SQL
style
testing
topLevel
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Andras/BoundlessFlowCampus2K#710
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Research if prettier can be configured to have other settings for CSS files. Indentation should be 2 for CSS and when naming a rule set example-xxx. When referring to the rule set in the .js file, spaces are automatically made (styles.example - xxx) which results in an error. Is it better to use camelCase for naming or is prettier configurable to follow our standards?
Research:
Aimed towards if prettier can handle files differently and how we should go forward with the naming conventions for our css.
Naming issue:
From my research there is no clear prettier configuration that can solve the naming issue as the problem is not related to how prettier formats the css rather it relates to how Javascript parses property names when using css.
As we are using "kebab-case" the Javascript interprets this as a subtraction which changes the naming from:
.example-xxxto:
.example - xxxThere is technically one thing that can be implemented to solve the naming issue and that's by using bracket-notation. Basically when importing the css from a module you would write:
styles['example-xxx'];Instead of:
styles.example-xxx;However this can lead to issues such as its easier to forget, less readable and can lead to developer errors. Therefore the easier and better solution is probably to switch our naming conventions and rules from kebab-case to camelCase.
Indentation issue:
Prettier can be used to handle the css separately from other files by using the configuration option override.
using something along these lines.
Links:
https://prettier.io/docs/options
https://prettier.io/docs/configuration
https://medium.com/@bhuvaneshcj/snake-case-vs-camel-case-vs-pascal-case-vs-kebab-case-understanding-code-naming-conventions-6f500676e3fd
The solution with brackets works as intended, will ask the customer if kebab-case och camelCase is the best way to go.
We made the decision that kebab-case with brackets will be used.