xyz-data / DVA

DVA: shit & bugs
MIT License
0 stars 0 forks source link

precommit & eslint & git commit error #1

Open xyzdata opened 6 years ago

xyzdata commented 6 years ago

precommit & eslint

github git commit error

eslint error => git commit error


"precommit": "npm run lint",
xyzdata commented 6 years ago
// 菜单管理
const MENU_CHECK = 'MENU_CHECK';
const MENU_ADD = 'MENU_ADD';

const MENU_MODEFY = 'MENU_MODEFY';
const MENU_ASSOCIATE = 'MENU_ASSOCIATE';

const OBJ_CONSTANTS = Object.assign({}, {
    MENU_CHECK,
    MENU_ADD,

    MENU_MODEFY,
    MENU_ASSOCIATE
});

// OBJ_CONSTANTS.MENU_CHECK;

export default OBJ_CONSTANTS;
xgqfrms-GitHub commented 6 years ago

Getting Start

ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code
with the goal of making code more consistent and avoiding bugs
In many ways, it is similar to JSLint and JSHint with a few exceptions:

Usage

$ eslint --init  
$ eslint test1.js test2.js  

Configuration

In .eslintrc.*:

{  
    "env": {  
        "node": true,  
        "es6": true  
    },  
    "extends": "eslint:recommended",  
    "rules": {  
        "indent": [  
            "error",  
            4  
        ],  
        "linebreak-style": [  
            "error",  
            "windows"  
        ],  
        "quotes": [  
            "warn",  
            "double"  
        ],  
        "semi": [  
            "error",  
            "always"  
        ]
    }
}  

ESLint will not lint your code unless you extend from a shared configuration or explicitly turn rules on in your configuration
find eslint config file
find configuration list

入门

ESLint 主要有以下特点:

配置

三种方式:

工作流集成

ESLint 可以集成到主流的编辑器和构建工具中, 以便我们在编写的代码的同时进行 lint.

自定义规则

在 NPM 上以 eslintplugin 为关键词, 可以搜索到很多插件: