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 SyntaxError when an empty string is used for a rule's custom message #3718

Closed
mems opened this issue Oct 12, 2018 · 1 comment
Closed
Labels
good first issue is good for newcomers status: ready to implement is ready to be worked on by someone status: wip is being worked on by someone type: bug a problem with a feature or rule

Comments

@mems
Copy link

mems commented Oct 12, 2018

If you declare empty custom message for a rule, stylelint fail with an error

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

Any

What CSS is needed to reproduce the bug?

Any

What stylelint configuration is needed to reproduce the bug?

{
  "rules": {
    "property-no-vendor-prefix": [true, {"message": ""}],
  }
}

Which version of stylelint are you using?

9.6.0

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

Node API (via gulp-stylelint)

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

No

What did you expect to happen?

No SyntaxError exception, at least an error about misconfiguration (eg. "Custom message shouldn't be empty")

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

SyntaxError: Invalid regular expression: /(^.{1,1}(\s+|$))|(^.{1,0}(\\|/|_|\.|,|;|-))/: numbers out of order in {} quantifier
    at new RegExp (<anonymous>)
    at wrapWord (<redacted>\node_modules\table\dist\wrapWord.js:24:14)
    at calculateCellHeight (<redacted>\node_modules\table\dist\calculateCellHeight.js:36:34)
    at cells.forEach (<redacted>\node_modules\table\dist\calculateRowHeightIndex.js:35:66)
    at Array.forEach (<anonymous>)
    at rows.forEach.cells (<redacted>\node_modules\table\dist\calculateRowHeightIndex.js:26:11)
    at Array.forEach (<anonymous>)
    at calculateRowHeightIndex (<redacted>\node_modules\table\dist\calculateRowHeightIndex.js:24:8)
    at Object.table (<redacted>\node_modules\table\dist\table.js:99:63)
    at formatter (<redacted>\node_modules\stylelint\lib\formatters\stringFormatter.js:135:6)
    at results.reduce (<redacted>\node_modules\stylelint\lib\formatters\stringFormatter.js:176:15)
    at Array.reduce (<anonymous>)
    at module.exports (<redacted>\node_modules\stylelint\lib\formatters\stringFormatter.js:163:20)
    at module.exports (<redacted>\node_modules\stylelint\lib\formatters\verboseFormatter.js:8:16)
    at reporter <redacted>\node_modules\gulp-stylelint\dist\reporter-factory.js:58:25)
    at <redacted>\node_modules\gulp-stylelint\dist\index.js:151:14
@jeddy3 jeddy3 changed the title Empty rule custom message error Fix SyntaxError when an empty string is used for a rule's custom message Oct 12, 2018
@jeddy3 jeddy3 added status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule good first issue is good for newcomers labels Oct 12, 2018
@jeddy3
Copy link
Member

jeddy3 commented Oct 12, 2018

@mems Thanks for the clear report and for using the template.

This definitely looks like a bug (likely in the string formatter). As the issue has been labelled "help wanted", please consider contributing a fix if you'd like to help out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue is good for newcomers status: ready to implement is ready to be worked on by someone status: wip is being worked on by someone type: bug a problem with a feature or rule
Development

No branches or pull requests

3 participants