eslint-config-tuia

1.0.2 • Public • Published

部分注释

module.exports = {
  "extends": ["standard"],
  // standard文档 https://github.com/standard/standard/blob/master/docs/RULES-zhcn.md
  "env": {
    "node": true,
    "browser": true,
    "es6": true,
    "mocha": true
  },
 
  "plugins": [
    "react"
  ],
 
  "parser": "babel-eslint",
 
  "parserOptions": {
    "ecmaVersion": 6,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true,
      "modules": true,
      "arrowFunctions": true,
      "binaryLiterals": true,
      "blockBindings": true,
      "classes": true,
      "defaultParams": true,
      "destructuring": true,
      "forOf": true,
      "generators": true,
      "objectLiteralComputedProperties": true,
      "objectLiteralDuplicateProperties": true,
      "objectLiteralShorthandMethods": true,
      "objectLiteralShorthandProperties": true,
      "octalLiterals": true,
      "regexUFlag": true,
      "regexYFlag": true,
      "restParams": true,
      "spread": true,
      "superInFunctions": true,
      "templateStrings": true,
      "unicodeCodePointEscapes": true,
      "globalReturn": true,
      "experimentalObjectRestSpread": true
    }
  },
 
  "rules": {
    "no-tabs": 0,
    "promise/param-names": 0,
    "standard/no-callback-literal": 0,
    "no-mixed-operators": 0,
    "no-useless-constructor": 0, //禁止多余的构造器
    "no-useless-escape": 0, //禁止不必要的转译
    "prefer-const": 0, //不被重新定义的情况下,使用const
    "no-class-assign": 0, //避免对类名重新赋值。
    "no-case-declarations": 0,
    "prefer-promise-reject-errors": 0,
    "lines-between-class-members": 2,
    "spaced-comment": 0,
 
 
 
    // "comma-dangle": [2, "never"], //不允许有多余的行末逗号。
    "no-cond-assign": 0, //条件语句中赋值语句使用括号包起来。
    "no-console": 0,
    "no-constant-condition": 0, //避免使用常量作为条件表达式的条件(循环语句除外)
    "no-control-regex": 0, //正则中不要使用控制符
    // "no-debugger": 2,
    // "no-dupe-args": 2,//不要定义冗余的函数参数。
    // "no-dupe-keys": 2,//对象字面量中不要定义重复的属性。
    // "no-duplicate-case": 2,//switch 语句中不要定义重复的 case 分支
    "no-empty-character-class": 1, //正则中不要使用空字符
    "no-empty": 0,
    "no-ex-assign": 1, //catch 中不要对错误重新赋值。
    "no-extra-boolean-cast": 0, //避免不必要的布尔转换。
    "no-extra-parens": [1, "functions"], //不要使用多余的括号包裹函数。
    "no-extra-semi": 1, //不要使用多余的分号
    // "no-func-assign": 2,//避免对声明过的函数重新赋值。
    "no-inner-declarations": 0, //嵌套的代码块中禁止再定义函数
    // "no-invalid-regexp": 2,
    // "no-irregular-whitespace": 2,
    // "no-negated-in-lhs": 2,
    // "no-obj-calls": 2,//不要将全局对象的属性作为函数调用。
    // "no-regex-spaces": 2,//正则中避免使用多个空格
    // "no-sparse-arrays": 2,//禁止使用稀疏数组(Sparse arrays)。
    "no-unexpected-multiline": 0,
    // "no-unreachable": 2,//return,throw,continue 和 break 后不要再跟代码。
    // "use-isnan": 2,//检查 NaN 的正确姿势是使用 isNaN()
    // "valid-jsdoc": 0,
    // "valid-typeof": 2,//用合法的字符串跟 typeof 进行比较操作。
 
    "accessor-pairs": [1, {
      "setWithoutGet": true
    }], //对象中定义了存值器,一定要对应的定义取值器。
    // "block-scoped-var": 0,// 禁用var,此条无意义
    // "complexity": 0,
    // "consistent-return": 0,
    // "curly": [2, "multi-line"],//多行 if 语句的的括号不能省。
    "default-case": 0,
    "dot-notation": 0,
    "dot-location": 0,
    "eqeqeq": [0, "allow-null"],
    "guard-for-in": 0,
    "no-alert": 0,
    // "no-caller": 2, //避免使用 arguments.callee 和 arguments.caller
    "no-div-regex": 0,
    "no-else-return": 0,
    "no-eq-null": 0,
    // "no-eval": 2, //不要使用 eval()。
    "no-extend-native": 1,
    "no-extra-bind": 1,
    "no-fallthrough": 1,
    // "no-floating-decimal": 2,//不要省去小数点前面的0。
    "no-implicit-coercion": 0,
    // "no-implied-eval": 2,//注意隐式的 eval()
    "no-invalid-this": 0,
    "no-iterator": 0,
    "no-labels": [2, {
      "allowLoop": true,
      "allowSwitch": true
    }], //不要使用标签语句。
    "no-lone-blocks": 1,
    "no-loop-func": 0,
    "no-magic-numbers": 0,
    "no-multi-spaces": 0,
    "no-multi-str": 0,
    // "no-new-func": 2,//禁止使用 Function 构造器
    "no-new-wrappers": 1,
    "no-new": 0,
    "no-octal-escape": 1,
    "no-octal": 1,
    "no-param-reassign": 0,
    "no-process-env": 0,
    // "no-proto": 2,//使用 getPrototypeOf 来替代 __proto__
    "no-redeclare": 0,
    "no-return-assign": 0,
    "no-script-url": 0,
    "no-self-compare": 1,
    // "no-sequences": 1,
    "no-throw-literal": 0,
    "no-unused-expressions": 0,
    "no-useless-call": 1,
    "no-useless-concat": 1,
    "no-void": 0,
    "no-warning-comments": 0,
    // "no-with": 2,//禁止使用 with
    "radix": 2, //使用parseInt时,需要指定进制
    "vars-on-top": 0,
    "wrap-iife": 0,
    "yoda": 0,
 
    "strict": 0,
 
    "init-declarations": 0,
    "no-catch-shadow": 0,
    // "no-delete-var": 2,//不要对变量使用 delete 操作
    "no-label-var": 1,
    // "no-shadow-restricted-names": 2,//不要随意更改关键字的值
    "no-shadow": 0,
    "no-undef-init": 0,
    // "no-undef": 2, //使用浏览器全局变量时加上 window. 前缀。document、console 和 navigator 除外
    "no-undefined": 0,
    "no-unused-vars": [2, {
      "vars": "all",
      "args": "after-used"
    }], //不要定义未使用的变量。
    "no-use-before-define": 0,
 
    "callback-return": 0,
    "global-require": 0,
    "handle-callback-err": 0,
    "no-mixed-requires": 0,
    "no-new-require": 0,
    "no-path-concat": 0,
    "no-process-exit": 0,
    "no-restricted-modules": 0,
    "no-sync": 0,
 
    "array-bracket-spacing": 2, // []第一项和最后一项与数组的两个括号之间没有空格
    "block-spacing": 0,
    "brace-style": [1, "1tbs", {
      "allowSingleLine": true
    }],
    "camelcase": [1, {
      "properties": "never"
    }],
    "comma-spacing": [1, {
      "before": false,
      "after": true
    }],
    "comma-style": [1, "last"],
    "computed-property-spacing": [1, "never"],
    "consistent-this": [1, "_this"],
    "eol-last": 0,
    "func-names": 0,
    "func-style": [0, "declaration"],
    "id-length": 0,
    "id-match": 0,
    "indent": [1, 2, {
      "SwitchCase": 1
    }],
    "jsx-quotes": 0,
    // "key-spacing": [2, {
    // "beforeColon": false,
    // "afterColon": true
    // }],//键值对当中冒号与值之间要留空白
    "linebreak-style": [0, "unix"],
    "lines-around-comment": 0,
    "max-nested-callbacks": 0,
    "new-cap": 1,
    // "new-parens": 2,//无参的构造函数调用时要带上括号。
    "newline-after-var": 0,
    // "no-array-constructor": 2,//使用数组字面量而不是构造器
    "no-continue": 0,
    // "no-inline-comments": 1,
    "no-lonely-if": 0,
    "no-mixed-spaces-and-tabs": 2, //不要混合使用空格与制表符作为缩进
    // "no-multiple-empty-lines": [2, {
    //   "max": 2
    // }],// 不要有连续多个空行
    "no-negated-condition": 0,
    "no-nested-ternary": 0,
    // "no-new-object": 2,//禁止使用 Object 构造器
    "no-restricted-syntax": 0,
    "no-ternary": 0,
    "no-trailing-spaces": [1, {
      "skipBlankLines": true
    }],
    "no-underscore-dangle": 0,
    // "no-unneeded-ternary": 1,
    "object-curly-spacing": 0,
    "one-var": [0, "never"],
    "operator-assignment": [1, "always"],
    "operator-linebreak": 0,
    "padded-blocks": 0,
    "quote-props": [0, "as-needed"],
    // "quotes": [2, "single", "avoid-escape"],//除需要转义的情况外,字符串统一使用单引号
    "require-jsdoc": 0,
    "semi-spacing": [1, {
      "before": false,
      "after": true
    }],
    "semi": 0,
    "sort-vars": 0,
    "space-before-blocks": [2, "always"],
    "space-before-function-paren": [1, {
      "anonymous": "never",
      "named": "never"
    }],
    // "keyword-spacing": [2, {
    // "before": true,
    // "after": true
    // }],//关键字后面加空格
    // "space-in-parens": [2, "never"],//圆括号间不留空格
    // "space-infix-ops": [2, {
    // "int32Hint": false
    // }],//字符串拼接操作符 (Infix operators) 之间要留空格
    "space-unary-ops": [1, {
      "words": true,
      "nonwords": false
    }],
    // "spaced-comment": [1, always],
    "wrap-regex": 0,
 
    "arrow-spacing": [1, {
      "before": true,
      "after": true
    }],
    // "no-const-assign": 2,//避免修改使用 const 声明的变量。
    // "no-this-before-super": 2,//使用 this 前请确保 super() 已调用
 
    "react/jsx-uses-vars": 2, //不要在jsx中不使用React
    "react/jsx-uses-react": 2 //不要在jsx中不使用一个已有的变量
  },
 
  "globals": {
    "$": true,
    "jQuery": true
  }
}

Readme

Keywords

Package Sidebar

Install

npm i eslint-config-tuia

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

18.9 kB

Total Files

3

Last publish

Collaborators

  • chao.zhou