const obj = { id: 5, name: 'San Francisco', [getKey('enabled')]: true }; 请使用对象方法的简写方式,eslint: object-shorthand...const item = { value: 1, addValue (val) { return item.value + val } } 请使用对象属性值的简写方式,eslint: object-shorthand
prefer-template': 0, 'no-useless-concat': 2, 'no-multi-str': 2, 'no-new-object': 2, 'object-shorthand
eslint: object-shorthand jscs: requireEnhancedObjectLiterals // bad const atom = { value: 1,...eslint: object-shorthand jscs: requireEnhancedObjectLiterals const lukeSkywalker = 'Luke Skywalker';
const obj = { id: 5, name: 'San Francisco', [getKey('enabled')]: true, }; 3.3 用对象方法简写. eslint: object-shorthand...value: 1, // 对象的方法 addValue(value) { return atom.value + value; }, }; 3.4 用属性值缩写. eslint: object-shorthand
block-scoped-var': 2, // 块语句中使用var 'no-dupe-class-members': 2, // 'no-var': 1, // 禁用var,用let和const代替 'object-shorthand
no-useless-computed-key 禁止在对象中使用不必要的计算属性 no-useless-constructor 禁用不必要的构造函数 no-useless-ren 要求使用 let 或 const 而不是 var object-shorthand
prefer-const': 'error', // 建议使用const 'no-const-assign': 'error', // 禁止修改使用const(no-const-assign)声明的变量 'object-shorthand
时必须加小括号 "newline-after-var": 2,//变量声明后是否需要空一行 "object-curly-spacing": [0, "never"],//大括号内是否允许不必要的空格 "object-shorthand
时必须加小括号 “newline-after-var”: 2,//变量声明后是否需要空一行 “object-curly-spacing”: [0, “never”],//大括号内是否允许不必要的空格 “object-shorthand
warn, error no-console: 表示禁止调用console对象的方法 func-names: 禁止命名的 function 表达式 no-unused-vars: 表示禁止未使用的变量 object-shorthand..., "rules": { "no-console": "off", "func-names": "off", "no-unused-vars": "warn", "object-shorthand
120], // 单行代码最大长度 'guard-for-in': 0, // 禁用 禁用for in 循环 'no-shadow': 0, // 禁用 禁止页面内相容参数名 'object-shorthand
时必须加小括号 "newline-after-var": 2,//变量声明后是否需要空一行 "object-curly-spacing": [0, "never"],//大括号内是否允许不必要的空格 "object-shorthand...* @category ECMAScript 6 * @reason 没必要强制要求 * @fixable */ 'object-shorthand
领取专属 10元无门槛券
手把手带您无忧上云