Skip to content

Commit 7034ffc

Browse files
sergei-startsevljharb
authored andcommitted
Changed warnings in no-deprecated rule, deprecated old lifecycle methods in favor of UNSAFE_*
1 parent 501edbf commit 7034ffc

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

lib/rules/no-deprecated.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,17 @@ module.exports = {
7979
// 16.3.0
8080
deprecated.componentWillMount = [
8181
'16.3.0',
82-
'constructor',
82+
'UNSAFE_componentWillMount',
8383
'https://reactjs.org/docs/react-component.html#unsafe_componentwillmount'
8484
];
8585
deprecated.componentWillReceiveProps = [
8686
'16.3.0',
87-
'getDerivedStateFromProps',
87+
'UNSAFE_componentWillReceiveProps',
8888
'https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops'
8989
];
9090
deprecated.componentWillUpdate = [
9191
'16.3.0',
92-
'getDerivedStateFromProps',
92+
'UNSAFE_componentWillUpdate',
9393
'https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate'
9494
];
9595
return deprecated;

tests/lib/rules/no-deprecated.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -221,18 +221,18 @@ ruleTester.run('no-deprecated', rule, {
221221
errors: [
222222
{
223223
message: errorMessage(
224-
'componentWillMount', '16.3.0', 'constructor',
224+
'componentWillMount', '16.3.0', 'UNSAFE_componentWillMount',
225225
'https://reactjs.org/docs/react-component.html#unsafe_componentwillmount'
226226
)
227227
},
228228
{
229229
message: errorMessage(
230-
'componentWillReceiveProps', '16.3.0', 'getDerivedStateFromProps',
230+
'componentWillReceiveProps', '16.3.0', 'UNSAFE_componentWillReceiveProps',
231231
'https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops'
232232
)
233233
},
234234
{
235-
message: errorMessage('componentWillUpdate', '16.3.0', 'getDerivedStateFromProps',
235+
message: errorMessage('componentWillUpdate', '16.3.0', 'UNSAFE_componentWillUpdate',
236236
'https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate'
237237
)
238238
}
@@ -251,18 +251,18 @@ ruleTester.run('no-deprecated', rule, {
251251
errors: [
252252
{
253253
message: errorMessage(
254-
'componentWillMount', '16.3.0', 'constructor',
254+
'componentWillMount', '16.3.0', 'UNSAFE_componentWillMount',
255255
'https://reactjs.org/docs/react-component.html#unsafe_componentwillmount'
256256
)
257257
},
258258
{
259259
message: errorMessage(
260-
'componentWillReceiveProps', '16.3.0', 'getDerivedStateFromProps',
260+
'componentWillReceiveProps', '16.3.0', 'UNSAFE_componentWillReceiveProps',
261261
'https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops'
262262
)
263263
},
264264
{
265-
message: errorMessage('componentWillUpdate', '16.3.0', 'getDerivedStateFromProps',
265+
message: errorMessage('componentWillUpdate', '16.3.0', 'UNSAFE_componentWillUpdate',
266266
'https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate'
267267
)
268268
}
@@ -279,18 +279,18 @@ ruleTester.run('no-deprecated', rule, {
279279
errors: [
280280
{
281281
message: errorMessage(
282-
'componentWillMount', '16.3.0', 'constructor',
282+
'componentWillMount', '16.3.0', 'UNSAFE_componentWillMount',
283283
'https://reactjs.org/docs/react-component.html#unsafe_componentwillmount'
284284
)
285285
},
286286
{
287287
message: errorMessage(
288-
'componentWillReceiveProps', '16.3.0', 'getDerivedStateFromProps',
288+
'componentWillReceiveProps', '16.3.0', 'UNSAFE_componentWillReceiveProps',
289289
'https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops'
290290
)
291291
},
292292
{
293-
message: errorMessage('componentWillUpdate', '16.3.0', 'getDerivedStateFromProps',
293+
message: errorMessage('componentWillUpdate', '16.3.0', 'UNSAFE_componentWillUpdate',
294294
'https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate'
295295
)
296296
}
@@ -307,18 +307,18 @@ ruleTester.run('no-deprecated', rule, {
307307
errors: [
308308
{
309309
message: errorMessage(
310-
'componentWillMount', '16.3.0', 'constructor',
310+
'componentWillMount', '16.3.0', 'UNSAFE_componentWillMount',
311311
'https://reactjs.org/docs/react-component.html#unsafe_componentwillmount'
312312
)
313313
},
314314
{
315315
message: errorMessage(
316-
'componentWillReceiveProps', '16.3.0', 'getDerivedStateFromProps',
316+
'componentWillReceiveProps', '16.3.0', 'UNSAFE_componentWillReceiveProps',
317317
'https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops'
318318
)
319319
},
320320
{
321-
message: errorMessage('componentWillUpdate', '16.3.0', 'getDerivedStateFromProps',
321+
message: errorMessage('componentWillUpdate', '16.3.0', 'UNSAFE_componentWillUpdate',
322322
'https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate'
323323
)
324324
}
@@ -335,18 +335,18 @@ ruleTester.run('no-deprecated', rule, {
335335
errors: [
336336
{
337337
message: errorMessage(
338-
'componentWillMount', '16.3.0', 'constructor',
338+
'componentWillMount', '16.3.0', 'UNSAFE_componentWillMount',
339339
'https://reactjs.org/docs/react-component.html#unsafe_componentwillmount'
340340
)
341341
},
342342
{
343343
message: errorMessage(
344-
'componentWillReceiveProps', '16.3.0', 'getDerivedStateFromProps',
344+
'componentWillReceiveProps', '16.3.0', 'UNSAFE_componentWillReceiveProps',
345345
'https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops'
346346
)
347347
},
348348
{
349-
message: errorMessage('componentWillUpdate', '16.3.0', 'getDerivedStateFromProps',
349+
message: errorMessage('componentWillUpdate', '16.3.0', 'UNSAFE_componentWillUpdate',
350350
'https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate'
351351
)
352352
}
@@ -363,18 +363,18 @@ ruleTester.run('no-deprecated', rule, {
363363
errors: [
364364
{
365365
message: errorMessage(
366-
'componentWillMount', '16.3.0', 'constructor',
366+
'componentWillMount', '16.3.0', 'UNSAFE_componentWillMount',
367367
'https://reactjs.org/docs/react-component.html#unsafe_componentwillmount'
368368
)
369369
},
370370
{
371371
message: errorMessage(
372-
'componentWillReceiveProps', '16.3.0', 'getDerivedStateFromProps',
372+
'componentWillReceiveProps', '16.3.0', 'UNSAFE_componentWillReceiveProps',
373373
'https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops'
374374
)
375375
},
376376
{
377-
message: errorMessage('componentWillUpdate', '16.3.0', 'getDerivedStateFromProps',
377+
message: errorMessage('componentWillUpdate', '16.3.0', 'UNSAFE_componentWillUpdate',
378378
'https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate'
379379
)
380380
}

0 commit comments

Comments
 (0)