Skip to content

[eslint] enable eslint-plugin-eslint-plugin #2469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"root": true,
"extends": "airbnb-base",
"extends": ["airbnb-base", "plugin:eslint-plugin/recommended"],
"plugins": ["eslint-plugin"],
"env": {
"es6": true,
"node": true
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/jsx-child-element-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = {
recommended: false,
url: docsUrl('jsx-child-element-spacing')
},
fixable: false,
fixable: null,
schema: [
{
type: 'object',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"dependencies": {
"array-includes": "^3.0.3",
"doctrine": "^2.1.0",
"eslint-plugin-eslint-plugin": "^2.1.0",
"has": "^1.0.3",
"jsx-ast-utils": "^2.2.1",
"object.entries": "^1.1.0",
Expand Down
45 changes: 24 additions & 21 deletions tests/lib/rules/default-props-match-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ ruleTester.run('default-props-match-prop-types', rule, {
'Greeting.defaultProps = {',
' foo: "foo"',
'};'
].join('\n')
].join('\n'),
parser: parsers.BABEL_ESLINT
},
{
code: [
Expand Down Expand Up @@ -530,7 +531,8 @@ ruleTester.run('default-props-match-prop-types', rule, {
' ...defaults,',
' bar: "bar"',
'};'
].join('\n')
].join('\n'),
parser: parsers.BABEL_ESLINT
},

//
Expand Down Expand Up @@ -845,6 +847,26 @@ ruleTester.run('default-props-match-prop-types', rule, {
column: 3
}]
},
{
code: [
'function MyStatelessComponent({ foo, bar }) {',
' return <div>{foo}{bar}</div>;',
'}',
'MyStatelessComponent.propTypes = {',
' foo: React.PropTypes.string,',
' bar: React.PropTypes.string.isRequired',
'};',
'MyStatelessComponent.defaultProps = {',
' baz: "baz"',
'};'
].join('\n'),
errors: [{
message: 'defaultProp "baz" has no corresponding propTypes declaration.',
line: 9,
column: 3
}],
parser: parsers.BABEL_ESLINT
},
{
code: [
'function MyStatelessComponent({ foo, bar }) {',
Expand Down Expand Up @@ -1348,25 +1370,6 @@ ruleTester.run('default-props-match-prop-types', rule, {
column: 5
}]
},
{
code: [
'function MyStatelessComponent({ foo, bar }) {',
' return <div>{foo}{bar}</div>;',
'}',
'MyStatelessComponent.propTypes = {',
' foo: React.PropTypes.string,',
' bar: React.PropTypes.string.isRequired',
'};',
'MyStatelessComponent.defaultProps = {',
' baz: "baz"',
'};'
].join('\n'),
errors: [{
message: 'defaultProp "baz" has no corresponding propTypes declaration.',
line: 9,
column: 3
}]
},
{
code: [
'class Greeting extends React.Component {',
Expand Down
18 changes: 5 additions & 13 deletions tests/lib/rules/destructuring-assignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ const parserOptions = {
const ruleTester = new RuleTester({parserOptions});
ruleTester.run('destructuring-assignment', rule, {
valid: [{
code: `const Foo = class extends React.PureComponent {
render() {
const { foo } = this.props;
return <div>{foo}</div>;
}
};`,
options: ['always'],
parser: parsers.BABEL_ESLINT
}, {
code: `const MyComponent = ({ id, className }) => (
<div id={id} className={className} />
);`
Expand Down Expand Up @@ -102,15 +93,16 @@ ruleTester.run('destructuring-assignment', rule, {
return <div>{foo}</div>;
}
};`,
options: ['always'],
parser: parsers.BABEL_ESLINT
options: ['always']
}, {
code: `const Foo = class extends React.PureComponent {
render() {
const { foo } = this.props;
return <div>{foo}</div>;
}
};`
};`,
options: ['always'],
parser: parsers.BABEL_ESLINT
}, {
code: `const Foo = class extends React.PureComponent {
render() {
Expand All @@ -119,7 +111,7 @@ ruleTester.run('destructuring-assignment', rule, {
}
};`,
options: ['always'],
parser: parsers.BABEL_ESLINT
parser: parsers.TYPESCRIPT_ESLINT
}, {
code: `const MyComponent = (props) => {
const { h, i } = hi;
Expand Down
3 changes: 2 additions & 1 deletion tests/lib/rules/jsx-curly-brace-presence.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,8 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
code: `<MyComponent prop="foo 'bar'">foo</MyComponent>`,
output: `<MyComponent prop={"foo 'bar'"}>foo</MyComponent>`,
options: [{props: 'always'}],
errors: [{message: missingCurlyMessage}]
errors: [{message: missingCurlyMessage}],
parser: parsers.BABEL_ESLINT
},
{
code: '<MyComponent>foo bar </MyComponent>',
Expand Down
9 changes: 4 additions & 5 deletions tests/lib/rules/jsx-curly-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ ruleTester.run('jsx-curly-spacing', rule, {
'...bar',
'} />;'
].join('\n'),
options: [{attributes: {when: 'never'}}]
options: [{attributes: {when: 'never'}}],
parser: parsers.BABEL_ESLINT
}, {
code: [
'<App {',
Expand Down Expand Up @@ -486,9 +487,6 @@ ruleTester.run('jsx-curly-spacing', rule, {
}, {
code: '<App foo={ bar }>{bar}</App>',
options: [{attributes: {when: 'always'}}]
}, {
code: '<App foo={ bar }>{bar}</App>',
options: [{attributes: {when: 'always'}}]
}, {
code: [
'<App foo={ 42 } { ...bar } baz={{ 4: 2 }}>',
Expand Down Expand Up @@ -630,7 +628,8 @@ ruleTester.run('jsx-curly-spacing', rule, {
'...bar',
'} />;'
].join('\n'),
options: ['always']
options: ['always'],
parser: parsers.BABEL_ESLINT
}, {
code: [
'<App {',
Expand Down
3 changes: 2 additions & 1 deletion tests/lib/rules/jsx-no-undef.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ ruleTester.run('jsx-no-undef', rule, {
valid: [{
code: '/*eslint no-undef:1*/ var React, App; React.render(<App />);'
}, {
code: '/*eslint no-undef:1*/ var React, App; React.render(<App />);'
code: '/*eslint no-undef:1*/ var React, App; React.render(<App />);',
parser: parsers.BABEL_ESLINT
}, {
code: '/*eslint no-undef:1*/ var React; React.render(<img />);'
}, {
Expand Down
20 changes: 2 additions & 18 deletions tests/lib/rules/jsx-one-expression-per-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,23 +522,6 @@ ruleTester.run('jsx-one-expression-per-line', rule, {
].join('\n'),
errors: [{message: '` bar` must be placed on a new line'}],
parserOptions
}, {
code: [
'<div>',
' foo {"bar"}',
'</div>'
].join('\n'),
output: [
'<div>',
' foo ',
'{\' \'}',
'{"bar"}',
'</div>'
].join('\n'),
errors: [
{message: '`{"bar"}` must be placed on a new line'}
],
parserOptions
}, {
code: [
'<div>',
Expand Down Expand Up @@ -705,7 +688,8 @@ ruleTester.run('jsx-one-expression-per-line', rule, {
'</App>'
].join('\n'),
errors: [{message: '`Foo` must be placed on a new line'}],
parserOptions
parserOptions,
parser: parsers.BABEL_ESLINT
}, {
code: [
'<App>',
Expand Down
7 changes: 5 additions & 2 deletions tests/lib/rules/jsx-pascal-case.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
const RuleTester = require('eslint').RuleTester;
const rule = require('../../../lib/rules/jsx-pascal-case');

const parsers = require('../../helpers/parsers');

const parserOptions = {
ecmaVersion: 2018,
sourceType: 'module',
Expand Down Expand Up @@ -46,6 +48,9 @@ ruleTester.run('jsx-pascal-case', rule, {
code: '<T3stComp0nent />'
}, {
code: '<T />'
}, {
code: '<T />',
parser: parsers.BABEL_ESLINT
}, {
code: '<YMCA />',
options: [{allowAllCaps: true}]
Expand All @@ -59,8 +64,6 @@ ruleTester.run('jsx-pascal-case', rule, {
}, {
code: '<IGNORED />',
options: [{ignore: ['IGNORED']}]
}, {
code: '<T />'
}, {
code: '<$ />'
}, {
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/rules/jsx-wrap-multilines.js
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ ruleTester.run('jsx-wrap-multilines', rule, {
]
}, {
code: DECLARATION_TERNARY_PAREN_FRAGMENT,
parser: parsers.BABEL_ESLINT,
parser: parsers.TYPESCRIPT_ESLINT,
output: addNewLineSymbols(DECLARATION_TERNARY_PAREN_FRAGMENT),
options: [{declaration: 'parens-new-line'}],
errors: [
Expand Down
9 changes: 5 additions & 4 deletions tests/lib/rules/no-redundant-should-component-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,23 @@ ruleTester.run('no-redundant-should-component-update', rule, {
{
code: `
class Foo extends React.Component {
shouldComponentUpdate = () => {
shouldComponentUpdate() {
return true;
}
}
`,
parser: parsers.BABEL_ESLINT,
parserOptions
parserOptions,
parser: parsers.BABEL_ESLINT
},
{
code: `
class Foo extends React.Component {
shouldComponentUpdate() {
shouldComponentUpdate = () => {
return true;
}
}
`,
parser: parsers.BABEL_ESLINT,
parserOptions
},
{
Expand Down
29 changes: 1 addition & 28 deletions tests/lib/rules/no-typos.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,19 +333,6 @@ ruleTester.run('no-typos', rule, {
`,
parser: parsers.BABEL_ESLINT,
parserOptions
}, {
code: `
import PropTypes from "prop-types";
class Component extends React.Component {};
Component.propTypes = {
a: PropTypes.oneOf([
'hello',
'hi'
])
}
`,
parser: parsers.BABEL_ESLINT,
parserOptions
}, {
code: `
import PropTypes from "prop-types";
Expand Down Expand Up @@ -406,21 +393,6 @@ ruleTester.run('no-typos', rule, {
}
`,
parserOptions
}, {
code: `
import PropTypes from "prop-types";
class Component extends React.Component {};
Component.childContextTypes = {
a: PropTypes.string,
b: PropTypes.string.isRequired,
c: PropTypes.shape({
d: PropTypes.string,
e: PropTypes.number.isRequired,
}).isRequired
}
`,
parser: parsers.BABEL_ESLINT,
parserOptions
}, {
code: `
import PropTypes from "prop-types";
Expand Down Expand Up @@ -1366,6 +1338,7 @@ ruleTester.run('no-typos', rule, {
}).isrequired
}
`,
parser: parsers.BABEL_ESLINT,
parserOptions,
errors: [{
message: 'Typo in prop type chain qualifier: isrequired'
Expand Down
34 changes: 0 additions & 34 deletions tests/lib/rules/no-unused-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -5025,40 +5025,6 @@ ruleTester.run('no-unused-prop-types', rule, {
errors: [{
message: '\'lastname\' PropType is defined but prop is never used'
}]
}, {
code: [
'type Person = {',
' ...data,',
' lastname: string',
'};',
'class Hello extends React.Component {',
' props: Person;',
' render () {',
' return <div>Hello {this.props.firstname}</div>;',
' }',
'}'
].join('\n'),
parser: parsers.BABEL_ESLINT,
errors: [{
message: '\'lastname\' PropType is defined but prop is never used'
}]
}, {
code: [
'type Person = {|',
' ...data,',
' lastname: string',
'|};',
'class Hello extends React.Component {',
' props: Person;',
' render () {',
' return <div>Hello {this.props.firstname}</div>;',
' }',
'}'
].join('\n'),
parser: parsers.BABEL_ESLINT,
errors: [{
message: '\'lastname\' PropType is defined but prop is never used'
}]
}, {
code: [
'class Hello extends React.Component {',
Expand Down
3 changes: 2 additions & 1 deletion tests/lib/rules/prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,8 @@ ruleTester.run('prop-types', rule, {
' }',
'});'
].join('\n'),
options: [{skipUndeclared: true}]
options: [{skipUndeclared: true}],
parser: parsers.BABEL_ESLINT
}, {
code: [
'class Hello extends React.Component {',
Expand Down
Loading