Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cilint

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cilint

Commit lint for Git

  • 0.0.21
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-70.83%
Maintainers
2
Weekly downloads
 
Created
Source

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下

[CHANGELOG](CHANGELOG.md) [LICENSE](LICENSE)

Keywords

FAQs

Package last updated on 22 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc