diff --git a/.travis.yml b/.travis.yml
index a7d00fe10a..d7637abed9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,6 +20,7 @@ env:
global:
- TEST=true
matrix:
+ - ESLINT=7
- ESLINT=6
- ESLINT=5
- ESLINT=4
@@ -39,5 +40,11 @@ matrix:
env: ESLINT=6
- node_js: '6'
env: ESLINT=6
+ - node_js: '4'
+ env: ESLINT=7
+ - node_js: '6'
+ env: ESLINT=7
+ - node_js: '8'
+ env: ESLINT=7
allow_failures:
- node_js: '11'
diff --git a/package.json b/package.json
index 77be18cf50..acf6a24f0d 100644
--- a/package.json
+++ b/package.json
@@ -47,7 +47,7 @@
"@typescript-eslint/parser": "^2.24.0",
"babel-eslint": "^8.2.6",
"coveralls": "^3.0.9",
- "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0",
+ "eslint": "^3 || ^4 || ^5 || ^6 || ^7",
"eslint-config-airbnb-base": "^13.2.0",
"eslint-plugin-eslint-plugin": "^2.2.1",
"eslint-plugin-import": "^2.20.1",
@@ -60,7 +60,7 @@
"typescript-eslint-parser": "^20.1.1"
},
"peerDependencies": {
- "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0"
+ "eslint": "^3 || ^4 || ^5 || ^6 || ^7"
},
"engines": {
"node": ">=4"
diff --git a/tests/lib/rules/forbid-prop-types.js b/tests/lib/rules/forbid-prop-types.js
index 63eff5087a..aa48f1401a 100644
--- a/tests/lib/rules/forbid-prop-types.js
+++ b/tests/lib/rules/forbid-prop-types.js
@@ -572,6 +572,20 @@ ruleTester.run('forbid-prop-types', rule, {
' preview: PropTypes.bool,',
'}, componentApi, teaserListProps);'
].join('\n')
+ }, {
+ code: [
+ 'var First = createReactClass({',
+ ' propTypes: {',
+ ' s: PropTypes.shape({',
+ ' o: PropTypes.object',
+ ' })',
+ ' },',
+ ' render: function() {',
+ ' return
;',
+ ' }',
+ '});'
+ ].join('\n'),
+ errors: 0 // TODO: fix #1673 and move this to "invalid"
}],
invalid: [{
@@ -709,20 +723,6 @@ ruleTester.run('forbid-prop-types', rule, {
'});'
].join('\n'),
errors: 2
- }, {
- code: [
- 'var First = createReactClass({',
- ' propTypes: {',
- ' s: PropTypes.shape({,',
- ' o: PropTypes.object',
- ' })',
- ' },',
- ' render: function() {',
- ' return ;',
- ' }',
- '});'
- ].join('\n'),
- errors: 1
}, {
code: [
'var First = createReactClass({',
diff --git a/tests/lib/rules/jsx-closing-bracket-location.js b/tests/lib/rules/jsx-closing-bracket-location.js
index 1127af8d89..cafcd9ebfd 100644
--- a/tests/lib/rules/jsx-closing-bracket-location.js
+++ b/tests/lib/rules/jsx-closing-bracket-location.js
@@ -1161,7 +1161,7 @@ ruleTester.run('jsx-closing-bracket-location', rule, {
')'
].join('\n'),
options: [{location: 'line-aligned'}],
- errors: [MESSAGE_AFTER_TAG]
+ errors: MESSAGE_AFTER_TAG
}, {
code: [
'`,
errors: [{message: missingCurlyMessage}],
- options: [{props: 'always'}]
+ options: [{props: 'always'}],
+ output: ``
},
{
code: 'foo · bar',
errors: [{message: missingCurlyMessage}],
- options: [{children: 'always'}]
+ options: [{children: 'always'}],
+ output: '{"foo · bar"}'
},
{
code: `{'foo "bar"'}`,
@@ -689,7 +691,18 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
errors: [
{message: missingCurlyMessage}, {message: missingCurlyMessage}
],
- options: ['always']
+ options: ['always'],
+ output: [
+ '',
+ ' {"a"}',
+ ' {"b c "}',
+ ' {"d "}',
+ ''
+ ].join('\n')
},
{
code: [
@@ -706,7 +719,18 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
errors: [
{message: missingCurlyMessage}, {message: missingCurlyMessage}
],
- options: ['always']
+ options: ['always'],
+ output: [
+ ``,
+ ' {"a"}',
+ ' {"b c "}',
+ ' {"d "}',
+ ''
+ ].join('\n')
},
{
code: `
diff --git a/tests/lib/rules/jsx-indent.js b/tests/lib/rules/jsx-indent.js
index 5969c1a3aa..6a341ade0f 100644
--- a/tests/lib/rules/jsx-indent.js
+++ b/tests/lib/rules/jsx-indent.js
@@ -1134,15 +1134,15 @@ const Component = () => (
// two lines following. I *think* because it incorrectly uses 's indention
// as the baseline for the next two, instead of the realizing the entire three
// lines are wrong together. See #608
- /* output: [
+ output: [
'function App() {',
' return (',
' ',
- ' ',
- ' ',
+ ' ',
+ '',
' );',
'}'
- ].join('\n'), */
+ ].join('\n'),
options: [2],
errors: [{message: 'Expected indentation of 4 space characters but found 0.'}]
}, {
@@ -1781,7 +1781,14 @@ const Component = () => (
].join('\n'),
errors: [
{message: 'Expected indentation of 4 space characters but found 2.'}
- ]
+ ],
+ output: [
+ '',
+ '
',
+ ' Text',
+ '
',
+ ''
+ ].join('\n')
}, {
code: `
const Component = () => (
diff --git a/tests/lib/rules/jsx-sort-props.js b/tests/lib/rules/jsx-sort-props.js
index 4a58b1ca43..3d64788e3a 100644
--- a/tests/lib/rules/jsx-sort-props.js
+++ b/tests/lib/rules/jsx-sort-props.js
@@ -401,7 +401,7 @@ ruleTester.run('jsx-sort-props', rule, {
},
{
code: ';',
- errors: [shorthandAndCallbackLastArgs],
+ errors: [expectedError],
options: shorthandLastArgs,
output: ';'
},
diff --git a/tests/lib/rules/jsx-uses-vars.js b/tests/lib/rules/jsx-uses-vars.js
index efac09331b..b93e7c3547 100644
--- a/tests/lib/rules/jsx-uses-vars.js
+++ b/tests/lib/rules/jsx-uses-vars.js
@@ -215,13 +215,23 @@ ruleTester.run('prefer-const', rulePreferConst, {
let App = ;
;
`,
- errors: [{message: '\'App\' is never reassigned. Use \'const\' instead.'}]
+ errors: [{message: '\'App\' is never reassigned. Use \'const\' instead.'}],
+ output: `
+ /* eslint jsx-uses-vars:1 */
+ const App = ;
+ ;
+ `
}, {
code: `
/* eslint jsx-uses-vars:1 */
let filters = 'foo';
{filters}
;
`,
- errors: [{message: '\'filters\' is never reassigned. Use \'const\' instead.'}]
+ errors: [{message: '\'filters\' is never reassigned. Use \'const\' instead.'}],
+ output: `
+ /* eslint jsx-uses-vars:1 */
+ const filters = 'foo';
+ {filters}
;
+ `
}]
});
diff --git a/tests/lib/rules/no-typos.js b/tests/lib/rules/no-typos.js
index 9a7b6f751c..62c156e125 100644
--- a/tests/lib/rules/no-typos.js
+++ b/tests/lib/rules/no-typos.js
@@ -944,7 +944,7 @@ ruleTester.run('no-typos', rule, {
type: 'MethodDefinition'
}, {
message: ERROR_MESSAGE_LIFECYCLE_METHOD('Render', 'render'),
- nodeType: 'MethodDefinition'
+ type: 'MethodDefinition'
}]
}, {
code: `
@@ -1616,7 +1616,7 @@ ruleTester.run('no-typos', rule, {
parserOptions,
errors: [{
message: ERROR_MESSAGE_STATIC('getDerivedStateFromProps'),
- nodeType: 'MethodDefinition'
+ type: 'MethodDefinition'
}]
}, {
code: `
@@ -1628,10 +1628,10 @@ ruleTester.run('no-typos', rule, {
parserOptions,
errors: [{
message: ERROR_MESSAGE_STATIC('GetDerivedStateFromProps'),
- nodeType: 'MethodDefinition'
+ type: 'MethodDefinition'
}, {
message: ERROR_MESSAGE_LIFECYCLE_METHOD('GetDerivedStateFromProps', 'getDerivedStateFromProps'),
- nodeType: 'MethodDefinition'
+ type: 'MethodDefinition'
}]
}, {
code: `
diff --git a/tests/lib/rules/no-unknown-property.js b/tests/lib/rules/no-unknown-property.js
index 8bfdd9d61a..21197a4e06 100644
--- a/tests/lib/rules/no-unknown-property.js
+++ b/tests/lib/rules/no-unknown-property.js
@@ -85,10 +85,12 @@ ruleTester.run('no-unknown-property', rule, {
errors: [{message: 'Unknown property \'clip-path\' found, use \'clipPath\' instead'}]
}, {
code: '',
- errors: [{message: 'Unknown property \'crossorigin\' found, use \'crossOrigin\' instead'}]
+ errors: [{message: 'Unknown property \'crossorigin\' found, use \'crossOrigin\' instead'}],
+ output: ''
}, {
code: '',
- errors: [{message: 'Unknown property \'crossorigin\' found, use \'crossOrigin\' instead'}]
+ errors: [{message: 'Unknown property \'crossorigin\' found, use \'crossOrigin\' instead'}],
+ output: ''
}, {
code: '',
errors: [{message: 'Invalid property \'crossOrigin\' found on tag \'div\', but it is only allowed on: script, img, video, audio, link'}]
diff --git a/tests/lib/rules/prefer-read-only-props.js b/tests/lib/rules/prefer-read-only-props.js
index d1b9b46f26..9445605c68 100644
--- a/tests/lib/rules/prefer-read-only-props.js
+++ b/tests/lib/rules/prefer-read-only-props.js
@@ -151,13 +151,24 @@ ruleTester.run('prefer-read-only-props', rule, {
parser: parsers.BABEL_ESLINT,
errors: [{
message: 'Prop \'name\' should be read-only.'
- }]
+ }],
+ output: `
+ type Props = {
+ +name: string,
+ }
+
+ class Hello extends React.Component {
+ render () {
+ return Hello {this.props.name}
;
+ }
+ }
+ `
},
{
// Props.name is contravariant
code: `
type Props = {
- -name: string,
+ -name: string,
}
class Hello extends React.Component {
@@ -169,7 +180,18 @@ ruleTester.run('prefer-read-only-props', rule, {
parser: parsers.BABEL_ESLINT,
errors: [{
message: 'Prop \'name\' should be read-only.'
- }]
+ }],
+ output: `
+ type Props = {
+ +name: string,
+ }
+
+ class Hello extends React.Component {
+ render () {
+ return Hello {this.props.name}
;
+ }
+ }
+ `
},
{
code: `
@@ -186,7 +208,18 @@ ruleTester.run('prefer-read-only-props', rule, {
parser: parsers.BABEL_ESLINT,
errors: [{
message: 'Prop \'name\' should be read-only.'
- }]
+ }],
+ output: `
+ class Hello extends React.Component {
+ props: {
+ +name: string,
+ }
+
+ render () {
+ return Hello {this.props.name}
;
+ }
+ }
+ `
},
{
code: `
@@ -197,7 +230,12 @@ ruleTester.run('prefer-read-only-props', rule, {
parser: parsers.BABEL_ESLINT,
errors: [{
message: 'Prop \'name\' should be read-only.'
- }]
+ }],
+ output: `
+ function Hello(props: {+name: string}) {
+ return Hello {props.name}
;
+ }
+ `
},
{
code: `
@@ -208,7 +246,12 @@ ruleTester.run('prefer-read-only-props', rule, {
parser: parsers.BABEL_ESLINT,
errors: [{
message: 'Prop \'name\' should be read-only.'
- }]
+ }],
+ output: `
+ function Hello(props: {|+name: string|}) {
+ return Hello {props.name}
;
+ }
+ `
},
{
code: `
@@ -219,7 +262,12 @@ ruleTester.run('prefer-read-only-props', rule, {
parser: parsers.BABEL_ESLINT,
errors: [{
message: 'Prop \'name\' should be read-only.'
- }]
+ }],
+ output: `
+ function Hello({name}: {+name: string}) {
+ return Hello {props.name}
;
+ }
+ `
},
{
code: `
@@ -236,7 +284,16 @@ ruleTester.run('prefer-read-only-props', rule, {
message: 'Prop \'firstName\' should be read-only.'
}, {
message: 'Prop \'lastName\' should be read-only.'
- }]
+ }],
+ output: `
+ type PropsA = {+firstName: string};
+ type PropsB = {+lastName: string};
+ type Props = PropsA & PropsB;
+
+ function Hello({firstName, lastName}: Props) {
+ return Hello {firstName} {lastName}
;
+ }
+ `
},
{
code: `
@@ -247,7 +304,12 @@ ruleTester.run('prefer-read-only-props', rule, {
parser: parsers.BABEL_ESLINT,
errors: [{
message: 'Prop \'name\' should be read-only.'
- }]
+ }],
+ output: `
+ const Hello = (props: {+name: string}) => (
+ Hello {props.name}
+ );
+ `
}
]
});