Stylelint Config Order
Stylelint config enforcing an understandable and consistent code order.
@pragmatics/stylelint-config-orderdoes not install Stylelint for you.
stylelint and this config as part of your
yarn add stylelint @pragmatics/stylelint-config-order -D
@pragmatics/stylelint-config-order to your Stylelint configuration file:
Use @pragmatics/stylelint-config to apply pragmatic code style to the full extend (
@pragmatics/stylelint-config-orderis already a part of that config).
Learn more about Stylelint.
We recommend configuring your editor to automatically format your code by on save.
You can use Stylelint with a pre-commit tool. This can re-format your files that are marked as “staged” via git add before you commit.
Make sure Stylelint is installed and in your devDependencies before you proceed
npx mrm lint-staged
We use Jest for testing, use
npm test to run all tests.
By running this stylelint config in
tests/system/system.test.js on an unformatted
fixture.scss we test whether it matches our
We are planning to:
- use Jest snapshots for system tests like Stylelint does
- add more common use cases.
- to format
scssto be understandable, scannable and consistent
- to let developers focus on writing code, instead of adhering to a styleguide
- Ordering on impact
Rules with a larger scope or more effect on the layout and box size have more impact on the UI. Seeing rules with more impact first increases understanding.
- Grouping by relationship
Grouping all properties related to
themingmakes them easier to find.
Related property declarations are grouped in the following order:
- Box model
- Accessibility & Interactions
- SVG presentation
- Transition & animation
- Webstorm - for development
- Github - for versioning and deployment
- Jest - for testing
- Contributor Covenant - for the Code of Conduct
- Creative Commons - to choose the license
See the list of contributors who participated in this project.
This project is licensed under the ISC License.
The following guidelines, methodologies and architectures have been used as inspiration for this config:
- CSS rule order @9elements
- "Outside-in" method (logical ordering)
- Harry Potter and the order of CSS
- Concentric CSS