https://github.com/ecomfe/fecs
Front End Code Style Suite
https://github.com/ecomfe/fecs
Last synced: 11 months ago
JSON representation
Front End Code Style Suite
- Host: GitHub
- URL: https://github.com/ecomfe/fecs
- Owner: ecomfe
- Created: 2014-09-28T15:57:39.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2020-12-24T13:30:24.000Z (over 5 years ago)
- Last Synced: 2025-06-26T02:09:03.121Z (about 1 year ago)
- Language: JavaScript
- Homepage: http://fecs.baidu.com/
- Size: 3.64 MB
- Stars: 640
- Watchers: 46
- Forks: 111
- Open Issues: 56
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
FECS
==========
FECS 是基于 Node.js 的前端代码风格工具。
[](http://travis-ci.org/ecomfe/fecs)
[](https://ci.appveyor.com/project/chriswong/fecs)
[](https://www.npmjs.com/package/fecs)
[](https://coveralls.io/r/ecomfe/fecs)
[](https://david-dm.org/ecomfe/fecs)
[](https://david-dm.org/ecomfe/fecs) [](https://greenkeeper.io/)
### 安装
```
$ [sudo] npm install fecs -g
```
### 使用
```
fecs
fecs -v
fecs check --help
fecs format --help
```
更多参数见 wiki: [CLI](https://github.com/ecomfe/fecs/wiki/CLI)
### API
#### fecs.leadName
设置或获取控制台输出信息前的名称,默认值为 `fecs`。
```javascript
var fecs = require('fecs');
fecs.leadName = 'edp';
...
```
#### fecs.getOptions(Array argv)
获取经 `minimist` 解释后的命令行参数对象,可用于 `fecs.check` 和 `fecs.format` 方法。
```javascript
var options = fecs.getOptions(process.argv.slice(2));
console.log(options.command); // 'check'
...
```
#### fecs.check(Object options[, Function done])
检查文件或输入流的代码规范。
```javascript
// 设置检查的文件路径
options._ = ['/path/to/check'];
// 或者设置为 stream
// options.stream = yourReadableStream;
// 设置文件类型
// options.type = 'js,css';
/**
* callback after check finish
*
* @param {boolean} success true as all files ok, or false.
* @param {Object[]} errors data for check result.
*/
function done(success, errors) {
// blablabla
}
fecs.check(options, done);
```
#### fecs.format(Object options)
格式化、修复文件或输入流的代码。
```javascript
fecs.check(options);
```
### 工具支持
- [x] [VIM](https://github.com/hushicai/fecs.vim)
- [x] [WebStorm](https://github.com/leeight/Baidu-FE-Code-Style#webstorm)
- [x] [Eclipse](https://github.com/ecomfe/fecs-eclipse)
- [x] Sublime Text 2/3 [Baidu FE Code Style](https://github.com/leeight/Baidu-FE-Code-Style) [Sublime Helper](https://github.com/baidu-lbs-opn-fe/Sublime-fecsHelper) [SublimeLinter-contrib-fecs](https://github.com/robbenmu/SublimeLinter-contrib-fecs)
- [x] Visual Studio Code [fecs-visual-studio-code](https://github.com/21paradox/fecs-visual-studio-code) [vscode-fecs(中文)](https://github.com/MarxJiao/VScode-fecs)
- [x] [Atom](https://github.com/8427003/atom-fecs)
- [x] [Emacs](https://github.com/Niandalu/flycheck-fecs)
- [x] [Grunt](https://github.com/ecomfe/fecs-grunt)
- [x] [Gulp](https://github.com/ecomfe/fecs-gulp)
- [x] [Git Hook](https://github.com/cxtom/fecs-git-hooks)
### 常见问题
-
-
更多信息请访问