Skip to content

Commit e40fd62

Browse files
author
Edward Xiao
committed
- remove comments.
1 parent 0475fdf commit e40fd62

File tree

8 files changed

+34
-85
lines changed

8 files changed

+34
-85
lines changed

.babelrc

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
{
2-
"presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
3-
"env":
2+
"presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
3+
"env":
4+
{
5+
"development":
46
{
5-
"development":
6-
{
7-
8-
},
9-
"production":
10-
{
11-
12-
},
13-
"lib":
14-
{
15-
"plugins": [
16-
"css-modules-transform",
17-
"@babel/proposal-class-properties",
18-
"@babel/proposal-object-rest-spread"
19-
],
20-
},
21-
"test":
22-
{
23-
"plugins": [
24-
"babel-plugin-rewire"
25-
]
26-
}
7+
comments: false,
8+
},
9+
"production":
10+
{
11+
comments: false,
12+
},
13+
"lib":
14+
{
15+
"plugins": [
16+
"css-modules-transform",
17+
"@babel/proposal-class-properties",
18+
"@babel/proposal-object-rest-spread"
19+
],
20+
comments: false,
21+
},
22+
"test":
23+
{
24+
"plugins": [
25+
"babel-plugin-rewire"
26+
]
2727
}
28+
}
2829
}

lib/components/Checkbox.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,18 +262,13 @@ var component = function component(_ref) {
262262
validationCallback && validationCallback(err);
263263
}, []);
264264
useEffect(function () {
265-
/* istanbul ignore next because it won't happen */
266265
if ($el === null) {
267266
return;
268267
}
269-
/* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */
270-
271268

272269
if (id) {
273270
$el.current.setAttribute('id', String(id));
274271
}
275-
/* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */
276-
277272

278273
if (tabIndex) {
279274
$el.current.setAttribute('tabindex', String(tabIndex));

lib/components/Radiobox.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,18 +269,13 @@ var component = function component(_ref) {
269269
validationCallback && validationCallback(err);
270270
}, []);
271271
useEffect(function () {
272-
/* istanbul ignore if because it won't happen */
273272
if ($el === null) {
274273
return;
275274
}
276-
/* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */
277-
278275

279276
if (id) {
280277
$el.current.setAttribute('id', String(id));
281278
}
282-
/* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */
283-
284279

285280
if (tabIndex) {
286281
$el.current.setAttribute('tabindex', String(tabIndex));

lib/components/Select.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ var reactInputsValidationCss = {
7676
"select__dropdown-icon-container": "react-inputs-validation__select__dropdown-icon-container___2ild-"
7777
};
7878
var TYPE = 'select';
79-
/* istanbul ignore next */
8079

8180
if (!String.prototype.startsWith) {
8281
String.prototype.startsWith = function (searchString, position) {
@@ -359,8 +358,6 @@ var component = function component(_ref) {
359358
setMsg(msg);
360359
validationCallback && validationCallback(err);
361360
}, []);
362-
/* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */
363-
364361
useEffect(function () {
365362
if ($elWrapper === null) {
366363
return;
@@ -383,8 +380,6 @@ var component = function component(_ref) {
383380
$elWrapper.current.removeEventListener('keydown', onKeyDown);
384381
};
385382
}, []);
386-
/* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */
387-
388383
var pageClick = useCallback(function (e) {
389384
if ($elWrapper === null || $elWrapper.current.contains(e.target)) {
390385
return;
@@ -397,14 +392,10 @@ var component = function component(_ref) {
397392

398393
setShow(false);
399394
}, []);
400-
/* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */
401-
402395
var resetCurrentFocus = useCallback(function () {
403396
globalVariableCurrentFocus = getIndex(optionList, internalValue);
404397
scroll();
405398
}, [internalValue]);
406-
/* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */
407-
408399
var setTimeoutTyping = useCallback(function () {
409400
if (globalVariableTypingTimeout) {
410401
clearTimeout(globalVariableTypingTimeout);
@@ -414,8 +405,6 @@ var component = function component(_ref) {
414405
setKeycodeList([]);
415406
}, 250);
416407
}, []);
417-
/* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */
418-
419408
var scroll = useCallback(function () {
420409
var direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
421410

@@ -488,7 +477,6 @@ var component = function component(_ref) {
488477
if (globalVariableCurrentFocus >= $itemsRef.length) globalVariableCurrentFocus = 0;
489478
if (globalVariableCurrentFocus < 0) globalVariableCurrentFocus = $itemsRef.length - 1;
490479
var $node = $itemsRef[globalVariableCurrentFocus];
491-
/* istanbul ignore next because it won't happen */
492480

493481
if (!$node) {
494482
return;
@@ -499,7 +487,6 @@ var component = function component(_ref) {
499487
var removeActive = useCallback(function () {
500488
for (var _i2 = 0; _i2 < $itemsRef.length; _i2 += 1) {
501489
var $node = $itemsRef[_i2];
502-
/* istanbul ignore next because it won't happen */
503490

504491
if (!$node) {
505492
break;
@@ -510,8 +497,6 @@ var component = function component(_ref) {
510497
}
511498
}
512499
}, []);
513-
/* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */
514-
515500
var onKeyDown = useCallback(function (e) {
516501
setIsTyping(true);
517502

lib/components/Textarea.js

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,9 @@ var reactInputsValidationCss = {
7979
};
8080
var TYPE = 'textarea';
8181
var VALIDATE_OPTION_TYPE_LIST = ['string'];
82-
var DEFAULT_MAX_LENGTH = 524288; // Default value is 524288
83-
84-
var DEFAULT_ROWS = 2; // Default value is 2
85-
86-
var DEFAULT_COLS = 2; // Default value is 20
82+
var DEFAULT_MAX_LENGTH = 524288;
83+
var DEFAULT_ROWS = 2;
84+
var DEFAULT_COLS = 2;
8785

8886
var getDefaultValidationOption = function getDefaultValidationOption(obj) {
8987
var reg = obj.reg,
@@ -274,11 +272,7 @@ var component = function component(_ref) {
274272
setSuccessMsg('');
275273
}
276274
}, [err]);
277-
var check = useCallback(
278-
/*#__PURE__*/
279-
_asyncToGenerator(
280-
/*#__PURE__*/
281-
regeneratorRuntime.mark(function _callee() {
275+
var check = useCallback(_asyncToGenerator(regeneratorRuntime.mark(function _callee() {
282276
var reg, min, max, type, name, check, length, regMsg, locale, required, msgOnSuccess, customFunc, _msg, nameText, customFuncResult;
283277

284278
return regeneratorRuntime.wrap(function _callee$(_context) {
@@ -492,18 +486,13 @@ var component = function component(_ref) {
492486
validationCallback && validationCallback(err);
493487
}, []);
494488
useEffect(function () {
495-
/* istanbul ignore if because it won't happen */
496489
if ($el === null) {
497490
return;
498491
}
499-
/* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */
500-
501492

502493
if (id) {
503494
$el.current.setAttribute('id', String(id));
504495
}
505-
/* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */
506-
507496

508497
if (tabIndex) {
509498
$el.current.setAttribute('tabindex', String(tabIndex));
@@ -518,7 +507,6 @@ var component = function component(_ref) {
518507
setInternalValue(String(value));
519508
}, [value]);
520509
useEffect(function () {
521-
/* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */
522510
if (typeof prevInternalValue !== 'undefined' && prevInternalValue !== internalValue) {
523511
if (option.customFunc && onKeyUp) {
524512
check();

lib/components/Textbox.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,8 @@ var reactInputsValidationCss = {
8080
var TYPE = 'textbox';
8181
var VALIDATE_OPTION_TYPE_LIST = ['string', 'number', 'alphanumeric', 'alpha'];
8282
var VALIDATE_NUMBER_TYPE_LIST = ['decimal', 'int'];
83-
var DEFAULT_MAX_LENGTH = 524288; // Default value is 524288
84-
85-
var DEFAULT_AUTO_COMPLETE = 'on'; // Default value is on
83+
var DEFAULT_MAX_LENGTH = 524288;
84+
var DEFAULT_AUTO_COMPLETE = 'on';
8685

8786
var getDefaultValidationOption = function getDefaultValidationOption(obj) {
8887
var reg = obj.reg,
@@ -323,11 +322,7 @@ var component = function component(_ref) {
323322
setSuccessMsg('');
324323
}
325324
}, [err]);
326-
var check = useCallback(
327-
/*#__PURE__*/
328-
_asyncToGenerator(
329-
/*#__PURE__*/
330-
regeneratorRuntime.mark(function _callee() {
325+
var check = useCallback(_asyncToGenerator(regeneratorRuntime.mark(function _callee() {
331326
var reg, min, max, type, name, check, length, regMsg, locale, compare, required, msgOnSuccess, customFunc, _msg, nameText, customFuncResult;
332327

333328
return regeneratorRuntime.wrap(function _callee$(_context) {
@@ -639,18 +634,13 @@ var component = function component(_ref) {
639634
validationCallback && validationCallback(err);
640635
}, []);
641636
useEffect(function () {
642-
/* istanbul ignore if because it won't happen */
643637
if ($el === null) {
644638
return;
645639
}
646-
/* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */
647-
648640

649641
if (id) {
650642
$el.current.setAttribute('id', String(id));
651643
}
652-
/* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */
653-
654644

655645
if (tabIndex) {
656646
$el.current.setAttribute('tabindex', String(tabIndex));
@@ -665,7 +655,6 @@ var component = function component(_ref) {
665655
setInternalValue(String(value));
666656
}, [value]);
667657
useEffect(function () {
668-
/* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */
669658
if (typeof prevInternalValue !== 'undefined' && prevInternalValue !== internalValue) {
670659
if (option.customFunc && onKeyUp) {
671660
check();

lib/components/message.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ var message = {
208208
select: SELECT_VALIDATION_EN_US,
209209
textarea: TEXT_AREA_VALIDATION_EN_US
210210
}
211-
}; // TODO: find a rewire way to handle non-export function
211+
};
212212

213213
var getCustomErrorMessage = function getCustomErrorMessage(o, m) {
214214
if (!o || _typeof(o) !== 'object' || o.constructor !== Object || !Object.keys(o).length) {
@@ -236,7 +236,6 @@ var getCustomErrorMessage = function getCustomErrorMessage(o, m) {
236236

237237
exports.getCustomErrorMessage = getCustomErrorMessage;
238238

239-
// TODO: find a rewire way to handle non-export function
240239
var handleCustomErrorMessage = function handleCustomErrorMessage(message, w) {
241240
var res;
242241

@@ -252,8 +251,6 @@ var handleCustomErrorMessage = function handleCustomErrorMessage(message, w) {
252251

253252
return res;
254253
};
255-
/* istanbul ignore else */
256-
257254

258255
exports.handleCustomErrorMessage = handleCustomErrorMessage;
259256

lib/components/validator.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ var number = function number(v, min, max) {
1919
}
2020

2121
return v < min || v > max ? false : true;
22-
}; // TODO: find a better type for regex
23-
22+
};
2423

2524
var reg = function reg(_reg, v) {
2625
var err = true;

0 commit comments

Comments
 (0)