diff --git a/src/bootlint.js b/src/bootlint.js index eeda4280..285b6cd1 100644 --- a/src/bootlint.js +++ b/src/bootlint.js @@ -609,6 +609,324 @@ var LocationIndex = _location.LocationIndex; } }); */ + addLinter('W018', function bs3ClassUsed($, reporter) { + var bs3Selectors = [ + 'td.active, th.active, tr.info', + '.affix', + '.alert-dismissable', + '.blockquote-reverse', + '.tooltip.bottom, .popover.bottom', + '.bottom-left', + '.bottom-right', + '.btn-default', + '.btn-group-justified', + '.btn-group-xs', + '.btn-xs', + '.thumbnail .caption', + '.caret', + '.carousel-control', + '.center-block', + '.checkbox label', + '.checkbox-inline label', + '.col-lg-offset-0', + '.col-lg-offset-1', + '.col-lg-offset-2', + '.col-lg-offset-3', + '.col-lg-offset-4', + '.col-lg-offset-5', + '.col-lg-offset-6', + '.col-lg-offset-7', + '.col-lg-offset-8', + '.col-lg-offset-9', + '.col-lg-offset-10', + '.col-lg-offset-11', + '.col-lg-offset-12', + '.col-lg-pull-0', + '.col-lg-pull-1', + '.col-lg-pull-2', + '.col-lg-pull-3', + '.col-lg-pull-4', + '.col-lg-pull-5', + '.col-lg-pull-6', + '.col-lg-pull-7', + '.col-lg-pull-8', + '.col-lg-pull-9', + '.col-lg-pull-10', + '.col-lg-pull-11', + '.col-lg-pull-12', + '.col-lg-push-0', + '.col-lg-push-1', + '.col-lg-push-2', + '.col-lg-push-3', + '.col-lg-push-4', + '.col-lg-push-5', + '.col-lg-push-6', + '.col-lg-push-7', + '.col-lg-push-8', + '.col-lg-push-9', + '.col-lg-push-10', + '.col-lg-push-11', + '.col-lg-push-12', + '.col-md-offset-0', + '.col-md-offset-1', + '.col-md-offset-2', + '.col-md-offset-3', + '.col-md-offset-4', + '.col-md-offset-5', + '.col-md-offset-6', + '.col-md-offset-7', + '.col-md-offset-8', + '.col-md-offset-9', + '.col-md-offset-10', + '.col-md-offset-11', + '.col-md-offset-12', + '.col-md-pull-0', + '.col-md-pull-1', + '.col-md-pull-2', + '.col-md-pull-3', + '.col-md-pull-4', + '.col-md-pull-5', + '.col-md-pull-6', + '.col-md-pull-7', + '.col-md-pull-8', + '.col-md-pull-9', + '.col-md-pull-10', + '.col-md-pull-11', + '.col-md-pull-12', + '.col-md-push-0', + '.col-md-push-1', + '.col-md-push-2', + '.col-md-push-3', + '.col-md-push-4', + '.col-md-push-5', + '.col-md-push-6', + '.col-md-push-7', + '.col-md-push-8', + '.col-md-push-9', + '.col-md-push-10', + '.col-md-push-11', + '.col-md-push-12', + '.col-sm-offset-0', + '.col-sm-offset-1', + '.col-sm-offset-2', + '.col-sm-offset-3', + '.col-sm-offset-4', + '.col-sm-offset-5', + '.col-sm-offset-6', + '.col-sm-offset-7', + '.col-sm-offset-8', + '.col-sm-offset-9', + '.col-sm-offset-10', + '.col-sm-offset-11', + '.col-sm-offset-12', + '.col-sm-pull-0', + '.col-sm-pull-1', + '.col-sm-pull-2', + '.col-sm-pull-3', + '.col-sm-pull-4', + '.col-sm-pull-5', + '.col-sm-pull-6', + '.col-sm-pull-7', + '.col-sm-pull-8', + '.col-sm-pull-9', + '.col-sm-pull-10', + '.col-sm-pull-11', + '.col-sm-pull-12', + '.col-sm-push-0', + '.col-sm-push-1', + '.col-sm-push-2', + '.col-sm-push-3', + '.col-sm-push-4', + '.col-sm-push-5', + '.col-sm-push-6', + '.col-sm-push-7', + '.col-sm-push-8', + '.col-sm-push-9', + '.col-sm-push-10', + '.col-sm-push-11', + '.col-sm-push-12', + '.col-xs-1', + '.col-xs-2', + '.col-xs-3', + '.col-xs-4', + '.col-xs-5', + '.col-xs-6', + '.col-xs-7', + '.col-xs-8', + '.col-xs-9', + '.col-xs-10', + '.col-xs-11', + '.col-xs-12', + '.col-xs-offset-0', + '.col-xs-offset-1', + '.col-xs-offset-2', + '.col-xs-offset-3', + '.col-xs-offset-4', + '.col-xs-offset-5', + '.col-xs-offset-6', + '.col-xs-offset-7', + '.col-xs-offset-8', + '.col-xs-offset-9', + '.col-xs-offset-10', + '.col-xs-offset-11', + '.col-xs-offset-12', + '.col-xs-pull-0', + '.col-xs-pull-1', + '.col-xs-pull-2', + '.col-xs-pull-3', + '.col-xs-pull-4', + '.col-xs-pull-5', + '.col-xs-pull-6', + '.col-xs-pull-7', + '.col-xs-pull-8', + '.col-xs-pull-9', + '.col-xs-pull-10', + '.col-xs-pull-11', + '.col-xs-pull-12', + '.col-xs-push-0', + '.col-xs-push-1', + '.col-xs-push-2', + '.col-xs-push-3', + '.col-xs-push-4', + '.col-xs-push-5', + '.col-xs-push-6', + '.col-xs-push-7', + '.col-xs-push-8', + '.col-xs-push-9', + '.col-xs-push-10', + '.col-xs-push-11', + '.col-xs-push-12', + '.control-label', + 'td.danger, th.danger, tr.danger', + '.dl-horizontal', + '.dropdown-backdrop', + '.dropdown-menu-left', + '.form-control-static', + '.form-group-lg', + '.form-group-sm', + '.form-horizontal', + '.has-error', + '.has-success', + '.has-warning', + '.help-block', + '.hidden', + '.hidden-lg', + '.hidden-md', + '.hidden-print', + '.hidden-sm', + '.hidden-xs', + '.hide', + '.icon-bar', + '.icon-next', + '.icon-prev', + '.img-circle', + '.img-responsive', + '.img-rounded', + '.fade.in, .collapse.in, .navbar-collapse.in, .modal.in, .modal-backdrop.in, .tooltip.in', + 'td.info, th.info, tr.info', + '.input-lg', + '.input-sm', + '.carousel-inner > .item', + '.label', + '.label-danger', + '.label-default', + '.label-info', + '.label-primary', + '.label-success', + '.label-warning', + '.tooltip.left, .popover.left, .item.left', + '.list-group-item-heading', + '.list-group-item-text', + '.media-bottom', + '.media-heading', + '.media-left', + '.media-list', + '.media-middle', + '.media-object', + '.media-right', + '.navbar-btn', + '.navbar-default', + '.navbar-fixed-bottom', + '.navbar-fixed-top', + '.navbar-form', + '.navbar-header', + '.navbar-inverse', + '.navbar-left', + '.navbar-link', + '.navbar-right', + '.navbar-static-top', + '.navbar-toggle', + '.nav-divider', + '.nav-stacked', + '.nav-tabs-justified', + '.item.next', + '.btn-group.open', + '.page-header', + '.pager', + '.panel', + '.panel-body', + '.panel-collapse', + '.panel-danger', + '.panel-default', + '.panel-footer', + '.panel-group', + '.panel-heading', + '.panel-info', + '.panel-primary', + '.panel-success', + '.panel-title', + '.panel-warning', + '.popover-content', + '.popover-title', + '.item.prev, .carousel-inner > .prev', + '.pager .previous', + '.progress-bar-danger', + '.progress-bar-info', + '.progress-bar-success', + '.progress-bar-warning', + '.progress-striped', + '.pull-left', + '.pull-right', + '.radio label', + '.radio-inline label', + '.row-no-gutters', + 'td.success, th.success, tr.success', + '.table-condensed', + '.thumbnail', + '.tooltip-arrow', + '.tooltip.top, .popover.top', + '.tooltip.top-left', + '.tooltip.top-right', + '.visible-lg', + '.visible-lg-block', + '.visible-lg-inline', + '.visible-lg-inline-block', + '.visible-md', + '.visible-md-block', + '.visible-md-inline', + '.visible-md-inline-block', + '.visible-print', + '.visible-print-block', + '.visible-print-inline', + '.visible-print-inline-block', + '.visible-sm', + '.visible-sm-block', + '.visible-sm-inline', + '.visible-sm-inline-block', + '.visible-xs', + '.visible-xs-block', + '.visible-xs-inline', + '.visible-xs-inline-block', + 'td.warning, th.warning, tr.warning', + '.well', + '.well-lg', + '.well-sm' + ]; + var bs3Usage = $(bs3Selectors.join()); + if (bs3Usage.length) { + reporter('Found usage of CSS classes possibly indicative of Bootstrap 3 and not newer versions.', bs3Usage); + } + }); addLinter('E001', (function () { var MISSING_DOCTYPE = 'Document is missing a DOCTYPE declaration'; var NON_HTML5_DOCTYPE = 'Document declares a non-HTML5 DOCTYPE';