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

False positives for parameterless functions in function-parentheses-space-inside #2581

Closed
PhilippSoehnlein opened this issue May 17, 2017 · 4 comments
Labels
good first issue is good for newcomers

Comments

@PhilippSoehnlein
Copy link

Describe the issue. Is it a bug or a feature request (new rule, new option, etc.)?

A bug where the function-parentheses-space-inside rule set to always-single-line reports a warning for functions with no params.
IMO this shouldn't be flagged or even if, an except-option for functions with no params should be possible.

Which rule, if any, is this issue related to?

function-parentheses-space-inside

What CSS is needed to reproduce this issue?

@function someFunction() {
    @return 'someUrl';
}
.foo {
    background-image: someFunction();
}

What stylelint configuration is needed to reproduce this issue?

e.g.

{
  "rules": {
    "function-parentheses-space-inside": "always-single-line"
  }
}

Which version of stylelint are you using?

7.10.1

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

CLI

Does your issue relate to non-standard syntax (e.g. SCSS, nesting, etc.)?

Yes, it's related to SCSS.

What did you expect to happen?

No warnings to be flagged.

What actually happened (e.g. what warnings or errors you are getting)?

Expected single space before ")" in a single-line function

@jeddy3
Copy link
Member

jeddy3 commented May 17, 2017

@PhilippSoehnlein Thank you for the report and for using the issue template.

IMO this shouldn't be flagged

Yes, you're right. It's should not flag a violation.

I believe there are two possible fixes, depending on whether parameterless functions are valid construct in CSS. Do you know if they are?

If not, we should ignore them in isStandardSyntaxFunction.

Otherwise, we should bake an early return into function-parentheses-space-inside directly.

@jeddy3 jeddy3 added good first issue is good for newcomers status: ready to implement is ready to be worked on by someone type: bug labels May 17, 2017
@jeddy3 jeddy3 changed the title function-parentheses-space-inside with no function params False positive for parameterless functions in function-parentheses-space-inside May 17, 2017
@jeddy3 jeddy3 changed the title False positive for parameterless functions in function-parentheses-space-inside False positives for parameterless functions in function-parentheses-space-inside May 17, 2017
@hudochenkov
Copy link
Member

@jeddy3 I did a research. url() is valid. Also some filter functions could have no parameters.

@jeddy3
Copy link
Member

jeddy3 commented May 23, 2017

Thanks for doing the research!

@hudochenkov
Copy link
Member

@PhilippSoehnlein thank you for reporting!

Fixed by #2587.

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
Development

No branches or pull requests

3 participants