how can stylelint15 work in vscode with my configuration

66 Views Asked by At

I use stylelint version 15 in vscode to lint less, but it didn't work.

vscode with stylelint error message

the package.json with version below

  "devDependencies": {
    "@commitlint/cli": "v16",
    "@commitlint/config-conventional": "v16",
    "@types/react": "^17.0.0",
    "@types/react-dom": "^17.0.0",
    "@umijs/fabric": "^4.0.1",
    "@umijs/preset-react": "1.x",
    "@umijs/test": "^3.5.41",
    "commitizen": "^4.3.0",
    "cz-conventional-changelog": "^3.3.0",
    "eslint": "^8.55.0",
    "husky": "^8.0.3",
    "lint-staged": "^10.0.7",
    "postcss-less": "^6.0.0",
    "prettier": "^2.2.0",
    "stylelint": "^15.11.0",
    "stylelint-config-standard": "^34.0.0",
    "stylelint-config-standard-less": "^2.0.0",
    "typescript": "^4.1.2",
    "yorkie": "^2.0.0"
  }
}

package.json file

and my stylelint configuration file is

module.exports = {
  extends: 'stylelint-config-standard-less',
  customSyntax: 'postcss-less',
  rules: {
    'declaration-block-no-duplicate-properties': [
      true,
      { ignore: ['consecutive-duplicates-with-different-syntaxes'] },
    ],
    // 'declaration-property-value-no-unknown': true,
  },
  overrides: [
    {
      files: ['*.less', '**/*.less'],
      customSyntax: 'postcss-less',
      extends: 'stylelint-config-standard-less',
      rules: {
        'declaration-block-no-duplicate-properties': [
          true,
          { ignore: ['consecutive-duplicates-with-different-syntaxes'] },
        ],
      },
    },
  ],
};

help, it should work

I try to use postcss-less to set customSyntax, but it didn't chagne anything

0

There are 0 best solutions below