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

时间:2017-04-17 18:17:16

标签: 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上的文档。

有人可以解释一下,如果它能够实现,插件和插件是如何扩展的?

1 个答案:

答案 0 :(得分:0)

这是所有来自google的人的答案:

需要给style_lint足够的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,
    },
}