1.0.3 • Published 6 years ago

eslint-config-lagou v1.0.3

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

eslint-config-lagou

A simple configuration based on configuring eSlint

Default configs

{
    'env': {
        'browser': true,
        'amd': true,
        'commonjs': true,
        'es6': true,
        'worker': true,
        'jquery': true
    },
    'rules': rules
}

Rules

The following is introduce of rules:

Spaces

Syntax

  • [error: for-direction] 禁止for无限循环
  • [error: no-await-in-loop] 禁止循环语句中用await
  • [error: no-prototype-builtins] 禁止实例对象上直接调用Object.prototype下的内置属性(方法)
  • [error: default-case] switch语句必须有default分支
  • [error: eqeqeq] “===、!==”代替“==、!=”
  • [error: no-loop-func] 禁止循环中定义函数
  • [error: no-unmodified-loop-condition] 禁止错误的循环语句,条件值在循环途中并未改变导致无限循环
  • [error: require-await] async函数必须有await语句
  • warn: wrap-iife IIFE需括号包裹函数部分
  • [error: semi] 语句末尾必须添加分号(ASI)
  • [error: guard-for-in] for-in语句中必须有if语句
  • [error: no-unused-vars] 禁止存在未使用过的变量(函数),除了函数参数为“require,exports,module”

Deprecated or not recommend

  • [error: no-caller] 禁止arguments.caller或arguments.callee
  • warn: no-eval 禁止eval语句
  • [error: no-with] 禁止with语句
  • [error: no-restricted-globals] 禁止使用全局变量event、undefined

Others

  • warn: no-extend-native 禁止扩展原生类型
  • [error: no-new-wrappers] 禁止基本类型用new方式声明
  • warn: no-param-reassign 禁止对函数参数再次赋值
  • warn: no-magic-numbers 禁止使用魔术数字,即必须单独以一个变量来声明数字,不可直接用数字作运算
  • [error: no-throw-literal] 禁止抛出非error对象
  • [error: prefer-promise-reject-errors] 禁止非error对象作为Promise.reject的返回值
  • warn: no-use-before-define 禁止变量(函数)定义之前使用它们
  • [error: eol-last] 强制文件结尾必须有空行
  • [error: arrow-body-style] 当箭头函数的花括号不可省略时必须要有
  • warn: arrow-parens 箭头函数的参数只有一个可省略圆括号
  • [error: new-cap] 构造函数首字母大写
  • warn: no-useless-escape 禁止不必要的转义
  • warn: no-control-regex 禁止正则中使用控制字符(ASCII码中0-31的不可见字符)
1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago