Coder Social home page Coder Social logo

baidu-fe-code-style's Introduction

Baidu-FE-Code-Style

Baidu FE Code Style 是一个基于fecs开发的 Sublime Text 2/3 和 WebStorm 插件,目的是方便的验证所写的代码是否符合 百度前端编码规范 的要求

Sublime Text 2/3

安装

手工安装

  1. git clone https://github.com/leeight/Baidu-FE-Code-Style.git
  2. 把 'Baidu FE Code Style' 目录放到
    1. OS X: ~/Library/Application Support/Sublime Text 2/Packages
    2. Windows: %APPDATA%\Sublime Text 2\Packages
    3. Linux: ~/.config/sublime-text-2/Packages

通过Package Control安装

输入Baidu FE Code Style来进行查询,查询之后安装即可

配置

安装完毕之后,因为 Sublime 无法读取系统的PATH环境变量,所以初次使用需要配置一下相关的路径:

fecs-config.png

主要配置的内容如下(按照自己系统上的路径填写即可):

{
  "env": {
    "fecs_bin": "/usr/local/bin/fecs",
    "node_bin": "/usr/local/bin/node"
  }
}

使用

当打开一个js文件开始编辑,保存之后会自动调用fecs对当前的文件进行验证,如果有 warning 的话,会显示在左侧:

fecs-show.png

点击圆点之后,具体的 warning 信息会显示在底部的状态栏,如果错误信息太多,状态栏显示不全的话,可以通过Ctrl + ~调用 Sublime Text 的 Console,里面有更详细的信息。

WebStorm

安装

WebStorm默认集成了jscs的插件,我们只需要修改一下配置即可使用,首先需要通过npm i -g fecs来确保系统中已经安装了fecs,然后修改jscs的配置:

webstorm-config.png

主要是修改JSCS Package的路径。另外Configuration fileCode style preset可以随便选择,我们是用不到的(直接忽略了)

使用

配置之后就可以直接使用了,保存之后就会自动验证,效果如下:

webstorm-result.png

baidu-fe-code-style's People

Contributors

chestnutchen avatar leeight avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.