Skip to content

Commit 0131276

Browse files
committed
Rewrite forbid-foreign-prop-types tests with template literals
1 parent 9e6e75b commit 0131276

File tree

1 file changed

+50
-50
lines changed

1 file changed

+50
-50
lines changed

tests/lib/rules/forbid-foreign-prop-types.js

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -53,88 +53,88 @@ ruleTester.run('forbid-foreign-prop-types', rule, {
5353
}],
5454

5555
invalid: [{
56-
code: [
57-
'var Foo = createReactClass({',
58-
' propTypes: Bar.propTypes,',
59-
' render: function() {',
60-
' return <Foo className="bar" />;',
61-
' }',
62-
'});'
63-
].join('\n'),
56+
code: `
57+
var Foo = createReactClass({
58+
propTypes: Bar.propTypes,
59+
render: function() {
60+
return <Foo className="bar" />;
61+
}
62+
});
63+
`,
6464
errors: [{
6565
message: ERROR_MESSAGE,
6666
type: 'Identifier'
6767
}]
6868
},
6969
{
70-
code: [
71-
'var Foo = createReactClass({',
72-
' propTypes: Bar["propTypes"],',
73-
' render: function() {',
74-
' return <Foo className="bar" />;',
75-
' }',
76-
'});'
77-
].join('\n'),
70+
code: `
71+
var Foo = createReactClass({
72+
propTypes: Bar["propTypes"],
73+
render: function() {
74+
return <Foo className="bar" />;
75+
}
76+
});
77+
`,
7878
errors: [{
7979
message: ERROR_MESSAGE,
8080
type: 'Literal'
8181
}]
8282
},
8383
{
84-
code: [
85-
'var { propTypes } = SomeComponent',
86-
'var Foo = createReactClass({',
87-
' propTypes,',
88-
' render: function() {',
89-
' return <Foo className="bar" />;',
90-
' }',
91-
'});'
92-
].join('\n'),
84+
code: `
85+
var { propTypes } = SomeComponent
86+
var Foo = createReactClass({
87+
propTypes,
88+
render: function() {
89+
return <Foo className="bar" />;
90+
}
91+
});
92+
`,
9393
errors: [{
9494
message: ERROR_MESSAGE,
9595
type: 'Property'
9696
}]
9797
},
9898
{
99-
code: [
100-
'var { propTypes: things, ...foo } = SomeComponent',
101-
'var Foo = createReactClass({',
102-
' propTypes,',
103-
' render: function() {',
104-
' return <Foo className="bar" />;',
105-
' }',
106-
'});'
107-
].join('\n'),
99+
code: `
100+
var { propTypes: things, ...foo } = SomeComponent
101+
var Foo = createReactClass({
102+
propTypes,
103+
render: function() {
104+
return <Foo className="bar" />;
105+
}
106+
});
107+
`,
108108
parser: 'babel-eslint',
109109
errors: [{
110110
message: ERROR_MESSAGE,
111111
type: 'Property'
112112
}]
113113
},
114114
{
115-
code: [
116-
'class MyComponent extends React.Component {',
117-
' static fooBar = {',
118-
' baz: Qux.propTypes.baz',
119-
' };',
120-
'}'
121-
].join('\n'),
115+
code: `
116+
class MyComponent extends React.Component {
117+
static fooBar = {
118+
baz: Qux.propTypes.baz
119+
};
120+
}
121+
`,
122122
parser: 'babel-eslint',
123123
errors: [{
124124
message: ERROR_MESSAGE,
125125
type: 'Identifier'
126126
}]
127127
},
128128
{
129-
code: [
130-
'var { propTypes: typesOfProps } = SomeComponent',
131-
'var Foo = createReactClass({',
132-
' propTypes: typesOfProps,',
133-
' render: function() {',
134-
' return <Foo className="bar" />;',
135-
' }',
136-
'});'
137-
].join('\n'),
129+
code: `
130+
var { propTypes: typesOfProps } = SomeComponent
131+
var Foo = createReactClass({
132+
propTypes: typesOfProps,
133+
render: function() {
134+
return <Foo className="bar" />;
135+
}
136+
});
137+
`,
138138
errors: [{
139139
message: ERROR_MESSAGE,
140140
type: 'Property'

0 commit comments

Comments
 (0)