From 8229371c815e5af4676f83b4a8dd2ad2a9720cd3 Mon Sep 17 00:00:00 2001 From: Herst Date: Wed, 26 Dec 2018 22:52:28 +0100 Subject: [PATCH] Remove various checks * W002 (X-UA-Compatible) * W010 (.pull-left or .pull-right in .media) * W015 (Bootstrap 4) * E002 (Bootstrap v2 grid) * E030 (.glyphicon-* without .glyphicon) * E031 (.glyphicon on element with content or children) * E038 (.media-left/.media-right outside of .media) --- src/bootlint.js | 90 ------------- test/_old_fixtures/bs-v2.html | 32 ----- .../glyphicons/missing-glyphicon-class.html | 27 ---- .../glyphicons/on-elem-with-child.html | 27 ---- .../glyphicons/on-elem-with-text.html | 27 ---- test/_old_fixtures/glyphicons/valid.html | 25 ---- .../media/deprecated-pull-classes.html | 33 ----- test/_old_fixtures/media/media-classes.html | 39 ------ .../media/media-pull-on-media.html | 35 ----- .../media/misplaced-media-left.html | 26 ---- .../media/misplaced-media-right.html | 26 ---- .../version-4/bootstrap-css.html | 26 ---- .../version-4/bootstrap-extensions-okay.html | 28 ---- .../_old_fixtures/version-4/bootstrap-js.html | 26 ---- .../version-4/bootstrap-min-css.html | 26 ---- .../version-4/bootstrap-min-js.html | 26 ---- .../js-version-not-in-url-4.0.0.html | 30 ----- .../x-ua-compatible/lowercase.html | 23 ---- .../x-ua-compatible/missing.html | 24 ---- .../x-ua-compatible/present.html | 23 ---- test/bootlint_test.js | 127 +----------------- 21 files changed, 1 insertion(+), 745 deletions(-) delete mode 100644 test/_old_fixtures/bs-v2.html delete mode 100644 test/_old_fixtures/glyphicons/missing-glyphicon-class.html delete mode 100644 test/_old_fixtures/glyphicons/on-elem-with-child.html delete mode 100644 test/_old_fixtures/glyphicons/on-elem-with-text.html delete mode 100644 test/_old_fixtures/glyphicons/valid.html delete mode 100644 test/_old_fixtures/media/deprecated-pull-classes.html delete mode 100644 test/_old_fixtures/media/media-classes.html delete mode 100644 test/_old_fixtures/media/media-pull-on-media.html delete mode 100644 test/_old_fixtures/media/misplaced-media-left.html delete mode 100644 test/_old_fixtures/media/misplaced-media-right.html delete mode 100644 test/_old_fixtures/version-4/bootstrap-css.html delete mode 100644 test/_old_fixtures/version-4/bootstrap-extensions-okay.html delete mode 100644 test/_old_fixtures/version-4/bootstrap-js.html delete mode 100644 test/_old_fixtures/version-4/bootstrap-min-css.html delete mode 100644 test/_old_fixtures/version-4/bootstrap-min-js.html delete mode 100644 test/_old_fixtures/version-4/js-version-not-in-url-4.0.0.html delete mode 100644 test/_old_fixtures/x-ua-compatible/lowercase.html delete mode 100644 test/_old_fixtures/x-ua-compatible/missing.html delete mode 100644 test/_old_fixtures/x-ua-compatible/present.html diff --git a/src/bootlint.js b/src/bootlint.js index eeda4280..298f51ae 100644 --- a/src/bootlint.js +++ b/src/bootlint.js @@ -338,17 +338,6 @@ var LocationIndex = _location.LocationIndex; }); */ /* - addLinter('W002', function lintXUaCompatible($, reporter) { - var meta = $([ - 'head>meta[http-equiv="X-UA-Compatible"][content="IE=edge"]', - 'head>meta[http-equiv="x-ua-compatible"][content="ie=edge"]' - ].join(',')); - if (!meta.length) { - reporter('`` is missing X-UA-Compatible `` tag that disables old IE compatibility modes'); - } - }); - */ - /* addLinter('W003', function lintViewport($, reporter) { var meta = $('head>meta[name="viewport"][content]'); if (!meta.length) { @@ -496,14 +485,6 @@ var LocationIndex = _location.LocationIndex; }); }); /* - addLinter('W010', function lintMediaPulls($, reporter) { - var mediaPulls = $('.media>.pull-left, .media>.pull-right'); - if (mediaPulls.length) { - reporter('Using `.pull-left` or `.pull-right` as part of the media object component is deprecated as of Bootstrap v3.3.0. Use `.media-left` or `.media-right` instead.'); - } - }); - */ - /* addLinter('W012', function lintNavbarContainers($, reporter) { var navBars = $('.navbar'); var containers = [ @@ -564,36 +545,6 @@ var LocationIndex = _location.LocationIndex; }); */ /* - addLinter('W015', function lintNewBootstrap($, reporter) { - var FUTURE_VERSION_ERROR = 'Detected what appears to be Bootstrap v4 or later. This version of Bootlint only supports Bootstrap v3.'; - var theWindow = getBrowserWindowObject(); - - var globaljQuery = theWindow && (theWindow.$ || theWindow.jQuery); - // @covignore - if (globaljQuery) { - var versions = jqueryPluginVersions(globaljQuery); - if (versions.length) { - var minVersion = versions[0]; - if (semver.gte(minVersion, BOOTSTRAP_VERSION_4, true)) { - reporter(FUTURE_VERSION_ERROR); - return; - } - } - } - // check for Bootstrap s and - - - - - - - -
-
-
-
-
- -
-
    -
  1. -
  2. -
- - diff --git a/test/_old_fixtures/glyphicons/missing-glyphicon-class.html b/test/_old_fixtures/glyphicons/missing-glyphicon-class.html deleted file mode 100644 index 7a088260..00000000 --- a/test/_old_fixtures/glyphicons/missing-glyphicon-class.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - Test - - - - - - - - - - - -
-
    -
  1. -
- - diff --git a/test/_old_fixtures/glyphicons/on-elem-with-child.html b/test/_old_fixtures/glyphicons/on-elem-with-child.html deleted file mode 100644 index 8bc2bde9..00000000 --- a/test/_old_fixtures/glyphicons/on-elem-with-child.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - Test - - - - - - - - - - - -
-
    -
  1. -
- - diff --git a/test/_old_fixtures/glyphicons/on-elem-with-text.html b/test/_old_fixtures/glyphicons/on-elem-with-text.html deleted file mode 100644 index f4127642..00000000 --- a/test/_old_fixtures/glyphicons/on-elem-with-text.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - Test - - - - - - - - - - This text is not allowed - -
-
    -
  1. -
- - diff --git a/test/_old_fixtures/glyphicons/valid.html b/test/_old_fixtures/glyphicons/valid.html deleted file mode 100644 index 28ed66a3..00000000 --- a/test/_old_fixtures/glyphicons/valid.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - Test - - - - - - - - - - - -
-
    - - diff --git a/test/_old_fixtures/media/deprecated-pull-classes.html b/test/_old_fixtures/media/deprecated-pull-classes.html deleted file mode 100644 index ae6a85a7..00000000 --- a/test/_old_fixtures/media/deprecated-pull-classes.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - Test - - - - - - - - - -
    - - - -
    -

    Media heading

    -
    -
    -
    -
      -
    1. -
    - - diff --git a/test/_old_fixtures/media/media-classes.html b/test/_old_fixtures/media/media-classes.html deleted file mode 100644 index bb1a168b..00000000 --- a/test/_old_fixtures/media/media-classes.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - Test - - - - - - - - - -
    - - - -
    -

    Media heading

    -
    -
    -
    - - - -
    -

    Media heading

    -
    -
    -
    -
      - - diff --git a/test/_old_fixtures/media/media-pull-on-media.html b/test/_old_fixtures/media/media-pull-on-media.html deleted file mode 100644 index 5e464e94..00000000 --- a/test/_old_fixtures/media/media-pull-on-media.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - Test - - - - - - - - - -
      -
      -

      Media heading

      -
      -
      -
      -
      -

      Media heading

      -
      -
      -
      -
        -
      1. -
      - - diff --git a/test/_old_fixtures/media/misplaced-media-left.html b/test/_old_fixtures/media/misplaced-media-left.html deleted file mode 100644 index b81526cb..00000000 --- a/test/_old_fixtures/media/misplaced-media-left.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - Test - - - - - - - - - - Where is my media object? -
      -
        -
      1. -
      - - diff --git a/test/_old_fixtures/media/misplaced-media-right.html b/test/_old_fixtures/media/misplaced-media-right.html deleted file mode 100644 index 1092decc..00000000 --- a/test/_old_fixtures/media/misplaced-media-right.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - Test - - - - - - - - - - Where is my media object? -
      -
        -
      1. -
      - - diff --git a/test/_old_fixtures/version-4/bootstrap-css.html b/test/_old_fixtures/version-4/bootstrap-css.html deleted file mode 100644 index 937656db..00000000 --- a/test/_old_fixtures/version-4/bootstrap-css.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - Test - - - - - - - - - - -
      -
        -
      1. -
      - - diff --git a/test/_old_fixtures/version-4/bootstrap-extensions-okay.html b/test/_old_fixtures/version-4/bootstrap-extensions-okay.html deleted file mode 100644 index f7864bf9..00000000 --- a/test/_old_fixtures/version-4/bootstrap-extensions-okay.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - Test - - - - - - - - - - - - - - -
      -
        - - diff --git a/test/_old_fixtures/version-4/bootstrap-js.html b/test/_old_fixtures/version-4/bootstrap-js.html deleted file mode 100644 index 93737843..00000000 --- a/test/_old_fixtures/version-4/bootstrap-js.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - Test - - - - - - - - - - -
        -
          -
        1. -
        - - diff --git a/test/_old_fixtures/version-4/bootstrap-min-css.html b/test/_old_fixtures/version-4/bootstrap-min-css.html deleted file mode 100644 index 6a01f48c..00000000 --- a/test/_old_fixtures/version-4/bootstrap-min-css.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - Test - - - - - - - - - - -
        -
          -
        1. -
        - - diff --git a/test/_old_fixtures/version-4/bootstrap-min-js.html b/test/_old_fixtures/version-4/bootstrap-min-js.html deleted file mode 100644 index fddc46b7..00000000 --- a/test/_old_fixtures/version-4/bootstrap-min-js.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - Test - - - - - - - - - - -
        -
          -
        1. -
        - - diff --git a/test/_old_fixtures/version-4/js-version-not-in-url-4.0.0.html b/test/_old_fixtures/version-4/js-version-not-in-url-4.0.0.html deleted file mode 100644 index 4c0595f0..00000000 --- a/test/_old_fixtures/version-4/js-version-not-in-url-4.0.0.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - Test - - - - - - - - - - -
        -
          -
        1. -
        - - diff --git a/test/_old_fixtures/x-ua-compatible/lowercase.html b/test/_old_fixtures/x-ua-compatible/lowercase.html deleted file mode 100644 index 09a4c624..00000000 --- a/test/_old_fixtures/x-ua-compatible/lowercase.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - Test - - - - - - - - - -
        -
          - - diff --git a/test/_old_fixtures/x-ua-compatible/missing.html b/test/_old_fixtures/x-ua-compatible/missing.html deleted file mode 100644 index 9b93a755..00000000 --- a/test/_old_fixtures/x-ua-compatible/missing.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - Test - - - - - - - - - -
          -
            -
          1. -
          - - diff --git a/test/_old_fixtures/x-ua-compatible/present.html b/test/_old_fixtures/x-ua-compatible/present.html deleted file mode 100644 index a1bd00e2..00000000 --- a/test/_old_fixtures/x-ua-compatible/present.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - Test - - - - - - - - - -
          -
            - - diff --git a/test/bootlint_test.js b/test/bootlint_test.js index db374407..4f819a1e 100644 --- a/test/bootlint_test.js +++ b/test/bootlint_test.js @@ -57,15 +57,6 @@ exports.bootlint = { test.done(); }, /* - 'disabling lint checks': function (test) { - test.expect(1); - test.deepEqual(lintHtml(utf8Fixture('bs-v2.html'), ['E002', 'E013']), - [], - 'should complain when Bootstrap v2 grid classes are present.'); - test.done(); - }, - */ - /* 'UTF-8 charset meta tag': function (test) { test.expect(4); test.deepEqual(lintHtml(utf8Fixture('charset/utf8.html')), @@ -84,33 +75,6 @@ exports.bootlint = { }, */ /* - 'X-UA-Compatible': function (test) { - test.expect(3); - test.deepEqual(lintHtml(utf8Fixture('x-ua-compatible/present.html')), - [], - 'should not complain when X-UA-Compatible tag is present.'); - test.deepEqual(lintHtml(utf8Fixture('x-ua-compatible/lowercase.html')), - [], - 'should not complain when X-UA-Compatible tag is present but lowercased.'); - test.deepEqual(lintHtml(utf8Fixture('x-ua-compatible/missing.html')), - ['`` is missing X-UA-Compatible `` tag that disables old IE compatibility modes'], - 'should complain when X-UA-Compatible tag is missing.'); - test.done(); - }, - */ - /* - 'Bootstrap v2': function (test) { - test.expect(1); - test.deepEqual(lintHtml(utf8Fixture('bs-v2.html')), - [ - 'Found one or more uses of outdated Bootstrap v2 `.spanN` grid classes', - 'Only columns (`.col-*-*`) may be children of `.row`s' - ], - 'should complain when Bootstrap v2 grid classes are present.'); - test.done(); - }, - */ - /* 'rows outside containers': function (test) { test.expect(5); test.deepEqual(lintHtml(utf8Fixture('containers/fixed.html')), @@ -592,38 +556,6 @@ exports.bootlint = { }, */ /* - 'Glyphicons on non-empty elements': function (test) { - test.expect(3); - test.deepEqual(lintHtml(utf8Fixture('glyphicons/valid.html')), - [], - 'should not complain when the .glyphicon element has no text content or children.' - ); - test.deepEqual(lintHtml(utf8Fixture('glyphicons/on-elem-with-text.html')), - ['Glyphicon classes must only be used on elements that contain no text content and have no child elements.'], - 'should complain when Glyphicon is used on an element with text content.' - ); - test.deepEqual(lintHtml(utf8Fixture('glyphicons/on-elem-with-child.html')), - ['Glyphicon classes must only be used on elements that contain no text content and have no child elements.'], - 'should complain when Glyphicon is used on an element with child element(s).' - ); - test.done(); - }, - */ - /* - 'Glyphicons missing the .glyphicon class': function (test) { - test.expect(2); - test.deepEqual(lintHtml(utf8Fixture('glyphicons/valid.html')), - [], - 'should not complain when Glyphicon is used correctly.' - ); - test.deepEqual(lintHtml(utf8Fixture('glyphicons/missing-glyphicon-class.html')), - ['Found elements with a `.glyphicon-*` class that were missing the additional required `.glyphicon` class.'], - 'should complain when .glyphicon-* class is used without the .glyphicon class.' - ); - test.done(); - }, - */ - /* 'modal structure': function (test) { test.expect(7); test.deepEqual(lintHtml(utf8Fixture('modal/valid.html')), @@ -698,21 +630,7 @@ exports.bootlint = { }, */ /* - 'pull classes inside media': function (test) { - test.expect(2); - test.deepEqual(lintHtml(utf8Fixture('media/deprecated-pull-classes.html')), - ['Using `.pull-left` or `.pull-right` as part of the media object component is deprecated as of Bootstrap v3.3.0. Use `.media-left` or `.media-right` instead.'], - 'should complain about .pull-* classes in .media' - ); - test.deepEqual(lintHtml(utf8Fixture('media/media-classes.html')), - [], - 'should not complain about .media-left or .media-right classes.' - ); - test.done(); - }, - */ - - 'invalid nonexistent .col*-0 classes': function (test) { + 'invalid nonexistent .col-*-0 classes': function (test) { test.expect(4); test.deepEqual(lintHtml(utf8Fixture('grid/col-sm-0.html')), [ @@ -766,27 +684,6 @@ exports.bootlint = { }, */ /* - 'version 4 of Bootstrap': function (test) { - test.expect(5); - test.deepEqual(lintHtml(utf8Fixture('version-4/bootstrap-css.html')), - ['Detected what appears to be Bootstrap v4 or later. This version of Bootlint only supports Bootstrap v3.'], - 'should complain about version 4 of bootstrap.css.'); - test.deepEqual(lintHtml(utf8Fixture('version-4/bootstrap-min-css.html')), - ['Detected what appears to be Bootstrap v4 or later. This version of Bootlint only supports Bootstrap v3.'], - 'should complain about version 4 of bootstrap.min.css.'); - test.deepEqual(lintHtml(utf8Fixture('version-4/bootstrap-js.html')), - ['Detected what appears to be Bootstrap v4 or later. This version of Bootlint only supports Bootstrap v3.'], - 'should complain about version 4 of bootstrap.js.'); - test.deepEqual(lintHtml(utf8Fixture('version-4/bootstrap-min-js.html')), - ['Detected what appears to be Bootstrap v4 or later. This version of Bootlint only supports Bootstrap v3.'], - 'should complain about version 4 of bootstrap.min.js.'); - test.deepEqual(lintHtml(utf8Fixture('version-4/bootstrap-extensions-okay.html')), - [], - 'should not complain about v4.0.0+ libraries that just have "bootstrap" in their name.'); - test.done(); - }, - */ - /* 'carousel control target': function (test) { test.expect(3); test.deepEqual(lintHtml(utf8Fixture('carousel/indicators.html')), @@ -809,28 +706,6 @@ exports.bootlint = { }, */ /* - 'media pulls outside of media objects': function (test) { - test.expect(4); - test.deepEqual(lintHtml(utf8Fixture('media/media-classes.html')), - [], - 'should not complain about media pulls inside media objects.' - ); - test.deepEqual(lintHtml(utf8Fixture('media/misplaced-media-left.html')), - ['`.media-left` and `.media-right` should not be used outside of `.media` objects.'], - 'should complain about .media-left outside of a media object.' - ); - test.deepEqual(lintHtml(utf8Fixture('media/misplaced-media-right.html')), - ['`.media-left` and `.media-right` should not be used outside of `.media` objects.'], - 'should complain about .media-right outside of a media object.' - ); - test.deepEqual(lintHtml(utf8Fixture('media/media-pull-on-media.html')), - ['`.media-left` and `.media-right` should not be used outside of `.media` objects.'], - 'should complain about media pulls on .media itself.' - ); - test.done(); - }, - */ - /* 'navbar pulls outside of navbars': function (test) { test.expect(4); test.deepEqual(lintHtml(utf8Fixture('navbar/navbar-left-bad.html')),