From de3bd19e240688e0295fc3196d77278e90f5aabb Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 21 Jan 2017 02:04:02 -0800 Subject: [PATCH] [Breaking] drop node < 4 support. Also, require template literals instead of concatenation, and auto fix. --- .eslintrc | 17 ++++++---- .travis.yml | 4 --- docs/rules/forbid-elements.md | 6 ++-- index.js | 2 +- lib/rules/forbid-component-props.js | 2 +- lib/rules/forbid-elements.js | 4 +-- lib/rules/forbid-foreign-prop-types.js | 4 +-- lib/rules/forbid-prop-types.js | 2 +- lib/rules/jsx-closing-bracket-location.js | 5 ++- lib/rules/jsx-curly-spacing.js | 12 +++---- lib/rules/jsx-filename-extension.js | 2 +- lib/rules/jsx-handler-names.js | 9 +++-- lib/rules/jsx-indent-props.js | 4 +-- lib/rules/jsx-indent.js | 4 +-- lib/rules/jsx-max-props-per-line.js | 2 +- lib/rules/jsx-no-undef.js | 2 +- lib/rules/jsx-pascal-case.js | 2 +- lib/rules/jsx-wrap-multilines.js | 2 +- lib/rules/no-children-prop.js | 4 +-- lib/rules/no-danger-with-children.js | 9 +++-- lib/rules/no-deprecated.js | 34 +++++++++---------- lib/rules/no-render-return-value.js | 2 +- lib/rules/no-unused-prop-types.js | 5 ++- lib/rules/prop-types.js | 2 +- lib/rules/require-default-props.js | 5 ++- lib/rules/require-extension.js | 2 +- lib/rules/sort-prop-types.js | 4 +-- lib/rules/style-prop-object.js | 5 ++- lib/rules/void-dom-elements-no-children.js | 7 ++-- lib/util/Components.js | 6 ++-- lib/util/pragma.js | 4 +-- lib/util/variable.js | 4 +-- lib/util/version.js | 2 +- package.json | 12 +++---- tests/eslint-compat.js | 12 ------- tests/index.js | 14 ++++---- .../lib/rules/jsx-closing-bracket-location.js | 3 +- tests/lib/rules/jsx-uses-react.js | 7 ++-- tests/lib/rules/jsx-uses-vars.js | 28 +++++++-------- tests/lib/rules/no-multi-comp.js | 3 +- tests/lib/rules/require-default-props.js | 5 ++- tests/lib/rules/style-prop-object.js | 7 ++-- .../rules/void-dom-elements-no-children.js | 2 +- tests/mocha.opts | 1 - tests/setup.js | 3 -- 45 files changed, 119 insertions(+), 158 deletions(-) delete mode 100644 tests/eslint-compat.js delete mode 100644 tests/mocha.opts delete mode 100644 tests/setup.js diff --git a/.eslintrc b/.eslintrc index 0667d9ddb5..b6f0d450fb 100644 --- a/.eslintrc +++ b/.eslintrc @@ -2,13 +2,12 @@ "env": { "node": true }, + parserOptions: { + ecmaVersion: 2015 + }, ecmaFeatures: { jsx: true }, - "globals": { - }, - "plugins": [ - ], "rules": { // Possible Errors "comma-dangle": [2, "never"], @@ -149,10 +148,16 @@ "wrap-regex": 0, // Legacy "max-depth": 0, - "max-len": [2, 120], + "max-len": [2, 120, { + "ignoreStrings": true, + "ignoreTemplateLiterals": true, + "ignoreComments": true, + }], "max-params": 0, "max-statements": 0, "no-plusplus": 0, - "no-prototype-builtins": 2 + "no-prototype-builtins": 2, + "prefer-template": 2, + "template-curly-spacing": [2, "never"] } } diff --git a/.travis.yml b/.travis.yml index 1f6e191125..8e11eaa334 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,7 @@ node_js: - '6' - '5' - '4' - - 'iojs' - - '0.12' - - '0.10' before_script: - - 'if [ "${TRAVIS_NODE_VERSION}" = "iojs" ] || [ "${TRAVIS_NODE_VERSION}" = "0.12" ] || [ "${TRAVIS_NODE_VERSION}" = "0.10" ]; then npm install eslint@2 babel-eslint@6; fi' after_success: - npm run coveralls matrix: diff --git a/docs/rules/forbid-elements.md b/docs/rules/forbid-elements.md index 16c4c62ddd..774385dad1 100644 --- a/docs/rules/forbid-elements.md +++ b/docs/rules/forbid-elements.md @@ -16,12 +16,12 @@ This rule checks all JSX elements and `React.createElement` calls and verifies t ### `forbid` -An array of strings and/or objects. An object in this array may have the following properties: +An array of strings and/or objects. An object in this array may have the following properties: * `element` (required): the name of the forbidden element (e.g. `'button'`, `'Modal'`) * `message`: additional message that gets reported -A string item in the array is a shorthand for `{ element: string }`. +A string item in the array is a shorthand for `{ element: string }`. The following patterns are not considered warnings: @@ -50,7 +50,7 @@ React.createElement(Namespaced.Element); // [1, { "forbid": [{ "element": "button", "message": "use