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

Commit 24bc99b

Browse files
committed
Added check for most BS3-specific classes
Left out some of the more generic sounding ones which are unlikely to point to an faulty migration from BS3 because the chance of false positives is high and the gain low: .in .info .item .left .next .open .prev, .previous .right .top .top-left .top-right
1 parent 43ddf0a commit 24bc99b

File tree

1 file changed

+323
-0
lines changed

1 file changed

+323
-0
lines changed

src/bootlint.js

Lines changed: 323 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,329 @@ var LocationIndex = _location.LocationIndex;
529529
reporter('Found one or more `<input>`s missing a `type` attribute.', inputsMissingTypeAttr);
530530
}
531531
});
532+
addLinter('W901', function bs3ClassUsed($, reporter) {
533+
var bs3Classes = [
534+
'affix',
535+
'alert-dismissable',
536+
'blockquote-reverse',
537+
'bottom',
538+
'bottom-left',
539+
'bottom-right',
540+
'btn-default',
541+
'btn-group-justified',
542+
'btn-group-xs',
543+
'btn-xs',
544+
'caption',
545+
'caret',
546+
'carousel-control',
547+
'center-block',
548+
'checkbox',
549+
'checkbox-inline',
550+
'col-lg-offset-0',
551+
'col-lg-offset-1',
552+
'col-lg-offset-2',
553+
'col-lg-offset-3',
554+
'col-lg-offset-4',
555+
'col-lg-offset-5',
556+
'col-lg-offset-6',
557+
'col-lg-offset-7',
558+
'col-lg-offset-8',
559+
'col-lg-offset-9',
560+
'col-lg-offset-10',
561+
'col-lg-offset-11',
562+
'col-lg-offset-12',
563+
'col-lg-pull-0',
564+
'col-lg-pull-1',
565+
'col-lg-pull-2',
566+
'col-lg-pull-3',
567+
'col-lg-pull-4',
568+
'col-lg-pull-5',
569+
'col-lg-pull-6',
570+
'col-lg-pull-7',
571+
'col-lg-pull-8',
572+
'col-lg-pull-9',
573+
'col-lg-pull-10',
574+
'col-lg-pull-11',
575+
'col-lg-pull-12',
576+
'col-lg-push-0',
577+
'col-lg-push-1',
578+
'col-lg-push-2',
579+
'col-lg-push-3',
580+
'col-lg-push-4',
581+
'col-lg-push-5',
582+
'col-lg-push-6',
583+
'col-lg-push-7',
584+
'col-lg-push-8',
585+
'col-lg-push-9',
586+
'col-lg-push-10',
587+
'col-lg-push-11',
588+
'col-lg-push-12',
589+
'col-md-offset-0',
590+
'col-md-offset-1',
591+
'col-md-offset-2',
592+
'col-md-offset-3',
593+
'col-md-offset-4',
594+
'col-md-offset-5',
595+
'col-md-offset-6',
596+
'col-md-offset-7',
597+
'col-md-offset-8',
598+
'col-md-offset-9',
599+
'col-md-offset-10',
600+
'col-md-offset-11',
601+
'col-md-offset-12',
602+
'col-md-pull-0',
603+
'col-md-pull-1',
604+
'col-md-pull-2',
605+
'col-md-pull-3',
606+
'col-md-pull-4',
607+
'col-md-pull-5',
608+
'col-md-pull-6',
609+
'col-md-pull-7',
610+
'col-md-pull-8',
611+
'col-md-pull-9',
612+
'col-md-pull-10',
613+
'col-md-pull-11',
614+
'col-md-pull-12',
615+
'col-md-push-0',
616+
'col-md-push-1',
617+
'col-md-push-2',
618+
'col-md-push-3',
619+
'col-md-push-4',
620+
'col-md-push-5',
621+
'col-md-push-6',
622+
'col-md-push-7',
623+
'col-md-push-8',
624+
'col-md-push-9',
625+
'col-md-push-10',
626+
'col-md-push-11',
627+
'col-md-push-12',
628+
'col-sm-offset-0',
629+
'col-sm-offset-1',
630+
'col-sm-offset-2',
631+
'col-sm-offset-3',
632+
'col-sm-offset-4',
633+
'col-sm-offset-5',
634+
'col-sm-offset-6',
635+
'col-sm-offset-7',
636+
'col-sm-offset-8',
637+
'col-sm-offset-9',
638+
'col-sm-offset-10',
639+
'col-sm-offset-11',
640+
'col-sm-offset-12',
641+
'col-sm-pull-0',
642+
'col-sm-pull-1',
643+
'col-sm-pull-2',
644+
'col-sm-pull-3',
645+
'col-sm-pull-4',
646+
'col-sm-pull-5',
647+
'col-sm-pull-6',
648+
'col-sm-pull-7',
649+
'col-sm-pull-8',
650+
'col-sm-pull-9',
651+
'col-sm-pull-10',
652+
'col-sm-pull-11',
653+
'col-sm-pull-12',
654+
'col-sm-push-0',
655+
'col-sm-push-1',
656+
'col-sm-push-2',
657+
'col-sm-push-3',
658+
'col-sm-push-4',
659+
'col-sm-push-5',
660+
'col-sm-push-6',
661+
'col-sm-push-7',
662+
'col-sm-push-8',
663+
'col-sm-push-9',
664+
'col-sm-push-10',
665+
'col-sm-push-11',
666+
'col-sm-push-12',
667+
'col-xs-1',
668+
'col-xs-2',
669+
'col-xs-3',
670+
'col-xs-4',
671+
'col-xs-5',
672+
'col-xs-6',
673+
'col-xs-7',
674+
'col-xs-8',
675+
'col-xs-9',
676+
'col-xs-10',
677+
'col-xs-11',
678+
'col-xs-12',
679+
'col-xs-offset-0',
680+
'col-xs-offset-1',
681+
'col-xs-offset-2',
682+
'col-xs-offset-3',
683+
'col-xs-offset-4',
684+
'col-xs-offset-5',
685+
'col-xs-offset-6',
686+
'col-xs-offset-7',
687+
'col-xs-offset-8',
688+
'col-xs-offset-9',
689+
'col-xs-offset-10',
690+
'col-xs-offset-11',
691+
'col-xs-offset-12',
692+
'col-xs-pull-0',
693+
'col-xs-pull-1',
694+
'col-xs-pull-2',
695+
'col-xs-pull-3',
696+
'col-xs-pull-4',
697+
'col-xs-pull-5',
698+
'col-xs-pull-6',
699+
'col-xs-pull-7',
700+
'col-xs-pull-8',
701+
'col-xs-pull-9',
702+
'col-xs-pull-10',
703+
'col-xs-pull-11',
704+
'col-xs-pull-12',
705+
'col-xs-push-0',
706+
'col-xs-push-1',
707+
'col-xs-push-2',
708+
'col-xs-push-3',
709+
'col-xs-push-4',
710+
'col-xs-push-5',
711+
'col-xs-push-6',
712+
'col-xs-push-7',
713+
'col-xs-push-8',
714+
'col-xs-push-9',
715+
'col-xs-push-10',
716+
'col-xs-push-11',
717+
'col-xs-push-12',
718+
'control-label',
719+
'danger',
720+
'divider',
721+
'dl-horizontal',
722+
'dropdown-backdrop',
723+
'dropdown-menu-left',
724+
'form-control-static',
725+
'form-group-lg',
726+
'form-group-sm',
727+
'form-horizontal',
728+
'gradient',
729+
'has-error',
730+
'has-success',
731+
'has-warning',
732+
'help-block',
733+
'hidden',
734+
'hidden-lg',
735+
'hidden-md',
736+
'hidden-print',
737+
'hidden-sm',
738+
'hidden-xs',
739+
'hide',
740+
'icon-bar',
741+
'icon-next',
742+
'icon-prev',
743+
'img-circle',
744+
'img-responsive',
745+
'img-rounded',
746+
// 'in',
747+
// 'info',
748+
'input-lg',
749+
'input-sm',
750+
// 'item',
751+
'label',
752+
'label-danger',
753+
'label-default',
754+
'label-info',
755+
'label-primary',
756+
'label-success',
757+
'label-warning',
758+
// 'left',
759+
'list-group-item-heading',
760+
'list-group-item-text',
761+
'media-bottom',
762+
'media-heading',
763+
'media-left',
764+
'media-list',
765+
'media-middle',
766+
'media-object',
767+
'media-right',
768+
'navbar-btn',
769+
'navbar-default',
770+
'navbar-fixed-bottom',
771+
'navbar-fixed-top',
772+
'navbar-form',
773+
'navbar-header',
774+
'navbar-inverse',
775+
'navbar-left',
776+
'navbar-link',
777+
'navbar-right',
778+
'navbar-static-top',
779+
'navbar-toggle',
780+
'nav-divider',
781+
'nav-stacked',
782+
'nav-tabs-justified',
783+
// 'next',
784+
// 'open',
785+
'page-header',
786+
'pager',
787+
'panel',
788+
'panel-body',
789+
'panel-collapse',
790+
'panel-danger',
791+
'panel-default',
792+
'panel-footer',
793+
'panel-group',
794+
'panel-heading',
795+
'panel-info',
796+
'panel-primary',
797+
'panel-success',
798+
'panel-title',
799+
'panel-warning',
800+
'popover-content',
801+
'popover-title',
802+
// 'prev',
803+
// 'previous',
804+
'progress-bar-danger',
805+
'progress-bar-info',
806+
'progress-bar-success',
807+
'progress-bar-warning',
808+
'progress-striped',
809+
'pull-left',
810+
'pull-right',
811+
'radio',
812+
'radio-inline',
813+
// 'right',
814+
'row-no-gutters',
815+
'success',
816+
'table-condensed',
817+
'thumbnail',
818+
'tooltip-arrow',
819+
// 'top',
820+
// 'top-left',
821+
// 'top-right',
822+
'visible-lg',
823+
'visible-lg-block',
824+
'visible-lg-inline',
825+
'visible-lg-inline-block',
826+
'visible-md',
827+
'visible-md-block',
828+
'visible-md-inline',
829+
'visible-md-inline-block',
830+
'visible-print',
831+
'visible-print-block',
832+
'visible-print-inline',
833+
'visible-print-inline-block',
834+
'visible-sm',
835+
'visible-sm-block',
836+
'visible-sm-inline',
837+
'visible-sm-inline-block',
838+
'visible-xs',
839+
'visible-xs-block',
840+
'visible-xs-inline',
841+
'visible-xs-inline-block',
842+
'warning',
843+
'well',
844+
'well-lg',
845+
'well-sm'
846+
];
847+
var bs3ClassesSelector = bs3Classes.map(function (x) {
848+
return '.' + x;
849+
}).join();
850+
var bs3ClassUsage = $(bs3ClassesSelector);
851+
if (bs3ClassUsage.length) {
852+
reporter('Found usage of CSS classes specific to Bootstrap 3.', bs3ClassUsage);
853+
}
854+
});
532855

533856
addLinter('E001', (function () {
534857
var MISSING_DOCTYPE = 'Document is missing a DOCTYPE declaration';

0 commit comments

Comments
 (0)