question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rule 'no-empty-source' fails on 'null' and doesn't accept 'false'

See original GitHub issue

I want to use stylelint to lint inside Vue files. When adding Vue files to be linted, I get this error:

src/layouts/default.vue
 12:24  ✖  Missed semicolon   CssSyntaxError

I need to install processor @mapbox/stylelint-processor-arbitrary-tags (because stylelint-preprocessor-html is deprecated). And when using this, their readme says to disable the rule no-empty-source.

I am extending stylelint-config-recommended in my config, and I must overwrite the rule no-empty-source to turn it off.

When setting 'no-empty-source': null in the config, stylelint will return no exit code and all linting will succeed (but it should fail when there are lint-errors). When setting 'no-empty-source': false in the config, stylelint returns an error: Invalid Option: Unexpected option value "false" for rule "no-empty-source".

I expect to use false if the input is of type Boolean, or using null to reset to the default. To set to false or null, I can use the processor to use stylelint in style tags in Vue files.

Configuration file:

module.exports = {
  processors: ['@mapbox/stylelint-processor-arbitrary-tags'],
  extends: ['stylelint-config-standard'],
  rules: {
    'no-empty-source': null
  }
}

Stylelint version: 9.5.0, is also not working in 9.4.0

CLI: $ ./node_modules/.bin/stylelint --config ./config/stylelint.config.js --syntax scss ./src/{assets/styles/{,*/}*.scss,**/*.vue}

To test this, make sure to let your example code fail when using the ‘stylelint-config-recommended’ rules, then update your configuration to enable the processor and add the rule ‘no-empty-source’.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
jeddy3commented, Aug 21, 2018

This was very confusing me… So to solve it, I need to remove the --syntax scss and removing processor stylelint-processor-arbitrary-tags.

I’ve been working on a PR to deemphasize processors and the --syntax option in the docs. This will hopefully make it less confusing for other users.

stylelint can now automatically:

  • infer the syntax in lots of cases
  • extract styles from lots of places

As such, I’ve deemphasized processors and the --syntax option in the docs as their use is more of an edge case than the norm now.

Thanks for the help all!

@PMK I’m glad you were able to resolve the issue too 😃

1reaction
PMKcommented, Aug 21, 2018

@ota-meshi You’re totally right. This was very confusing me… Actually, now if I add the --syntax scss again, it gives different results. So to solve it, I need to remove the --syntax scss and removing processor stylelint-processor-arbitrary-tags.

Thanks for the help all!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot set block-no-empty to false in stylelint - Stack Overflow
Use null to turn a rule off e.g. "block-no-empty": null . More details can be found in the configuration guide.
Read more >
Changelog | Stylelint
Fixed: no-duplicate-selectors error with non-standard selectors (#6106). 14.8.3​. Fixed: at-rule-no-unknown false positives for @layer (#6093) ...
Read more >
Failing to Reject the Null Hypothesis - Statistics By Jim
Failing to reject the null hypothesis is an odd way to state that the results of your hypothesis test are not statistically significant....
Read more >
Avoid the Three-state Boolean Problem - Thoughtbot
Set a default value. The NOT NULL constraint means that this migration will fail if we have existing users, because Postgres doesn't know...
Read more >
Best Practices for Handling NULL in Boolean Fields
However, as !null evaluates to null , this doesn't work in ISM. ... false , these expressions should force null values to true...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found