将列表传递到SASS混入时出错:“]预期”

问题描述

我正在将列表传递给SASS mixin,它可以正常工作(浏览器或控制台中没有错误),但是我的编辑器(VS Code)说有错误代码是:

  @include gridAuto(
    320px,[
      ['sm',2],['',1],['lg',3],],var(--space-xl),var(--space-xxl)
  );

此行['sm',上出现错误错误

] expected
] expected
) expected
at-rule or selector expected

这些是入门主题使用的样式依赖项:

"autoprefixer": "^9.4","css-loader": "^0.28.9","cssnano": "~4.0.5","node-sass": "~4.9.4","postcss-custom-properties": "^9.1.1","postcss-loader": "~2.1.0","postcss-safe-parser": "~3.0","sass-loader": "~6.0","style-loader": "^0.22.1","stylelint": "^8.4.0","stylelint-config-standard": "~18.2.0","stylelint-webpack-plugin": "^0.10.5",

我附上了截图

enter image description here

解决方法

似乎内置于VS Code的SCSS验证程序正在努力理解此构造。当您将stylelint扩展名用于VS Code时,请通过在用户设置中添加以下内容来you can turn off the built-in validator

"scss.validate": false

(stylelint扩展本身对此结构没有问题。)