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 TypeError for inline comments and autofix in max-empty-lines #4820

Closed
ecuplxd opened this issue Jun 4, 2020 · 1 comment
Closed

Fix TypeError for inline comments and autofix in max-empty-lines #4820

ecuplxd opened this issue Jun 4, 2020 · 1 comment
Labels
status: wip is being worked on by someone syntax: sass relates to Sass and Sass-like syntax type: bug a problem with a feature or rule

Comments

@ecuplxd
Copy link
Contributor

ecuplxd commented Jun 4, 2020

Clearly describe the bug

if had inline comment in a rule, special -s=sugarss --fix make throw TypeError

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

max-empty-lines

What code is needed to reproduce the bug?

a {
  width: 00.1em; // inline comment
}

What stylelint configuration is needed to reproduce the bug?

{
  "rules": {
    "max-empty-lines": 1
  }
}

Which version of stylelint are you using?

13.5.0

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

"CLI with stylelint "**/*.sss" --config myconfig.json -s=sugarss --fix"

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

sugarss inline comment

What did you expect to happen?

no error throw

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

TypeError: Cannot read property 'replace' of undefined

    at <input css 189>:1:1
    at replaceEmptyLines (lib/rules/max-empty-lines/index.js:175:18)
    at apply (node_modules/lodash/lodash.js:475:27)
    at getChars (node_modules/lodash/lodash.js:5317:16)
    at callback (lib/rules/max-empty-lines/index.js:60:25)
    at callback (node_modules/postcss/lib/container.es6:110:18)
    at Root.each (node_modules/postcss/lib/container.es6:76:16)
    at Root.walk (node_modules/postcss/lib/container.es6:107:17)
    at lib/rules/max-empty-lines/index.js:51:9
    at lib/lintSource.js:210:6
        at Array.map (<anonymous>)
@jeddy3 jeddy3 changed the title Fix max-empty-lines auto fix error when special -s=sugarss & had inline comment Fix TypeError for inline comments and autofix in max-empty-lines Jun 5, 2020
@jeddy3 jeddy3 added status: wip is being worked on by someone syntax: sass relates to Sass and Sass-like syntax type: bug a problem with a feature or rule labels Jun 5, 2020
@jeddy3
Copy link
Member

jeddy3 commented Jan 18, 2022

Fixed in #4821

@jeddy3 jeddy3 closed this as completed Jan 18, 2022
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 syntax: sass relates to Sass and Sass-like syntax type: bug a problem with a feature or rule
Development

No branches or pull requests

2 participants