Problem/Motivation

Our styleling configuration tries to lint all files matching pattern: **/*.css. This matches both, generated and ungenerated files. We shouldn't lint generated CSS files because they should be only changed by the compiler.

Proposed resolution

I have at least two potential ways to solve this. We could check if the .css file has a PostCSS file associated to it. Another approach would be to add an identifier to generated filenames and to use --ignore-pattern.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#15 3087006-15.patch617 byteslongwave

Comments

lauriii created an issue. See original summary.

alexpott’s picture

What do we do for JS? We have the same thing with .es6.js and .js no?

lauriii’s picture

We have this in the .eslintignore:

*.js
!*.es6.js

However, this is different because we switched into using ES6 consistently across all files. This is not the case for PostCSS. Therefore we can't use pattern like !*.pcss.css.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

longwave’s picture

Issue tags: +Bug Smash Initiative

This has been solved by adding rules to .stylelintignore, should we just close this?

alexpott’s picture

Also since #3314523: PostCSS results in CSS that does not comply with our coding standards our generated CSS actually complies with out stylelint rules so in fact we could remove .stylelintignore

Unfortunately though there is one issue...

yarn run v1.22.19
$ stylelint "**/*.css"

themes/olivero/css/components/fieldset.css
 51:1  ✖  Unexpected unknown type selector "_"  selector-type-no-unknown

1 problem (1 error, 0 warnings)

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

This is cause by our final css looking like this:

/* stylelint-disable-next-line selector-type-no-unknown */

_:-ms-fullscreen,
.fieldset {
  display: table;
  box-sizing: border-box;
  width: 100%;
}

Not sure why the new line is getting inserted.

longwave’s picture

Title: Stylelint tries to lint compiled CSS files » [PP-1] Stylelint tries to lint compiled CSS files
Status: Active » Postponed

#12 refers to an IE11 specific rule, so we can remove that now: #3321004: Remove IE11 hack from fieldset.css - postponing on that issue.

longwave’s picture

Title: [PP-1] Stylelint tries to lint compiled CSS files » Stylelint tries to lint compiled CSS files
Status: Postponed » Active

#3321004: Remove IE11 hack from fieldset.css landed so we should now be able to remove .stylelintignore.

longwave’s picture

Status: Active » Needs review
StatusFileSize
new617 bytes

So we can drop .stylelintignore in 10.x, as all our CSS conforms to standards now; with this patch applied:

$ yarn lint:css
yarn run v1.22.10
$ stylelint "**/*.css"
Done in 10.58s.
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Came across this during the review cleanup and the change looks good!

alexpott’s picture

Title: Stylelint tries to lint compiled CSS files » Drop .stylelintignore in 10.x
alexpott’s picture

Version: 10.1.x-dev » 10.0.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 3385a4070e to 10.1.x and 3371fa4ccf to 10.0.x. Thanks!

  • alexpott committed 3385a407 on 10.1.x
    Issue #3087006 by longwave, lauriii, alexpott: Drop .stylelintignore in...

  • alexpott committed 3371fa4c on 10.0.x
    Issue #3087006 by longwave, lauriii, alexpott: Drop .stylelintignore in...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.