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

Commit

Permalink
Adapt for input group changes
Browse files Browse the repository at this point in the history
E006, E010, E015 removed

E009, E011, E012 ported
  • Loading branch information
Herst committed Aug 19, 2019
1 parent c499d3a commit 2eee681
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 410 deletions.
56 changes: 6 additions & 50 deletions src/bootlint.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,57 +613,31 @@ var LocationIndex = _location.LocationIndex;
}
});
/*
addLinter('E006', function lintInputGroupFormControlTypes($, reporter) {
var selectInputGroups = $('.input-group select');
if (selectInputGroups.length) {
reporter('`.input-group` contains a `<select>`; this should be avoided as `<select>`s cannot be fully styled in WebKit browsers', selectInputGroups);
}
var textareaInputGroups = $('.input-group textarea');
if (textareaInputGroups.length) {
reporter('`.input-group` contains a `<textarea>`; only text-based `<input>`s are permitted in an `.input-group`', textareaInputGroups);
}
});
*/
/*
addLinter('E007', function lintBootstrapJs($, reporter) {
var scripts = bootstrapScriptsIn($);
if (scripts.longhands.length && scripts.minifieds.length) {
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));
}
});
*/
/*
addLinter('E009', function lintMissingInputGroupSizes($, reporter) {
var selector = [
'.input-group:not(.input-group-lg) .btn-lg',
'.input-group:not(.input-group-lg) .input-lg',
'.input-group:not(.input-group-lg) .form-control-lg',
'.input-group:not(.input-group-sm) .btn-sm',
'.input-group:not(.input-group-sm) .input-sm'
'.input-group:not(.input-group-sm) .form-control-sm'
].join(',');
var badInputGroupSizing = $(selector);
if (badInputGroupSizing.length) {
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);
}
});
*/
/*
addLinter('E010', function lintMultipleFormControlsInInputGroup($, reporter) {
var badInputGroups = $('.input-group').filter(function (i, inputGroup) {
return $(inputGroup).find('.form-control').length > 1;
});
if (badInputGroups.length) {
reporter('Input groups cannot contain multiple `.form-control`s', badInputGroups);
}
});
*/
/*
addLinter('E011', function lintFormGroupMixedWithInputGroup($, reporter) {
var badMixes = $('.input-group.form-group');
var badMixes = $('.input-group.form-group, .input-group.row, .input-group.form-row');
if (badMixes.length) {
reporter('`.input-group` and `.form-group` cannot be used directly on the same element. Instead, nest the `.input-group` within the `.form-group`', badMixes);
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);
}
});
*/
addLinter('E012', function lintGridClassMixedWithInputGroup($, reporter) {
var selector = COL_CLASSES.map(function (colClass) {
return '.input-group' + colClass;
Expand Down Expand Up @@ -697,22 +671,6 @@ var LocationIndex = _location.LocationIndex;
}
});
/*
addLinter('E015', function lintInputGroupsWithMultipleAddOnsPerSide($, reporter) {
var addOnClasses = ['.input-group-addon', '.input-group-btn'];
var combos = [];
addOnClasses.forEach(function (first) {
addOnClasses.forEach(function (second) {
combos.push('.input-group>' + first + '+' + second);
});
});
var selector = combos.join(',');
var multipleAddOns = $(selector);
if (multipleAddOns.length) {
reporter('Having multiple add-ons on a single side of an input group is not supported', multipleAddOns);
}
});
*/
/*
addLinter('E016', function lintBtnToggle($, reporter) {
var badBtnToggle = $('.btn.dropdown-toggle ~ .btn');
if (badBtnToggle.length) {
Expand Down Expand Up @@ -1029,17 +987,15 @@ var LocationIndex = _location.LocationIndex;
}
});
*/
/*
addLinter('E044', function lintInputGroupAddonChildren($, reporter) {
var badInputGroups = $('.input-group').filter(function () {
var inputGroup = $(this);
return !inputGroup.children('.form-control').length || !inputGroup.children('.input-group-addon, .input-group-btn').length;
return !inputGroup.children('.form-control, .custom-select, .custom-file').length || !inputGroup.children('.input-group-prepend, .input-group-append').length;
});
if (badInputGroups.length) {
reporter('`.input-group` must have a `.form-control` and either an `.input-group-addon` or an `.input-group-btn`.', badInputGroups);
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);
}
});
*/
addLinter('E045', function lintImgResponsiveOnNonImgs($, reporter) {
var imgResponsiveNotOnImg = $('.img-fluid:not(img)');
if (imgResponsiveNotOnImg.length) {
Expand Down
31 changes: 0 additions & 31 deletions test/_old_fixtures/input-group/multiple-add-on-left.html

This file was deleted.

31 changes: 0 additions & 31 deletions test/_old_fixtures/input-group/multiple-add-on-right.html

This file was deleted.

35 changes: 0 additions & 35 deletions test/_old_fixtures/input-group/multiple-btn-add-on-left.html

This file was deleted.

35 changes: 0 additions & 35 deletions test/_old_fixtures/input-group/multiple-btn-add-on-right.html

This file was deleted.

31 changes: 0 additions & 31 deletions test/_old_fixtures/input-group/multiple-form-controls.html

This file was deleted.

33 changes: 0 additions & 33 deletions test/_old_fixtures/input-group/multiple-mixed-add-on-left.html

This file was deleted.

30 changes: 0 additions & 30 deletions test/_old_fixtures/input-group/select.html

This file was deleted.

30 changes: 0 additions & 30 deletions test/_old_fixtures/input-group/textarea.html

This file was deleted.

28 changes: 0 additions & 28 deletions test/_old_fixtures/input-group/valid.html

This file was deleted.

Loading

0 comments on commit 2eee681

Please sign in to comment.