rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

Add Stylelint To Ember Blueprints

Open elwayman02 opened this issue 3 years ago • 17 comments

Rendered

elwayman02 avatar Apr 20 '22 00:04 elwayman02

I recently removed Stylelint from our applications at Precision Nutrition. There was significant push back from our team on this tool. We found that:

  1. Setting up Stylelint to work with our existing stack was non-trivial. We have a fairly old, and complicated, PostCSS setup that necessitated a fair bit of massaging to appease Stylelint.
  2. Resolving conflicts was non-trivial for our existing, and large, CSS code base.
  3. Stylelint's TODO functionality is poor comparative to ember-template-lint, you basically end up with a wall of warnings that is never resolved. It demoralizes the developer.
  4. We're transitioning to a Tailwind oriented approach. This more or less makes Stylelint meaningless in the long run for us.
  5. Though it did catch some nasty bugs and help with best practices, resolving these issues was non-trivial and largely not worth the effort. "If it ain't broke, don't fix it."

I know that these RFCs ultimately afford the escape valve of simply excluding said packages from one's stack, but I thought I'd add some colour with our experience. All of this is to say I'm sure this tool helps some people, but I'm not sure it's as universal a win as the other linting tools cited.

jherdman avatar Apr 20 '22 13:04 jherdman

I recently removed Stylelint from our applications at Precision Nutrition. There was significant push back from our team on this tool. We found that:

  1. Setting up Stylelint to work with our existing stack was non-trivial. We have a fairly old, and complicated, PostCSS setup that necessitated a fair bit of massaging to appease Stylelint.
  2. Resolving conflicts was non-trivial for our existing, and large, CSS code base.
  3. Stylelint's TODO functionality is poor comparative to ember-template-lint, you basically end up with a wall of warnings that is never resolved. It demoralizes the developer.
  4. We're transitioning to a Tailwind oriented approach. This more or less makes Stylelint meaningless in the long run for us.
  5. Though it did catch some nasty bugs and help with best practices, resolving these issues was non-trivial and largely not worth the effort. "If it ain't broke, don't fix it."

I know that these RFCs ultimately afford the escape valve of simply excluding said packages from one's stack, but I thought I'd add some colour with our experience. All of this is to say I'm sure this tool helps some people, but I'm not sure it's as universal a win as the other linting tools cited.

These concerns are already addressed in the Drawbacks section: https://github.com/elwayman02/rfcs/blob/stylelint/text/0814-stylelint.md#drawbacks

elwayman02 avatar Apr 20 '22 18:04 elwayman02

Any other thoughts/concerns about moving forward with this RFC?

elwayman02 avatar Jun 16 '22 18:06 elwayman02

@elwayman02 I will bring this one up during the next CLI meeting.

bertdeblock avatar Jun 18 '22 18:06 bertdeblock

@bertdeblock where does this stand?

wagenet avatar Jul 25 '22 14:07 wagenet

Sorry for the delay. I've added this RFC to next week's agenda.

bertdeblock avatar Aug 18 '22 16:08 bertdeblock

We discussed this in the cli meeting today and decided to move it to final comment period. We'd like to hear more feedback on this topic, if there is any, but agree that it is broadly inline with other linting we do.

kategengler avatar Aug 31 '22 17:08 kategengler

in all of the projects that we work with, this would be almost a no-op due to the use of tailwindcss; I can see this potentially adding a few extra seconds to the runtime of a lint:* command

I wonder if a better approach would be to offer people a way to opt into stylelint via something like ember-apply, as I can be sure we will remove the packages on upgrade, in order to ever so slightly lessen the burden of packages needing to be kept up to date.

on a final note I believe that the proposal should also add the config file .stylelint.js to the .eslintrc.js overrides section where all the other .config files live

void-mAlex avatar Aug 31 '22 17:08 void-mAlex

@void-mAlex If you remove the scripts in package.json for stylelint (would remove any extra time for the lint command) and the related packages, and use ember-cli-update to upgrade in the future, they shouldn't come back. That said, there does seem to be a maintained plugin for stylelint config. for tailwindcss.

kategengler avatar Aug 31 '22 17:08 kategengler

@void-mAlex I think your last concern is covered here.

bertdeblock avatar Aug 31 '22 18:08 bertdeblock

@void-mAlex I think your last concern is covered here.

I did read that but somehow didn't make the connection even searched for eslintrc to double-check I didn't miss it. you are correct though.

void-mAlex avatar Aug 31 '22 18:08 void-mAlex

can we have a flag to opt out?

NullVoxPopuli avatar Aug 31 '22 18:08 NullVoxPopuli

@void-mAlex If you remove the scripts in package.json for stylelint (would remove any extra time for the lint command) and the related packages, and use ember-cli-update to upgrade in the future, they shouldn't come back. That said, there does seem to be a maintained plugin for stylelint config. for tailwindcss.

as far as I can tell the only thing it does is disable stylelint rules when you use tailwindcss and its special @ syntax

rules: {
    'at-rule-no-unknown': [
      true,
      {
        ignoreAtRules: [
          'tailwind',
          'apply',
          'layer',
          /** tailwindcss v1, v2 */
          'variants',
          'responsive',
          'screen',
        ],
      },
    ],
    'function-no-unknown': [
      true,
      {
        ignoreFunctions: ['theme'],
      },
    ],
  },

in case you're talking about stylelint-config-tailwindcss which is the one I found so it's not really useful as the point is to have the styles generated based on what you actually use in the template so app.css has 3 lines in it

void-mAlex avatar Aug 31 '22 18:08 void-mAlex

can we have a flag to opt out?

If you mean a flag while running the blueprint, I don't think that would be bad and it could be an implementation detail. I don't think the RFC needs to commit one way or the other.

ef4 avatar Sep 09 '22 18:09 ef4

Framework team discussed this today and have decided to merge. The actual merge is pending technicalities (updates to the frontmatter).

kategengler avatar Sep 09 '22 18:09 kategengler

@kategengler sorry for the delay! I just got back from vacation and have updated the frontmatter as you suggested.

elwayman02 avatar Sep 12 '22 19:09 elwayman02

@elwayman02 Thank you!

kategengler avatar Sep 12 '22 19:09 kategengler

Framework team discussed this today and have decided to merge. The actual merge is pending technicalities (updates to the frontmatter).

What is the status on this one? Still pending for required changes to frontmatter?

jelhan avatar Oct 17 '22 10:10 jelhan

I've opened up an implementation for this RFC in:

  • https://github.com/ember-cli/ember-cli/pull/10122

bmish avatar Jan 10 '23 01:01 bmish