Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix report flags not reporting on subsequent runs when cache is used #5049

Closed
XhmikosR opened this issue Nov 20, 2020 · 4 comments · Fixed by #7483
Closed

Fix report flags not reporting on subsequent runs when cache is used #5049

XhmikosR opened this issue Nov 20, 2020 · 4 comments · Fixed by #7483
Labels
status: wip is being worked on by someone type: bug a problem with a feature or rule

Comments

@XhmikosR
Copy link
Member

XhmikosR commented Nov 20, 2020

Clearly describe the bug

When using the --rd switch, if there is a needless disable, the second or any subsequent run doesn't report it.

Which rule, if any, is the bug related to?

None

What stylelint configuration is needed to reproduce the bug?

Probably doesn't matter:

{
  "extends": [
    "stylelint-config-twbs-bootstrap/scss"
  ],
  "rules": {
    "function-disallowed-list": [
      "calc",
      "lighten",
      "darken"
    ],
    "property-disallowed-list": [
      "border-radius",
      "border-top-left-radius",
      "border-top-right-radius",
      "border-bottom-right-radius",
      "border-bottom-left-radius",
      "transition"
    ],
    "scss/dollar-variable-default": [
      true,
      {
        "ignore": "local"
      }
    ],
    "scss/selector-no-union-class-name": true
  }
}

Which version of stylelint are you using?

13.7.2 and 13.8.0

How are you running stylelint: CLI, PostCSS plugin, Node.js API?

CLI: stylelint "**/*.{css,scss}" --cache --cache-location .cache/.stylelintcache --rd

Does the bug relate to non-standard syntax (e.g. SCSS, Less etc.)?

Probably not

What did you expect to happen?

Any needless disables should be reported on subsequent runs.

What actually happened (e.g. what warnings or errors did you get)?

No needless disables were reported. If I delete the cache or remove the --cache CLI flag, then the needless disables are reported.

@jeddy3 I verified this and indeed happens with 13.7.0, 13.7.2 and 13.8.0 that I could quickly test.

@jeddy3 jeddy3 changed the title Needless disables are not reported on subsequent runs Fix report flags not reporting on subsequent runs when cache is used Nov 20, 2020
@jeddy3 jeddy3 added help wanted is likely non-trival and help is wanted status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule labels Nov 20, 2020
@jeddy3
Copy link
Member

jeddy3 commented Nov 20, 2020

@jeddy3 I verified this and indeed happens with both 13.7.2 and 13.8.0.

Thanks! It looks to be a longer-standing bug than a regression with 13.8.0.

I've labelled the issue as ready to implement. If anyone has time to look into this then please consider contributing.

@XhmikosR
Copy link
Member Author

I tested 13.7.0 and also has the issue. I can't go further behind because of the rule's renaming (well, I can but time 🙂)

@ybiquitous
Copy link
Member

I'm revisiting this issue. Perhaps, here's a reproduction with 16.2.0:

stylelint.config.mjs:

export default {
	rules: {
		'block-no-empty': true,
	},
};

test.css:

a { color: red; } /* stylelint-disable-line block-no-empty */
$ npx stylelint -v
16.2.0

$ rm -f .stylelintcache

$ DEBUG=* npx stylelint "*.css" --rd --cache
  stylelint:file-cache Cache file is created at /Users/masafumi.koba/git/stylelint/stylelint/tmp/.stylelintcache +0ms
  stylelint:standalone Processing /Users/masafumi.koba/git/stylelint/stylelint/tmp/test.css +0ms
  stylelint:standalone Linting complete in 69ms +16ms

test.css
 1:19  ✖  Needless disable for "block-no-empty"  --report-needless-disables

1 problem (1 error, 0 warnings)

$ DEBUG=* npx stylelint "*.css" --rd --cache
  stylelint:file-cache Cache file is created at /Users/masafumi.koba/git/stylelint/stylelint/tmp/.stylelintcache +0ms
  stylelint:standalone Processing /Users/masafumi.koba/git/stylelint/stylelint/tmp/test.css +0ms
  stylelint:file-cache Skip linting /Users/masafumi.koba/git/stylelint/stylelint/tmp/test.css. File hasn't changed. +33ms
  stylelint:standalone Linting complete in 59ms +7ms

Deleting cache doesn't seem to work when report-needless-disables errors happen: 🤔

if (
(postcssResult.stylelint.stylelintError || postcssResult.stylelint.stylelintWarning) &&
useCache
) {
debug(`${absoluteFilepath} contains linting errors and will not be cached.`);
stylelint._fileCache.removeEntry(absoluteFilepath);
}

@ybiquitous
Copy link
Member

I found a problem in the code. I'll open a pull request soon.

@ybiquitous ybiquitous added status: wip is being worked on by someone and removed status: ready to implement is ready to be worked on by someone help wanted is likely non-trival and help is wanted labels Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: wip is being worked on by someone type: bug a problem with a feature or rule
Development

Successfully merging a pull request may close this issue.

3 participants