我可以使用我自己的插件或使用 CodeClimate 在 stylelint 引擎中扩展吗

Kon*_*set 5 code-climate stylelint

在我的 stylelintrc.js

module.exports = { "extends": [ "stylelint-config-standard", "stylelint-config-css-modules", ], "plugins": [ "stylelint-performance-animation", ], ...

在 codeclimat.yaml 中,我打开 stylelint 引擎并在 codeclimete 上出现此错误

•• 时间:.engineConfig:0.049s 错误:找不到“stylelint-config-css-modules”。你需要configBasedir吗?有关更多信息,请参阅https://docs.codeclimate.com/docs/stylelint 上的文档。

有人可以解释一下如何启用插件和扩展吗?

Na'*_*eld 2

这是任何从谷歌来到这里的人的答案:

奇怪的是,需要为 stylelint 提供 node_modules 文件夹的绝对路径。下面是一个可行的解决方案:

const { resolve } = require('path')

const basePath = resolve(__dirname, 'node_modules')
const groupSelectors = `${basePath}/stylelint-group-selectors`
const cssTreeValidator = `${basePath}/stylelint-csstree-validator`

module.exports = {
    plugins: [groupSelectors, cssTreeValidator],
    extends: [
        'stylelint-config-recommended-scss',
        'stylelint-config-recess-order',
        'stylelint-prettier/recommended',
        'stylelint-scss',
        'stylelint-a11y/recommended',
    ],
    rules: {
        'no-empty-source': null,
        //check and add avaialble rules here: https://github.com/kristerkari/stylelint-scss
        'scss/selector-no-redundant-nesting-selector': true,
        'plugin/stylelint-group-selectors': true,
        'csstree/validator': true,
    },
}

Run Code Online (Sandbox Code Playgroud)