Skip to content

Commit 039ad34

Browse files
authored
deps: update ESLint version to v7 (facebook#18897)
1 parent 9f396bd commit 039ad34

File tree

3 files changed

+158
-30
lines changed

3 files changed

+158
-30
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"cross-env": "^6.0.3",
4848
"danger": "^9.2.10",
4949
"error-stack-parser": "^2.0.6",
50-
"eslint": "^6.8.0",
50+
"eslint": "^7.0.0",
5151
"eslint-config-fbjs": "^1.1.1",
5252
"eslint-config-prettier": "^6.9.0",
5353
"eslint-plugin-babel": "^5.3.0",

scripts/eslint-rules/__tests__/no-production-logging-test.internal.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ ruleTester.run('no-production-logging', rule, {
110110
invalid: [
111111
{
112112
code: "console.error('Oh no');",
113+
output: "if (__DEV__) {console.error('Oh no')};",
113114
errors: [
114115
{
115116
message: `Wrap console.error() in an "if (__DEV__) {}" check`,
@@ -118,6 +119,7 @@ ruleTester.run('no-production-logging', rule, {
118119
},
119120
{
120121
code: "console.warn('Oh no');",
122+
output: "if (__DEV__) {console.warn('Oh no')};",
121123
errors: [
122124
{
123125
message: `Wrap console.warn() in an "if (__DEV__) {}" check`,
@@ -126,6 +128,7 @@ ruleTester.run('no-production-logging', rule, {
126128
},
127129
{
128130
code: "console.warn('Oh no')",
131+
output: "if (__DEV__) {console.warn('Oh no')}",
129132
errors: [
130133
{
131134
message: `Wrap console.warn() in an "if (__DEV__) {}" check`,
@@ -138,6 +141,11 @@ ruleTester.run('no-production-logging', rule, {
138141
console.warn('Oh no');
139142
}
140143
`,
144+
output: `
145+
if (potato) {
146+
if (__DEV__) {console.warn('Oh no')};
147+
}
148+
`,
141149
errors: [
142150
{
143151
message: `Wrap console.warn() in an "if (__DEV__) {}" check`,
@@ -150,6 +158,11 @@ ruleTester.run('no-production-logging', rule, {
150158
console.error('Oh no');
151159
}
152160
`,
161+
output: `
162+
if (__DEV__ || potato && true) {
163+
if (__DEV__) {console.error('Oh no')};
164+
}
165+
`,
153166
errors: [
154167
{
155168
message: `Wrap console.error() in an "if (__DEV__) {}" check`,
@@ -162,6 +175,11 @@ ruleTester.run('no-production-logging', rule, {
162175
console.error('Oh no');
163176
}
164177
`,
178+
output: `
179+
if (banana && __DEV__ && potato && kitten) {
180+
if (__DEV__) {console.error('Oh no')};
181+
}
182+
`,
165183
// Technically this code is valid but we prefer
166184
// explicit standalone __DEV__ blocks that stand out.
167185
errors: [
@@ -176,6 +194,11 @@ ruleTester.run('no-production-logging', rule, {
176194
console.error('Oh no');
177195
}
178196
`,
197+
output: `
198+
if (!__DEV__) {
199+
if (__DEV__) {console.error('Oh no')};
200+
}
201+
`,
179202
errors: [
180203
{
181204
message: `Wrap console.error() in an "if (__DEV__) {}" check`,
@@ -188,6 +211,11 @@ ruleTester.run('no-production-logging', rule, {
188211
console.error('Oh no');
189212
}
190213
`,
214+
output: `
215+
if (foo || x && __DEV__) {
216+
if (__DEV__) {console.error('Oh no')};
217+
}
218+
`,
191219
errors: [
192220
{
193221
message: `Wrap console.error() in an "if (__DEV__) {}" check`,
@@ -201,6 +229,12 @@ ruleTester.run('no-production-logging', rule, {
201229
console.error('Oh no');
202230
}
203231
`,
232+
output: `
233+
if (__DEV__) {
234+
} else {
235+
if (__DEV__) {console.error('Oh no')};
236+
}
237+
`,
204238
errors: [
205239
{
206240
message: `Wrap console.error() in an "if (__DEV__) {}" check`,
@@ -217,6 +251,15 @@ ruleTester.run('no-production-logging', rule, {
217251
}
218252
}
219253
`,
254+
output: `
255+
if (__DEV__) {
256+
} else {
257+
if (__DEV__) {
258+
} else {
259+
if (__DEV__) {console.error('Oh no')};
260+
}
261+
}
262+
`,
220263
errors: [
221264
{
222265
message: `Wrap console.error() in an "if (__DEV__) {}" check`,

0 commit comments

Comments
 (0)