Skip to content

[Bug]: TypeError: Cannot read properties of undefined (reading '0') at LessParser.interpolation #378

Closed
@tjx666

Description

How did you encounter this bug?

  1. git clone [email protected]:tjx666/stylelint-issue-repro.git
  2. install dependencies by pnpm install
  3. open index.less
  4. input dot .

Code Snippet

Just input .:

.

Stylelint Configuration

{
    "extends": [
        "stylelint-config-standard",
        "stylelint-config-prettier",
        "stylelint-config-recess-order"
    ],
    "plugins": ["stylelint-declaration-block-no-ignored-properties"],
    "customSyntax": "postcss-less",
    "rules": {
        "alpha-value-notation": null,
        "color-function-notation": null,
        "comment-empty-line-before": null,
        "declaration-empty-line-before": null,
        "function-name-case": "lower",
        "no-descending-specificity": null,
        "no-invalid-double-slash-comments": null,
        "number-max-precision": null,
        "property-no-vendor-prefix": null,
        "selector-class-pattern": null,
        "value-no-vendor-prefix": null
    },
    "ignoreFiles": ["**/node_modules/**", "reset.less"]
}

Extension Configuration

None

Actual Behaviour

image

Expected Behaviour

No error notification.

Logs

[Info - 10:43:31 AM] [language-server] Registering module | module: "auto-fix"
[Info - 10:43:31 AM] [language-server] Module registered | module: "auto-fix"
[Info - 10:43:31 AM] [language-server] Registering module | module: "code-action"
[Info - 10:43:31 AM] [language-server] Module registered | module: "code-action"
[Info - 10:43:31 AM] [language-server] Registering module | module: "completion"
[Info - 10:43:31 AM] [language-server] Module registered | module: "completion"
[Info - 10:43:31 AM] [language-server] Registering module | module: "formatter"
[Info - 10:43:31 AM] [language-server] Module registered | module: "formatter"
[Info - 10:43:31 AM] [language-server] Registering module | module: "old-stylelint-warning"
[Info - 10:43:31 AM] [language-server] Module registered | module: "old-stylelint-warning"
[Info - 10:43:31 AM] [language-server] Registering module | module: "validator"
[Info - 10:43:31 AM] [language-server] Module registered | module: "validator"
[Info - 10:43:31 AM] [language-server] Starting language server
[Info - 10:43:31 AM] [language-server] Registering handlers
[Info - 10:43:31 AM] [language-server] Handlers registered
[Info - 10:43:31 AM] [language-server] Language server started
[Error - 10:43:48 AM] [language-server] Error running lint | uri: "file:///Users/yutengjing/Library/Application%20Support/Adobe/CEP/extensions/ae-power-tools/web/a.less" error: {"name":"TypeError","message":"Cannot read properties of undefined (reading '0')","stack":"TypeError: Cannot read properties of undefined (reading '0')\n at LessParser.interpolation (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss-less/lib/nodes/interpolation.js:9:45)\n at LessParser.atrule (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss-less/lib/LessParser.js:22:33)\n at LessParser.mixin (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss-less/lib/LessParser.js:145:10)\n at LessParser.unknownWord (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss-less/lib/LessParser.js:204:12)\n at LessParser.other (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss/lib/parser.js:151:12)\n at LessParser.other (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss-less/lib/LessParser.js:157:13)\n at LessParser.parse (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss/lib/parser.js:59:16)\n at parse (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss-less/lib/index.js:13:12)\n at new LazyResult (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss/lib/lazy-result.js:133:16)\n at getPostcssResult (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/stylelint/lib/getPostcssResult.js:77:30)"}
[Error - 10:43:51 AM] [language-server] Error running lint | uri: "file:///Users/yutengjing/Library/Application%20Support/Adobe/CEP/extensions/ae-power-tools/web/a.less" error: {"name":"TypeError","message":"Cannot read properties of undefined (reading '0')","stack":"TypeError: Cannot read properties of undefined (reading '0')\n at LessParser.interpolation (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss-less/lib/nodes/interpolation.js:9:45)\n at LessParser.atrule (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss-less/lib/LessParser.js:22:33)\n at LessParser.mixin (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss-less/lib/LessParser.js:145:10)\n at LessParser.unknownWord (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss-less/lib/LessParser.js:204:12)\n at LessParser.other (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss/lib/parser.js:151:12)\n at LessParser.other (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss-less/lib/LessParser.js:157:13)\n at LessParser.parse (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss/lib/parser.js:59:16)\n at parse (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss-less/lib/index.js:13:12)\n at new LazyResult (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/postcss/lib/lazy-result.js:133:16)\n at getPostcssResult (/Users/yutengjing/Library/Application Support/Adobe/CEP/extensions/ae-power-tools/node_modules/stylelint/lib/getPostcssResult.js:77:30)"}

Stylelint Version

14.4.0

vscode-stylelint Version

v1.2.2

Node.js Version

v16.13.2

Operating System

MacOS12.2

Windows Subsystem for Linux

No response

Code of Conduct

  • I agree to follow vscode-stylelint's Code of Conduct

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions