Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Commit edd016e

Browse files
committed
Adapt for input group changes
E006, E010, E015 removed E009, E011, E012 ported
1 parent 79ca109 commit edd016e

16 files changed

+29
-410
lines changed

src/bootlint.js

+6-50
Original file line numberDiff line numberDiff line change
@@ -617,57 +617,31 @@ var LocationIndex = _location.LocationIndex;
617617
}
618618
});
619619
/*
620-
addLinter('E006', function lintInputGroupFormControlTypes($, reporter) {
621-
var selectInputGroups = $('.input-group select');
622-
if (selectInputGroups.length) {
623-
reporter('`.input-group` contains a `<select>`; this should be avoided as `<select>`s cannot be fully styled in WebKit browsers', selectInputGroups);
624-
}
625-
var textareaInputGroups = $('.input-group textarea');
626-
if (textareaInputGroups.length) {
627-
reporter('`.input-group` contains a `<textarea>`; only text-based `<input>`s are permitted in an `.input-group`', textareaInputGroups);
628-
}
629-
});
630-
*/
631-
/*
632620
addLinter('E007', function lintBootstrapJs($, reporter) {
633621
var scripts = bootstrapScriptsIn($);
634622
if (scripts.longhands.length && scripts.minifieds.length) {
635623
reporter('Only one copy of Bootstrap\'s JS should be included; currently the webpage includes both bootstrap.js and bootstrap.min.js', scripts.longhands.add(scripts.minifieds));
636624
}
637625
});
638626
*/
639-
/*
640627
addLinter('E009', function lintMissingInputGroupSizes($, reporter) {
641628
var selector = [
642629
'.input-group:not(.input-group-lg) .btn-lg',
643-
'.input-group:not(.input-group-lg) .input-lg',
630+
'.input-group:not(.input-group-lg) .form-control-lg',
644631
'.input-group:not(.input-group-sm) .btn-sm',
645-
'.input-group:not(.input-group-sm) .input-sm'
632+
'.input-group:not(.input-group-sm) .form-control-sm'
646633
].join(',');
647634
var badInputGroupSizing = $(selector);
648635
if (badInputGroupSizing.length) {
649636
reporter('Button and input sizing within `.input-group`s can cause issues. Instead, use input group sizing classes `.input-group-lg` or `.input-group-sm`', badInputGroupSizing);
650637
}
651638
});
652-
*/
653-
/*
654-
addLinter('E010', function lintMultipleFormControlsInInputGroup($, reporter) {
655-
var badInputGroups = $('.input-group').filter(function (i, inputGroup) {
656-
return $(inputGroup).find('.form-control').length > 1;
657-
});
658-
if (badInputGroups.length) {
659-
reporter('Input groups cannot contain multiple `.form-control`s', badInputGroups);
660-
}
661-
});
662-
*/
663-
/*
664639
addLinter('E011', function lintFormGroupMixedWithInputGroup($, reporter) {
665-
var badMixes = $('.input-group.form-group');
640+
var badMixes = $('.input-group.form-group, .input-group.row, .input-group.form-row');
666641
if (badMixes.length) {
667-
reporter('`.input-group` and `.form-group` cannot be used directly on the same element. Instead, nest the `.input-group` within the `.form-group`', badMixes);
642+
reporter('`.input-group` and `.form-group`/`.row`/`.form-row` cannot be used directly on the same element. Instead, nest the `.input-group` within the `.form-group`/`.row`/`.form-row`', badMixes);
668643
}
669644
});
670-
*/
671645
addLinter('E012', function lintGridClassMixedWithInputGroup($, reporter) {
672646
var selector = COL_CLASSES.map(function (colClass) {
673647
return '.input-group' + colClass;
@@ -701,22 +675,6 @@ var LocationIndex = _location.LocationIndex;
701675
}
702676
});
703677
/*
704-
addLinter('E015', function lintInputGroupsWithMultipleAddOnsPerSide($, reporter) {
705-
var addOnClasses = ['.input-group-addon', '.input-group-btn'];
706-
var combos = [];
707-
addOnClasses.forEach(function (first) {
708-
addOnClasses.forEach(function (second) {
709-
combos.push('.input-group>' + first + '+' + second);
710-
});
711-
});
712-
var selector = combos.join(',');
713-
var multipleAddOns = $(selector);
714-
if (multipleAddOns.length) {
715-
reporter('Having multiple add-ons on a single side of an input group is not supported', multipleAddOns);
716-
}
717-
});
718-
*/
719-
/*
720678
addLinter('E016', function lintBtnToggle($, reporter) {
721679
var badBtnToggle = $('.btn.dropdown-toggle ~ .btn');
722680
if (badBtnToggle.length) {
@@ -1027,17 +985,15 @@ var LocationIndex = _location.LocationIndex;
1027985
}
1028986
});
1029987
*/
1030-
/*
1031988
addLinter('E044', function lintInputGroupAddonChildren($, reporter) {
1032989
var badInputGroups = $('.input-group').filter(function () {
1033990
var inputGroup = $(this);
1034-
return !inputGroup.children('.form-control').length || !inputGroup.children('.input-group-addon, .input-group-btn').length;
991+
return !inputGroup.children('.form-control, .custom-select, .custom-file').length || !inputGroup.children('.input-group-prepend, .input-group-append').length;
1035992
});
1036993
if (badInputGroups.length) {
1037-
reporter('`.input-group` must have a `.form-control` and either an `.input-group-addon` or an `.input-group-btn`.', badInputGroups);
994+
reporter('`.input-group` must have at least one `.form-control`/`.custom-select`/`.custom-file` child and also at least one `.input-group-prepend`/`.input-group-append` child.', badInputGroups);
1038995
}
1039996
});
1040-
*/
1041997
/*
1042998
addLinter('E045', function lintImgResponsiveOnNonImgs($, reporter) {
1043999
var imgResponsiveNotOnImg = $('.img-responsive:not(img)');

test/_old_fixtures/input-group/multiple-add-on-left.html

-31
This file was deleted.

test/_old_fixtures/input-group/multiple-add-on-right.html

-31
This file was deleted.

test/_old_fixtures/input-group/multiple-btn-add-on-left.html

-35
This file was deleted.

test/_old_fixtures/input-group/multiple-btn-add-on-right.html

-35
This file was deleted.

test/_old_fixtures/input-group/multiple-form-controls.html

-31
This file was deleted.

test/_old_fixtures/input-group/multiple-mixed-add-on-left.html

-33
This file was deleted.

test/_old_fixtures/input-group/select.html

-30
This file was deleted.

test/_old_fixtures/input-group/textarea.html

-30
This file was deleted.

test/_old_fixtures/input-group/valid.html

-28
This file was deleted.

0 commit comments

Comments
 (0)