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

vscode-lint

v0.0.8

Published

A VSCode Configuration Tool Integrating Stylelint And Eslint

Readme

VSCode Lint

author version node npm test build coverage license

vscode-lint是一个集成StylelintEslint的VSCode配置工具,提供html/css/scss/less/js/ts/jsx/tsx/vue文件的代码校验功能

vscode-lint用于约束团队成员的编码规范编码风格,从而增加项目代码的可维护性可接入性,保障项目整体质量,可减少无用代码重复代码错误代码漏洞代码的产生几率。它的根本目的是一次部署全局运行,统一所有项目的编码规范编码风格,养成规范的码字习惯,减少不必要的错误与隐患。

vscode-lint依赖以下NPM模块的最新版本。

postcss babel typescript stylelint eslint eslint

为了方便表述,统一以下名词。

  • 以下提及的StylelintEslint都为VSCode插件
  • 以下提及的stylelinteslint都为NPM模块

安装

npm i -g vscode-lint

安装失败

  • 切换NPM镜像为淘宝镜像:npm config set registry https://registry.npmmirror.com/
  • 重新执行安装命令:npm i -g vscode-lint

配置

  • 打开VSCode
  • 选择左边工具栏插件,搜索并安装StylelintEslint,安装完毕重启VSCode
  • 选择文件→首选项→设置设置中可选用户工作区
    • 用户:配置生效后会作用于全局项目(若大部分项目都是单一的React应用或Vue应用推荐使用全局配置)
    • 工作区:配置生效后只会作用于当前打开项目
  • 点击设置右上角中间图标打开设置(json),打开的对应文件是settings.json
  • 插入以下配置并重启VSCode:为了保障每次修改完毕都能正常格式化代码,必须重启VSCode
{
	// 默认自定义配置
	"css.validate": false,
	"less.validate": false,
	"scss.validate": false,
	"editor.codeActionsOnSave": {
		"source.fixAll.eslint": true,
		"source.fixAll.stylelint": true
	},
	// 扩展自定义配置
	"eslint.nodePath": "path/vscode-lint/node_modules",
	"eslint.options": {
		"overrideConfigFile": "path/vscode-lint/eslint/eslintrc.js" // 可变⚠️
	},
	"stylelint.configBasedir": "path/vscode-lint",
	"stylelint.configFile": "path/vscode-lint/stylelint/stylelintrc.js",
	"stylelint.customSyntax": "postcss-html", // 可变⚠️
	"stylelint.stylelintPath": "path/vscode-lint/node_modules/stylelint",
	"stylelint.validate": ["html", "css", "scss", "less", "vue"]
}

以上配置的pathvscode-lint模块所在的NPM根目录,可执行npm config get prefix获取NPM根目录并替换path

  • 执行npm config get prefix获取的NPM根目录,例如是E:/Node/prefix/node_modules
  • 将上述配置的path替换为E:/Node/prefix/node_modules

请保持VSCode及其所有插件都为最新版本,防止因版本问题导致StylelintEslint失效。

结构

请根据项目自行选择以下配置文件。

Stylelint

校验不同类型代码需实时修改stylelint.customSyntax的值。

  • [x] CSS/SCSSpostcss-scss
  • [x] LESSpostcss-less
  • [x] HTML/VUEpostcss-html

Eslint

校验不同类型代码需实时修改eslint.options.overrideConfigFile的值。

  • [x] JSpath/vscode-lint/eslint/eslintrc.js
  • [x] Reactpath/vscode-lint/eslint/eslintrc.react.js
  • [x] Vuepath/vscode-lint/eslint/eslintrc.vue.js
  • [x] TSpath/vscode-lint/tslint/tslintrc.js
  • [x] React TSpath/vscode-lint/tslint/tslintrc.react.js
  • [x] Vue TSpath/vscode-lint/tslint/tslintrc.vue.js

疑问

更新eslint到v6+就会失效

很多同学反映eslint 6+VSCode上失效,最高使用版本只能控制在v5.16.0。其实这本身就是配置问题,跟版本无关。本项目的eslint使用v8,只要配置正确就能正常使用。

上述安装行为使用了NPM,那么settings.jsoneslint.packageManager必须配置为npm(小写),但最新版本Eslint已默认此项,所以无需配置。若上述安装行为变成yarn global add vscode-lint,那么必须在settings.json中添加以下配置。

{
	"eslint.packageManager": "yarn"
}
首次安装Eslint并执行上述配置就会失效

首次安装Eslint可能会在js/ts/jsx/tsx/vue文件的控制台中看到以下警告。

Eslint is disabled since its execution has not been approved or denied yet. Use the light bulb menu to open the approval dialog.

说明Eslint被禁用了,虽然配置中无明确的禁用字段,但还是被禁用了。此时移步到VSCode右下角的工具栏,会看到禁用图标+ESLINT的标红按钮,单击它就会弹出一个弹框,选择Allow Everywhere就能启用Eslint的校验功能了。

版权

MIT © JowayYoung

后记

关注公众号IQ前端,一个专注于CSS/JS开发技巧的前端公众号,更多前端小干货等着你喔

IQ前端