【问题标题】:Can i use my own plugin or extend in stylelint engine with CodeClimate我可以使用我自己的插件或使用 CodeClimate 在 stylelint 引擎中扩展吗
【发布时间】:2017-09-13 09:39:32
【问题描述】:

在我的 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

如果可能的话,谁能解释一下如何启用插件和扩展?

【问题讨论】:

    标签: code-climate stylelint


    【解决方案1】:

    这是来自谷歌的任何人的答案:

    很奇怪,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,
        },
    }
    
    

    【讨论】:

      猜你喜欢
      • 2018-11-11
      • 2016-11-27
      • 1970-01-01
      • 2010-12-04
      • 1970-01-01
      • 2021-12-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多