From fb0f03f676aa604198d9a3f8f9903fd3c1ac68e9 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 12 Aug 2016 15:36:56 -0700 Subject: [PATCH] [eslint config] [base] [deps] update `eslint`, `eslint-plugin-import` - add temp disabled `func-call-spacing` rule - add temp disabled `no-template-curly-in-string` rule - enable `no-global-assign` and deprecate `no-native-reassign` - enable `no-unsafe-negation` and deprecate `no-negated-in-lhs` - add disabled `sort-keys` rule --- packages/eslint-config-airbnb-base/package.json | 8 ++++---- .../rules/best-practices.js | 7 ++++++- packages/eslint-config-airbnb-base/rules/errors.js | 12 +++++++++++- packages/eslint-config-airbnb-base/rules/style.js | 8 ++++++++ 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/packages/eslint-config-airbnb-base/package.json b/packages/eslint-config-airbnb-base/package.json index bda0880e..93aeba1e 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -47,16 +47,16 @@ "devDependencies": { "babel-preset-airbnb": "^2.0.0", "babel-tape-runner": "^2.0.1", - "eslint": "^3.2.2", + "eslint": "^3.3.0", "eslint-find-rules": "^1.13.0", - "eslint-plugin-import": "^1.12.0", + "eslint-plugin-import": "^1.13.0", "in-publish": "^2.0.0", "safe-publish-latest": "^1.0.1", "tape": "^4.6.0" }, "peerDependencies": { - "eslint": "^3.2.2", - "eslint-plugin-import": "^1.12.0" + "eslint": "^3.3.0", + "eslint-plugin-import": "^1.13.0" }, "engines": { "node": ">= 4" diff --git a/packages/eslint-config-airbnb-base/rules/best-practices.js b/packages/eslint-config-airbnb-base/rules/best-practices.js index 838ae713..f4c46eab 100644 --- a/packages/eslint-config-airbnb-base/rules/best-practices.js +++ b/packages/eslint-config-airbnb-base/rules/best-practices.js @@ -89,6 +89,10 @@ module.exports = { // disallow the use of leading or trailing decimal points in numeric literals 'no-floating-decimal': 2, + // disallow reassignments of native objects or read-only globals + // http://eslint.org/docs/rules/no-global-assign + 'no-global-assign': [2, { exceptions: [] }], + // disallow implicit type conversions // http://eslint.org/docs/rules/no-implicit-coercion 'no-implicit-coercion': [0, { @@ -136,7 +140,8 @@ module.exports = { 'no-multi-str': 2, // disallow reassignments of native objects - 'no-native-reassign': 2, + // TODO: deprecated in favor of no-global-assign + 'no-native-reassign': 0, // disallow use of new operator when not part of the assignment or comparison 'no-new': 2, diff --git a/packages/eslint-config-airbnb-base/rules/errors.js b/packages/eslint-config-airbnb-base/rules/errors.js index 7221cd16..66396cd5 100644 --- a/packages/eslint-config-airbnb-base/rules/errors.js +++ b/packages/eslint-config-airbnb-base/rules/errors.js @@ -64,7 +64,8 @@ module.exports = { 'no-irregular-whitespace': 2, // disallow negation of the left operand of an in expression - 'no-negated-in-lhs': 2, + // TODO: deprecated in favor of no-unsafe-negation + 'no-negated-in-lhs': 0, // disallow the use of object properties of the global object (Math and JSON) as functions 'no-obj-calls': 2, @@ -79,6 +80,11 @@ module.exports = { // disallow sparse arrays 'no-sparse-arrays': 2, + // Disallow template literal placeholder syntax in regular strings + // http://eslint.org/docs/rules/no-template-curly-in-string + // TODO: enable, semver-major + 'no-template-curly-in-string': 0, + // Avoid code that looks like two expressions but is actually one // http://eslint.org/docs/rules/no-unexpected-multiline 'no-unexpected-multiline': 2, @@ -90,6 +96,10 @@ module.exports = { // http://eslint.org/docs/rules/no-unsafe-finally 'no-unsafe-finally': 2, + // disallow negating the left operand of relational operators + // http://eslint.org/docs/rules/no-unsafe-negation + 'no-unsafe-negation': 2, + // disallow comparisons with the value NaN 'use-isnan': 2, diff --git a/packages/eslint-config-airbnb-base/rules/style.js b/packages/eslint-config-airbnb-base/rules/style.js index dd21a4ae..5d8825aa 100644 --- a/packages/eslint-config-airbnb-base/rules/style.js +++ b/packages/eslint-config-airbnb-base/rules/style.js @@ -28,6 +28,11 @@ module.exports = { // enforce newline at the end of file, with no multiple empty lines 'eol-last': 2, + // enforce spacing between functions and their invocations + // http://eslint.org/docs/rules/func-call-spacing + // TODO: enable, semver-minor + 'func-call-spacing': [0, 'never'], + // require function expressions to have a name 'func-names': 1, @@ -264,6 +269,9 @@ module.exports = { // enforce spacing before and after semicolons 'semi-spacing': [2, { before: false, after: true }], + // requires object keys to be sorted + 'sort-keys': [0, 'asc', { caseSensitive: false, natural: true }], + // sort variables within the same declaration block 'sort-vars': 0,