From 3ae3a9a6285cca1185f70f1db2047a6ce4210e62 Mon Sep 17 00:00:00 2001 From: golopot Date: Mon, 10 Jun 2019 20:49:56 +0800 Subject: [PATCH] [Tests] make tests pass in eslint@6 --- .travis.yml | 7 +++---- tests/lib/rules/jsx-child-element-spacing.js | 1 + tests/lib/rules/jsx-closing-tag-location.js | 1 + tests/lib/rules/jsx-curly-brace-presence.js | 1 + tests/lib/rules/jsx-max-depth.js | 1 + tests/lib/rules/no-did-mount-set-state.js | 2 +- tests/lib/rules/no-did-update-set-state.js | 2 +- tests/lib/rules/no-unused-prop-types.js | 3 ++- tests/lib/rules/sort-prop-types.js | 4 ++-- 9 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1766131834..62a62aaa95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ env: global: - TEST=true matrix: - - ESLINT=next + - ESLINT=^6.0.0-0 - ESLINT=5 - ESLINT=4 after_success: @@ -32,9 +32,8 @@ matrix: - node_js: '4' env: ESLINT=5 - node_js: '4' - env: ESLINT=next + env: ESLINT=^6.0.0-0 - node_js: '6' - env: ESLINT=next + env: ESLINT=^6.0.0-0 allow_failures: - node_js: '11' - - env: ESLINT=next diff --git a/tests/lib/rules/jsx-child-element-spacing.js b/tests/lib/rules/jsx-child-element-spacing.js index 47d3618ce7..9cf1ea7107 100644 --- a/tests/lib/rules/jsx-child-element-spacing.js +++ b/tests/lib/rules/jsx-child-element-spacing.js @@ -7,6 +7,7 @@ const parsers = require('../../helpers/parsers'); const parserOptions = { sourceType: 'module', + ecmaVersion: 2015, ecmaFeatures: { jsx: true } diff --git a/tests/lib/rules/jsx-closing-tag-location.js b/tests/lib/rules/jsx-closing-tag-location.js index 1596f56e09..9288c9a12d 100644 --- a/tests/lib/rules/jsx-closing-tag-location.js +++ b/tests/lib/rules/jsx-closing-tag-location.js @@ -16,6 +16,7 @@ const parsers = require('../../helpers/parsers'); const parserOptions = { sourceType: 'module', + ecmaVersion: 2015, ecmaFeatures: { jsx: true } diff --git a/tests/lib/rules/jsx-curly-brace-presence.js b/tests/lib/rules/jsx-curly-brace-presence.js index 6dc42eccf8..3376e1ac19 100755 --- a/tests/lib/rules/jsx-curly-brace-presence.js +++ b/tests/lib/rules/jsx-curly-brace-presence.js @@ -18,6 +18,7 @@ const parsers = require('../../helpers/parsers'); const parserOptions = { sourceType: 'module', + ecmaVersion: 2015, ecmaFeatures: { jsx: true } diff --git a/tests/lib/rules/jsx-max-depth.js b/tests/lib/rules/jsx-max-depth.js index aca22a4a3c..858443414c 100644 --- a/tests/lib/rules/jsx-max-depth.js +++ b/tests/lib/rules/jsx-max-depth.js @@ -16,6 +16,7 @@ const parsers = require('../../helpers/parsers'); const parserOptions = { sourceType: 'module', + ecmaVersion: 2015, ecmaFeatures: { jsx: true } diff --git a/tests/lib/rules/no-did-mount-set-state.js b/tests/lib/rules/no-did-mount-set-state.js index 7c876efc0a..762324d295 100644 --- a/tests/lib/rules/no-did-mount-set-state.js +++ b/tests/lib/rules/no-did-mount-set-state.js @@ -117,7 +117,7 @@ ruleTester.run('no-did-mount-set-state', rule, { } } `, - parser: 'babel-eslint', + parser: parsers.BABEL_ESLINT, errors: [{ message: 'Do not use setState in componentDidMount' }] diff --git a/tests/lib/rules/no-did-update-set-state.js b/tests/lib/rules/no-did-update-set-state.js index 2bd90db3a0..096aca8259 100644 --- a/tests/lib/rules/no-did-update-set-state.js +++ b/tests/lib/rules/no-did-update-set-state.js @@ -117,7 +117,7 @@ ruleTester.run('no-did-update-set-state', rule, { } } `, - parser: 'babel-eslint', + parser: parsers.BABEL_ESLINT, errors: [{ message: 'Do not use setState in componentDidUpdate' }] diff --git a/tests/lib/rules/no-unused-prop-types.js b/tests/lib/rules/no-unused-prop-types.js index 67853ec3ef..685940e5a2 100644 --- a/tests/lib/rules/no-unused-prop-types.js +++ b/tests/lib/rules/no-unused-prop-types.js @@ -4376,7 +4376,8 @@ ruleTester.run('no-unused-prop-types', rule, { line: 11, column: 8 }] - }, { // None of the props are used issue #1162 + }, { + // None of the props are used issue #1162 code: [ 'import React from "react"; ', 'var Hello = React.createReactClass({', diff --git a/tests/lib/rules/sort-prop-types.js b/tests/lib/rules/sort-prop-types.js index 769f14802a..6326a7d89d 100644 --- a/tests/lib/rules/sort-prop-types.js +++ b/tests/lib/rules/sort-prop-types.js @@ -447,7 +447,7 @@ ruleTester.run('sort-prop-types', rule, { options: [{ sortShapeProp: true }], - parser: 'babel-eslint' + parser: parsers.BABEL_ESLINT }, { code: ` const shape = { @@ -1674,7 +1674,7 @@ ruleTester.run('sort-prop-types', rule, { options: [{ sortShapeProp: true }], - parser: 'babel-eslint', + parser: parsers.BABEL_ESLINT, errors: [{ message: ERROR_MESSAGE, line: 4,