stylelint / vscode-stylelint

The official Visual Studio Code extension for Stylelint
https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint
MIT License
315 stars 30 forks source link

[Bug]: TypeError: opts.node.rangeBy is not a function at new Warning... #379

Open zhou-tao opened 2 years ago

zhou-tao commented 2 years ago

How did you encounter this bug?

Trigger this warning when the enter key is pressed in a less file

Code Snippet

.red {
 color: red
}

/* press enter to trigger this warning */

Stylelint Configuration

module.exports = {
  "extends": [
    "stylelint-config-standard",
    "stylelint-config-recess-order",
    "stylelint-config-html",
    "stylelint-config-prettier"
  ],
  "rules": {
    "at-rule-no-unknown": [
      true,
      {
        "ignoreAtRules": [
          "tailwind",
          "apply",
          "variants",
          "responsive",
          "screen",
          "function",
          "if",
          "each",
          "include",
          "mixin"
        ]
      }
    ],
    "custom-property-pattern": [
      "^([a-z][a-z0-9]*)(-[a-z0-9]+)*$",
      {
        "message": "Expected custom property name to be kebab-case"
      }
    ],
    "no-empty-source": null,
    "declaration-block-no-duplicate-properties": true,
    "declaration-block-trailing-semicolon": "always",
    "declaration-block-semicolon-space-before": "never",
    "declaration-colon-space-before": "never",
    "declaration-colon-space-after": "always",
    "declaration-bang-space-before": "always",
    "declaration-bang-space-after": "never",
    "block-opening-brace-space-before": "always",
    "block-opening-brace-newline-after": "always",
    "block-closing-brace-newline-before": "always",
    "block-closing-brace-empty-line-before": "never",
    "selector-list-comma-space-after": "always",
    "selector-descendant-combinator-no-non-space": true,
    "selector-combinator-space-before": "always",
    "selector-combinator-space-after": "always",
    "selector-attribute-quotes": "never",
    "selector-attribute-brackets-space-inside": "never",
    "selector-attribute-operator-space-before": "never",
    "selector-attribute-operator-space-after": "never",
    "no-extra-semicolons": true,
    "indentation": [
      2,
      {
        "baseIndentLevel": 0
      }
    ],
    "max-empty-lines": 1,
    "no-eol-whitespace": true,
    "no-missing-end-of-source-newline": true
  },
  "overrides": [
    {
      "files": [
        "*.less",
        "**/*.less"
      ],
      "customSyntax": "postcss-less"
    },
    {
      "files": [
        "*.vue",
        "**/*.vue"
      ],
      "rules": {
        "indentation": [
          2,
          {
            "baseIndentLevel": 1
          }
        ]
      }
    },
    {
      "files": [
        "*.html",
        "**/*.html"
      ],
      "rules": {
        "indentation": [
          2,
          {
            "baseIndentLevel": 3
          }
        ]
      }
    }
  ]
}

Extension Configuration

{
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true,
    "source.fixAll.stylelint": true
  },
  "eslint.workingDirectories": [
    "src"
  ],
  "eslint.codeActionsOnSave.mode": "all",
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "vue",
    "typescript",
    "typescriptreact"
  ],
  "stylelint.validate": [
    "css",
    "less",
    "postcss",
    "scss",
    "sass",
    "vue",
    "html"
  ],
  "less.lint.unknownAtRules": "ignore"
}

Actual Behaviour

bug-gif

Expected Behaviour

Hope that resolves the warning, thanks!

Logs

No response

Stylelint Version

v14.3.0

vscode-stylelint Version

v1.2.2

Node.js Version

v16.13.2

Operating System

windows 10

Windows Subsystem for Linux

No response

Code of Conduct

Chen-913 commented 2 years ago

I have met the same problem. Is there a corresponding solution

Friksel commented 1 year ago

Same error message here. Stylelint seems to detect errors as the error message is only popping up when there is a rule violation, but instead of showing the violated rule everytime it's this error message popping up.

danniserena commented 1 year ago

Hey, I got the same error message, and I saw the same issue in stackflow, in which most people said they dont know how to reproduce the problem and it suddenly gone, and I followed some version they post, like postcss@8.4.4,but it didn't work,so I thought that maybe it's just the cache, and I did try to reboot my vscode before, but this time I thought maybe that's not enough, so I closed the project folder and reopen it,and it worked for me, now my stylelint works normally. I hope this is useful to u guys~

helloCheng09 commented 11 months ago

I have fixed the same problem by flowing this resolving. [https://lightrun.com/answers/stylelint-stylelint-fix-typeerror-optsnoderangeby-is-not-a-function-with-postcss-844]

image image