npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@xmgh/stylelint-config-strict-base

v1.0.0

Published

An shareable strict config for stylelint

Readme

@xmgh/stylelint-config-strict-base

An shareable strict config for stylelint

引入npm依赖包

yarn add -D [email protected] @xmgh/[email protected]

添加webpack插件,方便开发时校验

对于 webpack 工程,可以添加 webpack 插件,以方便开发时实时校验

执行下列命令,安装插件

yarn add -D @xmgh/[email protected]

vue-cli2 工程,需要在/build/webpack.config.base.js 文件里引入插件并进行配置

const StyleLintPlugin = require('@xmgh/stylelint-webpack-plugin')
module.exports = {
  plugins: [
    new StyleLintPlugin({
      // 正则匹配想要lint监测的文件
      files: ['src/**/*.vue', 'src/**/*.l?(e|c)ss'],
    }),
  ]
}

vue-cli3 工程需要在项目根目录的vue.config.js文件内添加如下内容

const StyleLintPlugin = require('@xmgh/stylelint-webpack-plugin')
module.exports = {
  configureWebpack: {
    plugins: [
      new StyleLintPlugin({
        // 正则匹配想要lint监测的文件
        files: ['src/**/*.vue', 'src/**/*.l?(e|c)ss'],
      }),
    ]
  }
}

使用规范

对于新工程,直接在项目根目录下,复制如下内容至 .stylelintrc.js 文件内

module.exports = {
  extends: ['@xmgh/stylelint-config-strict-base'],
  // 各工程的个性化配置,可以在这里设置覆盖
  rules: {
    // 'declaration-no-important': null,
  }
}

还可以对一些文件忽略校验 同样在项目根目录下建立新文件 .stylelintignore ,文件内加入如下配置

**/node_modules
**/dist
*.js
*.png
*.eot
*.ttf
*.woff

PS: 对于第二项在项目根目录引入规范的方式,会对整个工程的文件进行校验,建议新工程使用, 对于老工程,可以对指定的文件进行校验,在根目录下放置一个空的规则文件,将实际的规范文件 .stylelintrc.js 放到相对应的目录下

空文件格式如下:

module.exports = {
  rules: {

  }
}

另外对于某些可以自修复的问题,可以通过命令行自动修复,但这种方式可能会引发不可知的问题,慎用。 可以在package.json 文件内的script 字段下添加如下命令:

"stylelint:fix": "stylelint \"./**/*.{css,less,vue}\" --fix"