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.

Fix "Unknown word" error in JavaScript files

See original GitHub issue

False-positive in * .js files.

stylelint-unknown-word

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

Unknown word (CssSyntaxError)

What CSS is needed to reproduce the bug?

main.js

import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import './registerServiceWorker';

Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: h => h(App),
}).$mount('#app');

What stylelint configuration is needed to reproduce the bug?

{
  "processors": ["stylelint-processor-html"],
  "plugins": [
    "stylelint-order",
    "stylelint-scss",
    "stylelint-declaration-use-variable",
  ],
  "rules": {
    "sh-waqar/declaration-use-variable": "/color/",
    "scss/selector-no-redundant-nesting-selector": true,
    "order/order": [
			"custom-properties",
			"declarations"
		],
		"order/properties-alphabetical-order": true,
    "at-rule-empty-line-before": [
        "always",
        {
            "except": [
                "blockless-after-same-name-blockless",
                "first-nested"
            ],
            "ignore": [
                "after-comment"
            ]
        }
    ],
    "at-rule-name-case": "lower",
    "at-rule-name-space-after": "always-single-line",
    "at-rule-semicolon-newline-after": "always",
    "block-closing-brace-empty-line-before": "never",
    "block-closing-brace-newline-after": "always",
    "block-closing-brace-newline-before": "always-multi-line",
    "block-closing-brace-space-before": "always-single-line",
    "block-opening-brace-newline-after": "always-multi-line",
    "block-opening-brace-space-after": "always-single-line",
    "block-opening-brace-space-before": "always",
    "color-named": "never",
    "color-hex-case": "lower",
    "color-hex-length": "short",
    "comment-empty-line-before": [
        "always",
        {
            "except": [
                "first-nested"
            ],
            "ignore": [
                "stylelint-commands"
            ]
        }
    ],
    "comment-whitespace-inside": "always",
    "custom-property-empty-line-before": [
        "always",
        {
            "except": [
                "after-custom-property",
                "first-nested"
            ],
            "ignore": [
                "after-comment",
                "inside-single-line-block"
            ]
        }
    ],
    "declaration-bang-space-after": "never",
    "declaration-bang-space-before": "always",
    "declaration-block-semicolon-newline-after": "always-multi-line",
    "declaration-block-semicolon-space-after": "always-single-line",
    "declaration-block-semicolon-space-before": "never",
    "declaration-block-single-line-max-declarations": 1,
    "declaration-block-trailing-semicolon": "always",
    "declaration-colon-newline-after": "always-multi-line",
    "declaration-colon-space-after": "always-single-line",
    "declaration-colon-space-before": "never",
    "declaration-empty-line-before": [
        "always",
        {
            "except": [
                "after-declaration",
                "first-nested"
            ],
            "ignore": [
                "after-comment",
                "inside-single-line-block"
            ]
        }
    ],
    "function-comma-newline-after": "always-multi-line",
    "function-comma-space-after": "always-single-line",
    "function-comma-space-before": "never",
    "function-max-empty-lines": 0,
    "function-name-case": "lower",
    "function-parentheses-newline-inside": "always-multi-line",
    "function-parentheses-space-inside": "never-single-line",
    "function-whitespace-after": "always",
    "indentation": 2,
    "length-zero-no-unit": true,
    "max-empty-lines": 1,
    "media-feature-colon-space-after": "always",
    "media-feature-colon-space-before": "never",
    "media-feature-name-case": "lower",
    "media-feature-parentheses-space-inside": "never",
    "media-feature-range-operator-space-after": "always",
    "media-feature-range-operator-space-before": "always",
    "media-query-list-comma-newline-after": "always-multi-line",
    "media-query-list-comma-space-after": "always-single-line",
    "media-query-list-comma-space-before": "never",
    "no-eol-whitespace": true,
    "no-missing-end-of-source-newline": true,
    "number-leading-zero": "never",
    "number-no-trailing-zeros": true,
    "property-case": "lower",
    "property-no-unknown": true,
    "rule-empty-line-before": [
        "always-multi-line",
        {
            "except": [
                "first-nested"
            ],
            "ignore": [
                "after-comment"
            ]
        }
    ],
    "selector-attribute-brackets-space-inside": "never",
    "selector-attribute-operator-space-after": "never",
    "selector-attribute-operator-space-before": "never",
    "selector-combinator-space-after": "always",
    "selector-combinator-space-before": "always",
    "selector-descendant-combinator-no-non-space": true,
    "selector-list-comma-newline-after": "always",
    "selector-list-comma-space-before": "never",
    "selector-max-empty-lines": 0,
    "selector-pseudo-class-case": "lower",
    "selector-pseudo-class-parentheses-space-inside": "never",
    "selector-pseudo-element-case": "lower",
    "selector-pseudo-element-colon-notation": "double",
    "selector-type-case": "lower",
    "unit-case": "lower",
    "value-list-comma-newline-after": "always-multi-line",
    "value-list-comma-space-after": "always-single-line",
    "value-list-comma-space-before": "never",
    "value-list-max-empty-lines": 0
  }
}

Which version of stylelint are you using?

9.3.0

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

vscode

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

Yes, in a js file.

What did you expect to happen?

No warnings to be flagged.

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

The following warnings were flagged:

error_stylelint

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

19reactions
hudochenkovcommented, Jun 29, 2018

Yeah, VSCode plugin doesn’t support .stylelintignore (and it isn’t mentioned in its readme). Try to exclude .js files with ignoreFiles in your stylelint config.

{
  rules: {},
  ignoreFiles: [
    '**/*.js'
  ]
}
5reactions
shinnncommented, Jul 1, 2018
- VSCode plugin doesn't support .stylelintignore
+ stylelint API doesn't support `.stylelintignore`

https://github.com/stylelint/stylelint/issues/2833

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix 'Unknown word' error when bundling css file in ...
main.css Unknown word 1 | > 2 | import API from "!..
Read more >
How to resolve the problem "Word experienced an error trying ...
First, right-click the Word file that you have problems with, and click "Property". Click "Unblock", when done, click"OK". (Note: a properly-working Word file...
Read more >
Strict mode - JavaScript - MDN Web Docs
Strict mode treats these mistakes as errors so that they're discovered and promptly fixed. Assigning to undeclared variables. Strict mode makes ...
Read more >
Getting Started with CSpell
1. Create a configuration file. ... CSpell can use JSON, Yaml, and JavaScript files for configuration. It automatically searches for one of the...
Read more >
User and Workspace Settings - Visual Studio Code
The error can be as simple as a missing comma or incorrect setting value. Open the settings.json file with the Preferences: Open Settings...
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