@@ -112,16 +112,6 @@ ruleTester.run('no-this-in-sfc', rule, {
112
112
};
113
113
}
114
114
}`
115
- } , {
116
- code : `
117
- class Foo {
118
- bar() {
119
- () => () => {
120
- this.something();
121
- return null;
122
- };
123
- }
124
- }`
125
115
} , {
126
116
code : `
127
117
class Foo {
@@ -131,15 +121,6 @@ ruleTester.run('no-this-in-sfc', rule, {
131
121
};
132
122
}` ,
133
123
parser : parsers . BABEL_ESLINT
134
- } , {
135
- code : `
136
- class Foo {
137
- bar = () => () => {
138
- this.something();
139
- return null;
140
- };
141
- }` ,
142
- parser : parsers . BABEL_ESLINT
143
124
} , {
144
125
code : `
145
126
export const Example = ({ prop }) => {
@@ -151,6 +132,21 @@ ruleTester.run('no-this-in-sfc', rule, {
151
132
};
152
133
};` ,
153
134
parser : parsers . BABEL_ESLINT
135
+ } , {
136
+ code : `
137
+ export const prepareLogin = new ValidatedMethod({
138
+ name: "user.prepare",
139
+ validate: new SimpleSchema({
140
+ }).validator(),
141
+ run({ remember }) {
142
+ if (Meteor.isServer) {
143
+ const connectionId = this.connection.id; // react/no-this-in-sfc
144
+ return Methods.prepareLogin(connectionId, remember);
145
+ }
146
+ return null;
147
+ },
148
+ });
149
+ `
154
150
} ] ,
155
151
invalid : [ {
156
152
code : `
@@ -217,6 +213,27 @@ ruleTester.run('no-this-in-sfc', rule, {
217
213
return <div onClick={onClick}>{this.props.foo}</div>;
218
214
}` ,
219
215
errors : [ { message : ERROR_MESSAGE } , { message : ERROR_MESSAGE } ]
216
+ } , {
217
+ code : `
218
+ class Foo {
219
+ bar() {
220
+ return () => {
221
+ this.something();
222
+ return null;
223
+ }
224
+ }
225
+ }` ,
226
+ errors : [ { message : ERROR_MESSAGE } ]
227
+ } , {
228
+ code : `
229
+ class Foo {
230
+ bar = () => () => {
231
+ this.something();
232
+ return null;
233
+ };
234
+ }` ,
235
+ parser : parsers . BABEL_ESLINT ,
236
+ errors : [ { message : ERROR_MESSAGE } ]
220
237
} , {
221
238
code : `
222
239
class Foo {
@@ -230,5 +247,16 @@ ruleTester.run('no-this-in-sfc', rule, {
230
247
}
231
248
}` ,
232
249
errors : [ { message : ERROR_MESSAGE } ]
250
+ } , {
251
+ code : `
252
+ class Foo {
253
+ bar() {
254
+ () => () => {
255
+ this.something();
256
+ return null;
257
+ };
258
+ }
259
+ }` ,
260
+ errors : [ { message : ERROR_MESSAGE } ]
233
261
} ]
234
262
} ) ;
0 commit comments