Skip to content

Commit d401413

Browse files
author
Edward Xiao
committed
/* istanbul ignore else */ ignore if typeof window === 'undefined'
1 parent 5d579ff commit d401413

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

.eslintrc.json

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,37 @@
11
{
22
// Extend existing configuration
33
// from ESlint and eslint-plugin-react defaults.
4-
"extends": [
5-
"eslint:recommended", "plugin:react/recommended"
6-
],
4+
"extends": ["eslint:recommended", "plugin:react/recommended"],
75
// Enable ES6 support. If you want to use custom Babel
86
// features, you will need to enable a custom parser
97
// as described in a section below.
10-
"parserOptions":
11-
{
8+
"parserOptions": {
129
"ecmaVersion": 6,
1310
"sourceType": "module",
14-
"ecmaFeatures":
15-
{
11+
"ecmaFeatures": {
1612
"experimentalObjectRestSpread": true
1713
}
1814
},
19-
"env":
20-
{
15+
"env": {
2116
"jest": true,
2217
"es6": true,
2318
"browser": true,
2419
"node": true,
2520
"jquery": true
2621
},
2722
// Enable custom plugin known as eslint-plugin-react
28-
"plugins": [
29-
"react"
30-
],
31-
"rules":
32-
{
23+
"plugins": ["react"],
24+
"rules": {
3325
// Disable `no-console` rule
3426
"no-console": 0,
3527
// Give a warning if identifiers contain underscores
3628
"no-underscore-dangle": 1,
3729
"no-debugger": 0,
38-
"no-empty": ["error",
39-
{
40-
"allowEmptyCatch": true
41-
}]
30+
"no-empty": [
31+
"error",
32+
{
33+
"allowEmptyCatch": true
34+
}
35+
]
4236
}
43-
}
37+
}

src/js/Inputs/message.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,6 @@ declare global {
135135
}
136136
}
137137

138-
if (typeof window !== 'undefined') {
139-
window.REACT_INPUTS_VALIDATION = window.REACT_INPUTS_VALIDATION || {};
140-
}
141-
142138
// TODO: find a rewire way to handle non-export function
143139
export const handleCustomErrorMessage = (message: any, w: Window) => {
144140
let res;
@@ -153,7 +149,9 @@ export const handleCustomErrorMessage = (message: any, w: Window) => {
153149
return res;
154150
};
155151

152+
/* istanbul ignore else */
156153
if (typeof window !== 'undefined') {
154+
window.REACT_INPUTS_VALIDATION = window.REACT_INPUTS_VALIDATION || {};
157155
message = handleCustomErrorMessage(message, window);
158156
}
159157

0 commit comments

Comments
 (0)