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

cilint

v0.0.21

Published

Commit lint for Git

Downloads

59

Readme

NPM version

CILint

CILint是一个团队开发代码检查工具,进行检查时只关注新增行.

  • 使用ESLint检查javascript的语法
  • 使用Git的Hook在团队中推行

Installation and Usage

可以本地安装和全局安装

本地安装

npm install cilint --save-dev

初始化配置:

./node_modules/.bin/cilint --init

初始化配置的工作包括:

  • 生成.cilintrc.js
  • 生成.eslintrc.js
  • .git/hooks注入pre-commit的钩子

之后你可以对任意文件或者目录运行CILint:

./node_modules/.bin/cilint yourfile.js

git commit.git/hooks/pre-commit将自动执行, 存在error时将阻止本次提交并提示错误

全局安装

如果你希望在多个项目中使用,我们推荐你使用全局安装:

npm install -g cilint

生成配置文件:

cilint --init

运行CILint:

cilint yourfile.js

团队规范执行

1、在package.json中声明CILint的依赖:

{
  "devDependencies": {
    "cilint": "*"
  }
}

2、在构建文件webpack.config.jsgulpfile.jsfis-conf.js中引入如下代码执行init:

// 等同于`cilint --init`
require('cilint').initializer({
    // override: true,
    // cilintrcUrl: 'https://raw.githubusercontent.com/feix760/cilint/master/conf/cilintrc.js',
    // eslintrcUrl: 'https://raw.githubusercontent.com/feix760/cilint/master/conf/eslintrc.js',
    // editorconfigUrl: 'https://raw.githubusercontent.com/feix760/cilint/master/conf/editorconfig',
});

Configuring

.cilintrc.js配置

  • stopCommit Boolean default true 存在error时是否阻止commit
  • ignore Array.<String> default [] 代码检查忽略列表

.eslintrc.js配置

参考http://eslint.org/docs/user-guide/configuring

API

cilint.initializer(options)

初始化执行函数

Arguments

  • options Object
  • options.override Boolean 可选 default false 是否覆盖.cilintrc.js,.eslintrc.js等文件
  • options.cilintrc Object 可选 cilintrc配置项
  • options.cilintrcUrl String 可选 从指定url拉取cilintrc配置项, 可以结合override = true使用
  • options.eslintrc Object 可选 eslintrc配置项
  • options.eslintrcUrl String 可选 从指定url拉取eslintrc配置项
  • options.editorconfigUrl String 可选 从指定url拉取editorconfig配置项

ESLint Rules

FAQ

CILint如何选择ESLint的?

CILint首先会以项目根目录require ESLint, 这有可能会require到项目下的node_modules/eslint或者全局的eslint, 如果没有将使用CILint/node_modules/ESLint

注意:

  • ESLint和它的插件必须在同级node_modules下, 例如如果使用了全局的ESLint所有插件也必须全局安装
  • 如果使用CILint下的ESLint部分插件并没有在CILint下