Skip to content

Commit

Permalink
[Tests] remove or make explicit trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jul 24, 2023
1 parent f818096 commit 302925b
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 58 deletions.
6 changes: 3 additions & 3 deletions tests/lib/rules/default-props-match-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ ruleTester.run('default-props-match-prop-types', rule, {
placeholder?: string,
disabled?: boolean,
};
TextField.defaultProps = {
label: '',
placeholder: '',
Expand Down Expand Up @@ -1761,12 +1761,12 @@ ruleTester.run('default-props-match-prop-types', rule, {
export type SharedProps = {|
disabled: boolean,
|};
type Props = {|
...SharedProps,
focused?: boolean,
|};
class Foo extends React.Component<Props> {
static defaultProps = {
disabled: false
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/rules/destructuring-assignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ ruleTester.run('destructuring-assignment', rule, {
],
output: `
function Foo({a}) {
${' '}
return <p>{a}</p>;
}
`,
Expand All @@ -878,7 +878,7 @@ ruleTester.run('destructuring-assignment', rule, {
],
output: `
function Foo({a}: FooProps) {
${' '}
return <p>{a}</p>;
}
`,
Expand Down
14 changes: 7 additions & 7 deletions tests/lib/rules/display-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,15 +543,15 @@ ruleTester.run('display-name', rule, {
name: 'Bob',
},
];
const columns = [
{
Header: 'Name',
accessor: 'name',
Cell: ({ value }) => <div>{value}</div>,
},
];
return <ReactTable columns={columns} data={data} />;
}
`,
Expand All @@ -576,15 +576,15 @@ ruleTester.run('display-name', rule, {
name: 'Bob',
},
];
const columns = [
{
Header: 'Name',
accessor: 'name',
Cell: ({ value }) => <div>{value}</div>,
},
];
return <ReactTable columns={columns} data={data} />;
}
}
Expand Down Expand Up @@ -660,7 +660,7 @@ ruleTester.run('display-name', rule, {
function MyComponent(props) {
return <b>{props.name}</b>;
}
const MemoizedMyComponent = React.memo(
MyComponent,
(prevProps, nextProps) => prevProps.name === nextProps.name
Expand Down Expand Up @@ -1284,11 +1284,11 @@ ruleTester.run('display-name', rule, {
const data = processData({ value: 'data' });
return <div>{data}</div>;
});
export const Component2 = observer(() => {
const data = processData();
return <div>{data}</div>;
});
});
`,
features: ['optional chaining', 'types'],
settings: { componentWrapperFunctions: ['observer'] },
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/rules/function-component-definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ ruleTester.run('function-component-definition', rule, {
</div>
)
}
export default IndexPage;
`,
output: `
Expand All @@ -1157,7 +1157,7 @@ ruleTester.run('function-component-definition', rule, {
</div>
)
}
export default IndexPage;
`,
options: [{ namedComponents: ['function-declaration'] }],
Expand Down
24 changes: 12 additions & 12 deletions tests/lib/rules/jsx-curly-brace-presence.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,23 +787,23 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
},
{
code: `
<App prop="
a
<App prop="${' '}
a${' '}
b c
d
">
a
b c
d
b c${' '}
d${' '}
</App>
`,
errors: [
{ messageId: 'missingCurly' }, { messageId: 'missingCurly' },
],
options: ['always'],
output: `
<App prop="
a
<App prop="${' '}
a${' '}
b c
d
">
Expand All @@ -815,23 +815,23 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
},
{
code: `
<App prop='
a
<App prop='${' '}
a${' '}
b c
d
'>
a
b c
d
b c${' '}
d${' '}
</App>
`,
errors: [
{ messageId: 'missingCurly' }, { messageId: 'missingCurly' },
],
options: ['always'],
output: `
<App prop='
a
<App prop='${' '}
a${' '}
b c
d
'>
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/rules/jsx-first-prop-new-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ruleTester.run('jsx-first-prop-new-line', rule, {
{
code: `
<Foo a
b
b
/>
`,
options: ['never'],
Expand Down Expand Up @@ -109,7 +109,7 @@ ruleTester.run('jsx-first-prop-new-line', rule, {
},
{
code: `
<Foo
<Foo
foo={{
}}
bar
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/rules/jsx-indent.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ruleTester.run('jsx-indent', rule, {
{
code: `
<App>
</App>
</App>
`,
},
{
Expand Down Expand Up @@ -1183,21 +1183,21 @@ const Component = () => (
state = {
name: '',
}
componentDidMount() {
this.fetchName()
.then(name => {
this.setState({name})
});
}
fetchName = () => {
const url = 'https://api.github.com/users/job13er'
return fetch(url)
.then(resp => resp.json())
.then(json => json.name)
}
render() {
const {name} = this.state
return (
Expand Down
30 changes: 15 additions & 15 deletions tests/lib/rules/jsx-no-bind.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ ruleTester.run('jsx-no-bind', rule, {
{
code: `
var Hello = React.createClass({
render: function() {
render: function() {
return (<div>{
this.props.list.map(this.wrap.bind(this, "span"))
}</div>);
Expand All @@ -230,7 +230,7 @@ ruleTester.run('jsx-no-bind', rule, {
{
code: `
var Hello = React.createClass({
render: function() {
render: function() {
const click = this.bar::baz
return <div onClick={onClick}>Hello</div>;
}
Expand All @@ -241,7 +241,7 @@ ruleTester.run('jsx-no-bind', rule, {
{
code: `
var Hello = React.createClass({
render: function() {
render: function() {
const click = () => true
return <div onClick={onClick}>Hello</div>;
}
Expand Down Expand Up @@ -404,7 +404,7 @@ ruleTester.run('jsx-no-bind', rule, {
{
code: `
var Hello = React.createClass({
render: function() {
render: function() {
return <div onClick={this.doSomething.bind(this, "hey")} />
}
});
Expand All @@ -414,7 +414,7 @@ ruleTester.run('jsx-no-bind', rule, {
{
code: `
var Hello = React.createClass({
render: function() {
render: function() {
const doThing = this.doSomething.bind(this, "hey")
return <div onClick={doThing} />
}
Expand Down Expand Up @@ -542,7 +542,7 @@ ruleTester.run('jsx-no-bind', rule, {
{
code: `
var Hello = React.createClass({
render: function() {
render: function() {
return <div onClick={() => true} />
}
});
Expand All @@ -552,7 +552,7 @@ ruleTester.run('jsx-no-bind', rule, {
{
code: `
var Hello = React.createClass({
render: function() {
render: function() {
return <div onClick={async () => true} />
}
});
Expand All @@ -562,7 +562,7 @@ ruleTester.run('jsx-no-bind', rule, {
{
code: `
var Hello = React.createClass({
render: function() {
render: function() {
const doThing = () => true
return <div onClick={doThing} />
}
Expand All @@ -573,7 +573,7 @@ ruleTester.run('jsx-no-bind', rule, {
{
code: `
var Hello = React.createClass({
render: function() {
render: function() {
const doThing = async () => true
return <div onClick={doThing} />
}
Expand Down Expand Up @@ -669,7 +669,7 @@ ruleTester.run('jsx-no-bind', rule, {
{
code: `
var Hello = React.createClass({
render: function() {
render: function() {
return <div onClick={function () { return true }} />
}
});
Expand All @@ -679,7 +679,7 @@ ruleTester.run('jsx-no-bind', rule, {
{
code: `
var Hello = React.createClass({
render: function() {
render: function() {
return <div onClick={function * () { return true }} />
}
});
Expand All @@ -689,7 +689,7 @@ ruleTester.run('jsx-no-bind', rule, {
{
code: `
var Hello = React.createClass({
render: function() {
render: function() {
return <div onClick={async function () { return true }} />
}
});
Expand All @@ -699,7 +699,7 @@ ruleTester.run('jsx-no-bind', rule, {
{
code: `
var Hello = React.createClass({
render: function() {
render: function() {
const doThing = function () { return true }
return <div onClick={doThing} />
}
Expand All @@ -710,7 +710,7 @@ ruleTester.run('jsx-no-bind', rule, {
{
code: `
var Hello = React.createClass({
render: function() {
render: function() {
const doThing = async function () { return true }
return <div onClick={doThing} />
}
Expand All @@ -721,7 +721,7 @@ ruleTester.run('jsx-no-bind', rule, {
{
code: `
var Hello = React.createClass({
render: function() {
render: function() {
const doThing = function * () { return true }
return <div onClick={doThing} />
}
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/rules/jsx-no-leaked-render.js
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ ruleTester.run('jsx-no-leaked-render', rule, {
const MyComponent = () => {
const items = []
const breakpoint = { phones: true }
return <div>{items.length > 0 && breakpoint.phones && <span />}</div>
}
`,
Expand All @@ -821,7 +821,7 @@ ruleTester.run('jsx-no-leaked-render', rule, {
const MyComponent = () => {
const items = []
const breakpoint = { phones: true }
return <div>{items.length > 0 && !!breakpoint.phones && <span />}</div>
}
`,
Expand Down
Loading

0 comments on commit 302925b

Please sign in to comment.