Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Use stylelint-prettier instead of stylelint formatting rules#8098

Merged
jasonLaster merged 1 commit into
firefox-devtools:masterfrom
fvsch:stylelint-prettier
Mar 11, 2019
Merged

Use stylelint-prettier instead of stylelint formatting rules#8098
jasonLaster merged 1 commit into
firefox-devtools:masterfrom
fvsch:stylelint-prettier

Conversation

@fvsch

@fvsch fvsch commented Mar 7, 2019

Copy link
Copy Markdown
Contributor

Two possible improvements to the stylelint config:

  1. use stylelint-prettier to replace most stylelint formatting rules
  2. lint a few more files (from packages/devtools-*)

@jasonLaster, you set up Prettier for CSS initially, do those changes look good to you?

Formatting

We have:

  • a bunch of formatting rules in .stylelintrc;
  • Prettier that formats CSS (since prettify css #3187).

Both are close but not identical, and at least one file had conflicts in how it handles long selectors. Prettier would wrap those selectors using continuation indents, and stylelint would complain if you used its "indentation" rule with any value.

Turns out we can use stylelint-prettier to take care of the formatting issues. 80% of our stylelint rules basically say whether to put a space before or after language punctuation.

Only downside I've found: the reported errors are a bit more arcane. Not the exact errors, just quoting from the top of my mind:

  • Before: Unexpected space character after "{" (name-of-rule-heere)
  • After: Replace "." with "" (prettier/prettier)
    (Both report the file:line:column in the same way.)

Linting more files

Can we lint CSS files in packages/devtools-*/src/**/*.css?

In my tests it works pretty well, only requires a few fixes to align with Prettier rules.

We can add them to bin/prettier.js too.

Finally, out of the three stylesheets listed in .stylelintignore, two don't exist anymore and one doesn't have linting issues, so I figured we could just remove this file.

@jasonLaster jasonLaster merged commit 0986a2c into firefox-devtools:master Mar 11, 2019
@fvsch fvsch deleted the stylelint-prettier branch March 18, 2019 11:58
darkwing pushed a commit to darkwing/debugger.html that referenced this pull request Mar 21, 2019
darkwing pushed a commit to darkwing/debugger.html that referenced this pull request Mar 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants