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 🙏

© 2024 – Pkg Stats / Ryan Hefner

code-lint-master

v1.2.0

Published

一个基于 eslint、stylelint 的代码规范检测工具

Downloads

11

Readme

code-lint

一个基于 eslint、stylelint 的代码规范检测工具

:star: 特性

  • 基于 eslint 进行 js 代码规范检测
  • 基于 stylelint 进行 css 代码规范检测
  • 基于 stylelint-scss 对 scss 代码更加友好的规范检测
  • 定向检测文件
  • localdiff 检测文件(基于 git)

js 代码检测仅包含后缀为 .html、.vue、.js 的文件,而 css 代码检测仅包含后缀为 .html、.vue、.css、.scss、less。

:rocket: 使用指南

通过 npm 下载安装

npm install code-lint --save-dev

定向检测

检测配置文件中配置的文件

  • 在根目录 package.json 文件中加入检测命令
"scripts": {
  "lint": "code-lint"
}
  • 在根目录中加入配置文件,文件名为 lint.config.json,文件格式示例内容如下
{
  "lintTargetFiles": [
    "**/*.html",
    "**/*.vue",
    "**/*.js",
    "**/*.css",
    "**/*.scss",
    "**/*.less"
  ]
}

lintTargetFiles 为检测目标文件,使用 glob 语法。

  • 运行检测命令检测
npm run lint

localdiff 检测

只检测本地 diff 的文件(包含 untracked 文件)。diff 检测允许没有配置文件 lint.config.json。

  • 在根目录 package.json 文件中加入检测命令
"scripts": {
  "lint-localdiff": "code-lint --localdviff"
}
  • 运行检测命令检测
npm run lint-localdiff

检测规则

js 检测规则继承 eslint-config-standard 中的规则,并可根据配置文件中 eslint.rules 参数添加检测规则。

css 检测规则继承 stylelint-config-standard 中的规则,可根据配置文件中 stylelint.rules 参数添加检测规则。

其它说明

lint.config.json 配置文件中,除了 lintTargetFiles 参数外,还可以通过配置其它参数决定仅检测 js 或者 css 以及添加自己的检测规则,详见下述默认配置文档(default.config.js)。

:bookmark_tabs: 文档

默认配置:default.config.js

js 检测默认忽略文件:eslintignore.js

css 检测默认忽略文件:stylelintignore.js

:gear: 更新日志

CHANGELOG.md

:airplane: 计划列表

TODO.md