Skip to content

Commit

Permalink
Revert "Revert "deps: update ESLint version to v7 (facebook#18897)" (f…
Browse files Browse the repository at this point in the history
…acebook#18899)"

This reverts commit 84fd4b8.
  • Loading branch information
koba04 committed May 15, 2020
1 parent 21dc41c commit 10f6559
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 30 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"cross-env": "^6.0.3",
"danger": "^9.2.10",
"error-stack-parser": "^2.0.6",
"eslint": "^6.8.0",
"eslint": "^7.0.0",
"eslint-config-fbjs": "^1.1.1",
"eslint-config-prettier": "^6.9.0",
"eslint-plugin-babel": "^5.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ ruleTester.run('no-production-logging', rule, {
invalid: [
{
code: "console.error('Oh no');",
output: "if (__DEV__) {console.error('Oh no')};",
errors: [
{
message: `Wrap console.error() in an "if (__DEV__) {}" check`,
Expand All @@ -118,6 +119,7 @@ ruleTester.run('no-production-logging', rule, {
},
{
code: "console.warn('Oh no');",
output: "if (__DEV__) {console.warn('Oh no')};",
errors: [
{
message: `Wrap console.warn() in an "if (__DEV__) {}" check`,
Expand All @@ -126,6 +128,7 @@ ruleTester.run('no-production-logging', rule, {
},
{
code: "console.warn('Oh no')",
output: "if (__DEV__) {console.warn('Oh no')}",
errors: [
{
message: `Wrap console.warn() in an "if (__DEV__) {}" check`,
Expand All @@ -138,6 +141,11 @@ ruleTester.run('no-production-logging', rule, {
console.warn('Oh no');
}
`,
output: `
if (potato) {
if (__DEV__) {console.warn('Oh no')};
}
`,
errors: [
{
message: `Wrap console.warn() in an "if (__DEV__) {}" check`,
Expand All @@ -150,6 +158,11 @@ ruleTester.run('no-production-logging', rule, {
console.error('Oh no');
}
`,
output: `
if (__DEV__ || potato && true) {
if (__DEV__) {console.error('Oh no')};
}
`,
errors: [
{
message: `Wrap console.error() in an "if (__DEV__) {}" check`,
Expand All @@ -162,6 +175,11 @@ ruleTester.run('no-production-logging', rule, {
console.error('Oh no');
}
`,
output: `
if (banana && __DEV__ && potato && kitten) {
if (__DEV__) {console.error('Oh no')};
}
`,
// Technically this code is valid but we prefer
// explicit standalone __DEV__ blocks that stand out.
errors: [
Expand All @@ -176,6 +194,11 @@ ruleTester.run('no-production-logging', rule, {
console.error('Oh no');
}
`,
output: `
if (!__DEV__) {
if (__DEV__) {console.error('Oh no')};
}
`,
errors: [
{
message: `Wrap console.error() in an "if (__DEV__) {}" check`,
Expand All @@ -188,6 +211,11 @@ ruleTester.run('no-production-logging', rule, {
console.error('Oh no');
}
`,
output: `
if (foo || x && __DEV__) {
if (__DEV__) {console.error('Oh no')};
}
`,
errors: [
{
message: `Wrap console.error() in an "if (__DEV__) {}" check`,
Expand All @@ -201,6 +229,12 @@ ruleTester.run('no-production-logging', rule, {
console.error('Oh no');
}
`,
output: `
if (__DEV__) {
} else {
if (__DEV__) {console.error('Oh no')};
}
`,
errors: [
{
message: `Wrap console.error() in an "if (__DEV__) {}" check`,
Expand All @@ -217,6 +251,15 @@ ruleTester.run('no-production-logging', rule, {
}
}
`,
output: `
if (__DEV__) {
} else {
if (__DEV__) {
} else {
if (__DEV__) {console.error('Oh no')};
}
}
`,
errors: [
{
message: `Wrap console.error() in an "if (__DEV__) {}" check`,
Expand Down
Loading

0 comments on commit 10f6559

Please sign in to comment.