1.2.2 • Published 10 months ago

no-top-global v1.2.2

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

功能

校验样式文件中最外层:global并提示报错,以下bad情况插件会提示报错。:global文件应该放到嵌套语句中使用。

Bad ❌

:global {
  .ant-modal-content {
      padding-right: 10px;
      overflow-x: hidden;
    }
}

Good ✅

.modal_wrap{
  :global {
    .ant-modal-content {
        padding-right: 10px;
        overflow-x: hidden;
      }
  }
}

下载

yarn add no-top-global -D  

使用

no-top-global:在.stylelintrc文件中增添如下配置。whiteList为白名单,配置不需要校验的文件,glob格式。如果不需要白名单,

plugins:['no-top-global'],
rules: {
'moresec/no-top-global':[true,{whiteList:['src/global.less','src/styles/*/**']}]
//不需要白名单这么设置即可
//'moresec/no-top-global':true
},

Allowed-style:在.stylelintrc文件中增添如下配置。第一个参数为全局样式所在位置,第二个参数为允许的样式名称配置列表,不在其中的会在global.less中报错

plugins:['no-top-global'], 
rules: {
    'moresec/allowed-style':['lib/rules/allowed-style/global.less',['.ant-pro-sider-fixed','html','body','#root']]
  },

测试

npm run test
1.2.2

10 months ago

1.1.2

10 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago