Skip to content

Commit

Permalink
Changed warnings in no-deprecated rule, deprecated old lifecycle me…
Browse files Browse the repository at this point in the history
…thods in favor of `UNSAFE_*`
  • Loading branch information
sergei-startsev committed Apr 2, 2018
1 parent 8d9ba75 commit 3a8b365
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions lib/rules/no-deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@ module.exports = {
// 16.3.0
deprecated.componentWillMount = [
'16.3.0',
'constructor',
'UNSAFE_componentWillMount',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillmount'
];
deprecated.componentWillReceiveProps = [
'16.3.0',
'getDerivedStateFromProps',
'UNSAFE_componentWillReceiveProps',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops'
];
deprecated.componentWillUpdate = [
'16.3.0',
'getDerivedStateFromProps',
'UNSAFE_componentWillUpdate',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate'
];
return deprecated;
Expand Down
36 changes: 18 additions & 18 deletions tests/lib/rules/no-deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,18 +221,18 @@ ruleTester.run('no-deprecated', rule, {
errors: [
{
message: errorMessage(
'componentWillMount', '16.3.0', 'constructor',
'componentWillMount', '16.3.0', 'UNSAFE_componentWillMount',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillmount'
)
},
{
message: errorMessage(
'componentWillReceiveProps', '16.3.0', 'getDerivedStateFromProps',
'componentWillReceiveProps', '16.3.0', 'UNSAFE_componentWillReceiveProps',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops'
)
},
{
message: errorMessage('componentWillUpdate', '16.3.0', 'getDerivedStateFromProps',
message: errorMessage('componentWillUpdate', '16.3.0', 'UNSAFE_componentWillUpdate',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate'
)
}
Expand All @@ -251,18 +251,18 @@ ruleTester.run('no-deprecated', rule, {
errors: [
{
message: errorMessage(
'componentWillMount', '16.3.0', 'constructor',
'componentWillMount', '16.3.0', 'UNSAFE_componentWillMount',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillmount'
)
},
{
message: errorMessage(
'componentWillReceiveProps', '16.3.0', 'getDerivedStateFromProps',
'componentWillReceiveProps', '16.3.0', 'UNSAFE_componentWillReceiveProps',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops'
)
},
{
message: errorMessage('componentWillUpdate', '16.3.0', 'getDerivedStateFromProps',
message: errorMessage('componentWillUpdate', '16.3.0', 'UNSAFE_componentWillUpdate',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate'
)
}
Expand All @@ -279,18 +279,18 @@ ruleTester.run('no-deprecated', rule, {
errors: [
{
message: errorMessage(
'componentWillMount', '16.3.0', 'constructor',
'componentWillMount', '16.3.0', 'UNSAFE_componentWillMount',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillmount'
)
},
{
message: errorMessage(
'componentWillReceiveProps', '16.3.0', 'getDerivedStateFromProps',
'componentWillReceiveProps', '16.3.0', 'UNSAFE_componentWillReceiveProps',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops'
)
},
{
message: errorMessage('componentWillUpdate', '16.3.0', 'getDerivedStateFromProps',
message: errorMessage('componentWillUpdate', '16.3.0', 'UNSAFE_componentWillUpdate',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate'
)
}
Expand All @@ -307,18 +307,18 @@ ruleTester.run('no-deprecated', rule, {
errors: [
{
message: errorMessage(
'componentWillMount', '16.3.0', 'constructor',
'componentWillMount', '16.3.0', 'UNSAFE_componentWillMount',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillmount'
)
},
{
message: errorMessage(
'componentWillReceiveProps', '16.3.0', 'getDerivedStateFromProps',
'componentWillReceiveProps', '16.3.0', 'UNSAFE_componentWillReceiveProps',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops'
)
},
{
message: errorMessage('componentWillUpdate', '16.3.0', 'getDerivedStateFromProps',
message: errorMessage('componentWillUpdate', '16.3.0', 'UNSAFE_componentWillUpdate',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate'
)
}
Expand All @@ -335,18 +335,18 @@ ruleTester.run('no-deprecated', rule, {
errors: [
{
message: errorMessage(
'componentWillMount', '16.3.0', 'constructor',
'componentWillMount', '16.3.0', 'UNSAFE_componentWillMount',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillmount'
)
},
{
message: errorMessage(
'componentWillReceiveProps', '16.3.0', 'getDerivedStateFromProps',
'componentWillReceiveProps', '16.3.0', 'UNSAFE_componentWillReceiveProps',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops'
)
},
{
message: errorMessage('componentWillUpdate', '16.3.0', 'getDerivedStateFromProps',
message: errorMessage('componentWillUpdate', '16.3.0', 'UNSAFE_componentWillUpdate',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate'
)
}
Expand All @@ -363,18 +363,18 @@ ruleTester.run('no-deprecated', rule, {
errors: [
{
message: errorMessage(
'componentWillMount', '16.3.0', 'constructor',
'componentWillMount', '16.3.0', 'UNSAFE_componentWillMount',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillmount'
)
},
{
message: errorMessage(
'componentWillReceiveProps', '16.3.0', 'getDerivedStateFromProps',
'componentWillReceiveProps', '16.3.0', 'UNSAFE_componentWillReceiveProps',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops'
)
},
{
message: errorMessage('componentWillUpdate', '16.3.0', 'getDerivedStateFromProps',
message: errorMessage('componentWillUpdate', '16.3.0', 'UNSAFE_componentWillUpdate',
'https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate'
)
}
Expand Down

0 comments on commit 3a8b365

Please sign in to comment.