Stylelint—— Expected class selector ".nut-popup--top" to be kebab-case selector-class-pattern

简介: 新项目制定规范接入了stylelint,并通过husky在git提交时去触发检测修复,因为使用的是NutUi,所以无法直接调整组件对应的类名称,只好在stylelint.config.js中加入相应的rules进行配置。

前言

新项目制定规范接入了stylelint,并通过husky在git提交时去触发检测修复,stylelint版本信息如下:

    "stylelint": "^16.8.1",
    "stylelint-config-standard": "^36.0.1",
    "stylelint-less": "^3.0.1",
    "stylelint-order": "^6.0.4",

内容

因为使用的是NutUi,所以无法直接调整组件对应的类名称,只好在stylelint.config.js中加入相应的rules进行配置;

module.exports = {
   
  defaultSeverity: 'error',
  extends: ['stylelint-config-standard'],
  plugins: ['stylelint-less'],
  overrides: [
    {
   
      files: ['**/*.html', '**/*.vue'],
      customSyntax: 'postcss-html',
    },
    {
   
      files: ['**/*.less'],
      customSyntax: 'postcss-less',
    },
  ],
  rules: {
   
    'selector-pseudo-class-no-unknown': [
      true,
      {
   
        ignorePseudoClasses: ['deep'],
      },
    ],
    'selector-class-pattern': [
      '^((?!\\.nut).)*$',
      {
   
        message: "Expected class selector not to start with '.nut'",
      },
    ],
  },
};
目录
相关文章
|
3月前
|
开发工具 git
Stylelint——Unexpected unknown pseudo-class selector ":deep" selector-pseudo-class-no-unknown
新项目制定规范接入了stylelint,并通过husky在git提交时去触发检测修复,使用`:deep()`的时候却发现了报错;
100 1
|
3月前
|
CDN
Iconfont——Error: <path> attribute d: Expected number, "MNaNNaNaNaNNaNNaN…".
Iconfont——Error: <path> attribute d: Expected number, "MNaNNaNaNaNNaNNaN…".
35 0
Unknown custom element: <add-employee> - did you register the component correctly? For red cursive c
原因: 1.组件名没写对(导入和注册不对应) 2.components少写了个s 3.组件命名最好是驼峰命名 4.导入时语法错误 5.代码中有两个components,后一个的值把前一个覆盖了 6.组件直接循环套用了
|
11月前
|
JavaScript
[Vue warn]: Unknown custom element: <Top> - did you register the component correctly?
[Vue warn]: Unknown custom element: <Top> - did you register the component correctly?
|
JavaScript 前端开发
成功解决Component template should contain exactly one root element
成功解决Component template should contain exactly one root element
Extraneous children found when component already has explicitly named default slot. These children
Extraneous children found when component already has explicitly named default slot. These children
1261 5
|
前端开发
前端 scss文件报错 Base-level rules cannot contain the parent-selector-referencing character '&'. 解决办法
前端 scss文件报错 Base-level rules cannot contain the parent-selector-referencing character '&'. 解决办法
438 0
jMeter transaction Controller generate parent sample checkbox 的行为分析
jMeter transaction Controller generate parent sample checkbox 的行为分析
213 0
jMeter transaction Controller generate parent sample checkbox 的行为分析
|
JavaScript
click group list in left launchpad
click group list in left launchpad
129 0
click group list in left launchpad
|
JavaScript jenkins 持续交付
Solution for Lead OPA test error ( add button clicked after cancel button )
Solution for Lead OPA test error ( add button clicked after cancel button )
134 0
Solution for Lead OPA test error ( add button clicked after cancel button )