Могу ли я использовать свой собственный плагин или расширить движок stylelint с помощью CodeClimate?

В моем stylelintrc.js

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

В codeclimat.yaml я включаю движок stylelint и получаю эту ошибку на codeclimete.

•• Время: .engineConfig: 0,049 с. Ошибка: не удалось найти «stylelint-config-css-modules». Вам нужен configBasedir? Дополнительную информацию см. в нашей документации по адресу https://docs.codeclimate.com/docs/stylelint.

Может кто-нибудь объяснить мне, как включить плагины и расширения, если это возможно?


person Konstantin Viikset    schedule 17.04.2017    source источник


Ответы (1)


Это ответ для всех, кто приходит сюда из Google:

Как ни странно, 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,
    },
}

person Na'aman Hirschfeld    schedule 08.09.2019
comment
Это решило мою проблему, спасибо! - person Marcos de Andrade; 30.07.2021