Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i use my own plugin or extend in stylelint engine with CodeClimate

In my stylelintrc.js

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

In codeclimat.yaml i turn on stylelint engine and take this error on codeclimete

•• Timing: .engineConfig: 0.049s Error: Could not find "stylelint-config-css-modules". Do you need a configBasedir? See our documentation at https://docs.codeclimate.com/docs/stylelint for more information.

Can somebody explain me how enable plugins ands extends if it posible?

like image 568
Konstantin Avatar asked Oct 30 '22 09:10

Konstantin


1 Answers

This is an answer for anyone coming here from google:

Weirdly enough stylelint needs to be given the absolue path of the node_modules folder. Below is a working solution:

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,
    },
}

like image 69
Na'aman Hirschfeld Avatar answered Dec 27 '22 06:12

Na'aman Hirschfeld