From 79ca1090de40780f85d06a51e471710ab0d0fb77 Mon Sep 17 00:00:00 2001 From: Herst Date: Wed, 26 Dec 2018 22:57:49 +0100 Subject: [PATCH] Container-related checks Port E003 (misplaced .row), and remove E004 (nestable containers). --- src/bootlint.js | 10 ------- .../containers/nested-fixed-fixed.html | 29 ------------------- .../containers/nested-fixed-fluid.html | 29 ------------------- .../containers/nested-fluid-fixed.html | 29 ------------------- .../containers/nested-fluid-fluid.html | 29 ------------------- test/bootlint_test.js | 20 ------------- .../containers/ancestor.html | 0 .../containers/columns.html | 6 ++-- .../containers/fixed-row-same-elem.html | 0 .../containers/fixed.html | 0 .../containers/fluid-row-same-elem.html | 0 .../containers/fluid.html | 0 .../containers/missing.html | 0 13 files changed, 3 insertions(+), 149 deletions(-) delete mode 100644 test/_old_fixtures/containers/nested-fixed-fixed.html delete mode 100644 test/_old_fixtures/containers/nested-fixed-fluid.html delete mode 100644 test/_old_fixtures/containers/nested-fluid-fixed.html delete mode 100644 test/_old_fixtures/containers/nested-fluid-fluid.html rename test/{_old_fixtures => fixtures}/containers/ancestor.html (100%) rename test/{_old_fixtures => fixtures}/containers/columns.html (89%) rename test/{_old_fixtures => fixtures}/containers/fixed-row-same-elem.html (100%) rename test/{_old_fixtures => fixtures}/containers/fixed.html (100%) rename test/{_old_fixtures => fixtures}/containers/fluid-row-same-elem.html (100%) rename test/{_old_fixtures => fixtures}/containers/fluid.html (100%) rename test/{_old_fixtures => fixtures}/containers/missing.html (100%) diff --git a/src/bootlint.js b/src/bootlint.js index 66b46529..2d984f1a 100644 --- a/src/bootlint.js +++ b/src/bootlint.js @@ -586,7 +586,6 @@ var LocationIndex = _location.LocationIndex; } }; })()); - /* addLinter('E003', function lintContainers($, reporter) { var notAnyColClass = COL_CLASSES.map(function (colClass) { return ':not(' + colClass + ')'; @@ -607,15 +606,6 @@ var LocationIndex = _location.LocationIndex; reporter('Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid` or `.modal-body`', rowsOutsideColumnsAndContainers); } }); - */ - /* - addLinter('E004', function lintNestedContainers($, reporter) { - var nestedContainers = $('.container, .container-fluid').children('.container, .container-fluid'); - if (nestedContainers.length) { - reporter('Containers (`.container` and `.container-fluid`) are not nestable', nestedContainers); - } - }); - */ addLinter('E005', function lintRowAndColOnSameElem($, reporter) { var selector = COL_CLASSES.map(function (col) { return '.row' + col; diff --git a/test/_old_fixtures/containers/nested-fixed-fixed.html b/test/_old_fixtures/containers/nested-fixed-fixed.html deleted file mode 100644 index 59730c24..00000000 --- a/test/_old_fixtures/containers/nested-fixed-fixed.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - Test - - - - - - - - - -
-
-
- -
-
    -
  1. -
- - diff --git a/test/_old_fixtures/containers/nested-fixed-fluid.html b/test/_old_fixtures/containers/nested-fixed-fluid.html deleted file mode 100644 index 226fdca9..00000000 --- a/test/_old_fixtures/containers/nested-fixed-fluid.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - Test - - - - - - - - - -
-
-
- -
-
    -
  1. -
- - diff --git a/test/_old_fixtures/containers/nested-fluid-fixed.html b/test/_old_fixtures/containers/nested-fluid-fixed.html deleted file mode 100644 index 226fdca9..00000000 --- a/test/_old_fixtures/containers/nested-fluid-fixed.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - Test - - - - - - - - - -
-
-
- -
-
    -
  1. -
- - diff --git a/test/_old_fixtures/containers/nested-fluid-fluid.html b/test/_old_fixtures/containers/nested-fluid-fluid.html deleted file mode 100644 index 85e54cb6..00000000 --- a/test/_old_fixtures/containers/nested-fluid-fluid.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - Test - - - - - - - - - -
-
-
- -
-
    -
  1. -
- - diff --git a/test/bootlint_test.js b/test/bootlint_test.js index 7e8e51af..bbca8134 100644 --- a/test/bootlint_test.js +++ b/test/bootlint_test.js @@ -97,25 +97,6 @@ exports.bootlint = { 'should not complain when rows are children of `.modal-body`.'); test.done(); }, - */ - /* - 'nested containers': function (test) { - test.expect(4); - test.deepEqual(lintHtml(utf8Fixture('containers/nested-fixed-fixed.html')), - ['Containers (`.container` and `.container-fluid`) are not nestable'], - 'should complain when a container is within a container.'); - test.deepEqual(lintHtml(utf8Fixture('containers/nested-fixed-fluid.html')), - ['Containers (`.container` and `.container-fluid`) are not nestable'], - 'should complain when a container is within a container.'); - test.deepEqual(lintHtml(utf8Fixture('containers/nested-fluid-fluid.html')), - ['Containers (`.container` and `.container-fluid`) are not nestable'], - 'should complain when a container is within a container.'); - test.deepEqual(lintHtml(utf8Fixture('containers/nested-fluid-fixed.html')), - ['Containers (`.container` and `.container-fluid`) are not nestable'], - 'should complain when a container is within a container.'); - test.done(); - }, - */ /* 'viewport meta tag': function (test) { test.expect(2); @@ -138,7 +119,6 @@ exports.bootlint = { 'should complain when .row and .col* are used on the same element.'); test.done(); }, - /* 'row and container classes on same element': function (test) { test.expect(2); test.deepEqual(lintHtml(utf8Fixture('containers/fixed-row-same-elem.html')), diff --git a/test/_old_fixtures/containers/ancestor.html b/test/fixtures/containers/ancestor.html similarity index 100% rename from test/_old_fixtures/containers/ancestor.html rename to test/fixtures/containers/ancestor.html diff --git a/test/_old_fixtures/containers/columns.html b/test/fixtures/containers/columns.html similarity index 89% rename from test/_old_fixtures/containers/columns.html rename to test/fixtures/containers/columns.html index a041d908..3a13dc3e 100644 --- a/test/_old_fixtures/containers/columns.html +++ b/test/fixtures/containers/columns.html @@ -19,14 +19,14 @@
-
+
-
+
We can nest rows within columns.
-
Rest
+
Rest
diff --git a/test/_old_fixtures/containers/fixed-row-same-elem.html b/test/fixtures/containers/fixed-row-same-elem.html similarity index 100% rename from test/_old_fixtures/containers/fixed-row-same-elem.html rename to test/fixtures/containers/fixed-row-same-elem.html diff --git a/test/_old_fixtures/containers/fixed.html b/test/fixtures/containers/fixed.html similarity index 100% rename from test/_old_fixtures/containers/fixed.html rename to test/fixtures/containers/fixed.html diff --git a/test/_old_fixtures/containers/fluid-row-same-elem.html b/test/fixtures/containers/fluid-row-same-elem.html similarity index 100% rename from test/_old_fixtures/containers/fluid-row-same-elem.html rename to test/fixtures/containers/fluid-row-same-elem.html diff --git a/test/_old_fixtures/containers/fluid.html b/test/fixtures/containers/fluid.html similarity index 100% rename from test/_old_fixtures/containers/fluid.html rename to test/fixtures/containers/fluid.html diff --git a/test/_old_fixtures/containers/missing.html b/test/fixtures/containers/missing.html similarity index 100% rename from test/_old_fixtures/containers/missing.html rename to test/fixtures/containers/missing.html