Remove E016, and E021
Port W007, W016, and E047
This commit is contained in:
Herst 2019-08-16 10:31:38 +02:00
Родитель c499d3ad6c
Коммит 3429120ef2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: C098DB07E9C7D708
14 изменённых файлов: 2 добавлений и 298 удалений

Просмотреть файл

@ -440,14 +440,12 @@ var LocationIndex = _location.LocationIndex;
}
});
*/
/*
addLinter('W007', function lintBtnType($, reporter) {
var badBtnType = $('button:not([type="submit"], [type="reset"], [type="button"])');
if (badBtnType.length) {
reporter('Found one or more `<button>`s missing a `type` attribute.', badBtnType);
}
});
*/
/*
addLinter('W008', function lintTooltipsInBtnGroups($, reporter) {
var nonBodyContainers = $('.btn-group [data-toggle="tooltip"]:not([data-container="body"]), .btn-group [data-toggle="popover"]:not([data-container="body"])');
@ -532,22 +530,18 @@ var LocationIndex = _location.LocationIndex;
}
});
});
/*
addLinter('W016', function lintDisabledClassOnButton($, reporter) {
var btnsWithDisabledClass = $('button.btn.disabled, input.btn.disabled');
if (btnsWithDisabledClass.length) {
reporter('Using the `.disabled` class on a `<button>` or `<input>` only changes the appearance of the element. It doesn\'t prevent the user from interacting with the element (for example, clicking on it or focusing it). If you want to truly disable the element, use the `disabled` attribute instead.', btnsWithDisabledClass);
}
});
*/
/*
addLinter('W017', function lintInputsMissingTypeAttr($, reporter) {
var inputsMissingTypeAttr = $('input:not([type])');
if (inputsMissingTypeAttr.length) {
reporter('Found one or more `<input>`s missing a `type` attribute.', inputsMissingTypeAttr);
}
});
*/
addLinter('E001', (function () {
var MISSING_DOCTYPE = 'Document is missing a DOCTYPE declaration';
var NON_HTML5_DOCTYPE = 'Document declares a non-HTML5 DOCTYPE';
@ -713,14 +707,6 @@ var LocationIndex = _location.LocationIndex;
});
*/
/*
addLinter('E016', function lintBtnToggle($, reporter) {
var badBtnToggle = $('.btn.dropdown-toggle ~ .btn');
if (badBtnToggle.length) {
reporter('`.btn.dropdown-toggle` must be the last button in a button group.', badBtnToggle);
}
});
*/
/*
addLinter('E017', function lintBlockCheckboxes($, reporter) {
var badCheckboxes = $('.checkbox').filter(function (i, div) {
return $(div).filter(':has(>label>input[type="checkbox"])').length <= 0;
@ -768,20 +754,6 @@ var LocationIndex = _location.LocationIndex;
}
});
*/
/*
addLinter('E021', function lintButtonsCheckedActive($, reporter) {
var selector = [
'[data-toggle="buttons"]>label:not(.active)>input[type="checkbox"][checked]',
'[data-toggle="buttons"]>label.active>input[type="checkbox"]:not([checked])',
'[data-toggle="buttons"]>label:not(.active)>input[type="radio"][checked]',
'[data-toggle="buttons"]>label.active>input[type="radio"]:not([checked])'
].join(',');
var mismatchedButtonInputs = $(selector);
if (mismatchedButtonInputs.length) {
reporter('`.active` class used without the `checked` attribute (or vice-versa) in a button group using the button.js plugin', mismatchedButtonInputs);
}
});
*/
addLinter('E022', function lintModalsWithinOtherComponents($, reporter) {
var selector = [
'.table .modal',
@ -1052,14 +1024,12 @@ var LocationIndex = _location.LocationIndex;
reporter('`.modal` elements must have a `tabindex` attribute.', modalsWithoutTabindex);
}
});
/*
addLinter('E047', function lintBtnElements($, reporter) {
var btns = $('.btn:not(a,button,input,label)');
if (btns.length) {
reporter('`.btn` should only be used on `<a>`, `<button>`, `<input>`, or `<label>` elements.', btns);
}
});
*/
addLinter('E048', function lintModalRole($, reporter) {
var modals = $('.modal:not([role="dialog"])');
if (modals.length) {

Просмотреть файл

@ -1,37 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Test</title>
<link rel="stylesheet" href="../../../node_modules/qunit/qunit/qunit.css">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="../../../node_modules/jquery/dist/jquery.min.js"></script>
<script src="../../../node_modules/qunit/qunit/qunit.js"></script>
<script src="../../../dist/browser/bootlint.js"></script>
<script src="../generic-qunit.js"></script>
</head>
<body>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="checkbox" checked> Checked without active
</label>
<label class="btn btn-primary active">
<input type="checkbox"> Active without checked
</label>
<label class="btn btn-primary">
<input type="checkbox"> Option 3
</label>
</div>
<div id="qunit"></div>
<ol id="bootlint">
<li data-lint="`.active` class used without the `checked` attribute (or vice-versa) in a button group using the button.js plugin"></li>
</ol>
</body>
</html>

Просмотреть файл

@ -1,37 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Test</title>
<link rel="stylesheet" href="../../../node_modules/qunit/qunit/qunit.css">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="../../../node_modules/jquery/dist/jquery.min.js"></script>
<script src="../../../node_modules/qunit/qunit/qunit.js"></script>
<script src="../../../dist/browser/bootlint.js"></script>
<script src="../generic-qunit.js"></script>
</head>
<body>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="radio" name="options" id="option1" checked /> Checked without active
</label>
<label class="btn btn-primary active">
<input type="radio" name="options" id="option2"> Active without checked
</label>
<label class="btn btn-primary">
<input type="radio" name="options" id="option3"> Option 3
</label>
</div>
<div id="qunit"></div>
<ol id="bootlint">
<li data-lint="`.active` class used without the `checked` attribute (or vice-versa) in a button group using the button.js plugin"></li>
</ol>
</body>
</html>

Просмотреть файл

@ -1,47 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Test</title>
<link rel="stylesheet" href="../../../node_modules/qunit/qunit/qunit.css">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="../../../node_modules/jquery/dist/jquery.min.js"></script>
<script src="../../../node_modules/qunit/qunit/qunit.js"></script>
<script src="../../../dist/browser/bootlint.js"></script>
<script src="../generic-qunit.js"></script>
</head>
<body>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="checkbox" checked> Option 1 (pre-checked)
</label>
<label class="btn btn-primary">
<input type="checkbox"> Option 2
</label>
<label class="btn btn-primary">
<input type="checkbox"> Option 3
</label>
</div>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="radio" name="options" id="option1" checked /> Option 1 (preselected)
</label>
<label class="btn btn-primary">
<input type="radio" name="options" id="option2"> Option 2
</label>
<label class="btn btn-primary">
<input type="radio" name="options" id="option3"> Option 3
</label>
</div>
<div id="qunit"></div>
<ol id="bootlint"></ol>
</body>
</html>

Просмотреть файл

@ -1,41 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Test</title>
<link rel="stylesheet" href="../../../node_modules/qunit/qunit/qunit.css">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="../../../node_modules/jquery/dist/jquery.min.js"></script>
<script src="../../../node_modules/qunit/qunit/qunit.js"></script>
<script src="../../../dist/browser/bootlint.js"></script>
<script src="../generic-qunit.js"></script>
</head>
<body>
<div class="btn-group">
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
<button type="button" class="btn btn-danger">Action</button>
</div>
<div id="qunit"></div>
<ol id="bootlint">
<li data-lint="`.btn.dropdown-toggle` must be the last button in a button group."></li>
</ol>
</body>
</html>

Просмотреть файл

@ -1,71 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Test</title>
<link rel="stylesheet" href="../../../node_modules/qunit/qunit/qunit.css">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="../../../node_modules/jquery/dist/jquery.min.js"></script>
<script src="../../../node_modules/qunit/qunit/qunit.js"></script>
<script src="../../../dist/browser/bootlint.js"></script>
<script src="../generic-qunit.js"></script>
</head>
<body>
<!-- Split btn dropdowns -->
<div class="btn-group">
<button type="button" class="btn btn-danger">Action</button>
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div>
<!-- nested btn groups with dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-default">1</button>
<button type="button" class="btn btn-default">2</button>
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
Dropdown
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Dropdown link</a></li>
<li><a href="#">Dropdown link</a></li>
</ul>
</div>
</div>
<!-- Single button -->
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
Action <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div>
<div id="qunit"></div>
<ol id="bootlint"></ol>
</body>
</html>

Просмотреть файл

@ -283,19 +283,6 @@ exports.bootlint = {
test.done();
},
*/
/*
'dropdown-toggle comes before btn': function (test) {
test.expect(2);
test.deepEqual(lintHtml(utf8Fixture('buttons/btn-toggle.html')),
[],
'should not complain when correct .dropdown-toggle markup is used.');
test.deepEqual(lintHtml(utf8Fixture('buttons/btn-toggle-after-btn.html')),
['`.btn.dropdown-toggle` must be the last button in a button group.'],
'should complain when `.dropdown-toggle` is on the left side of a btn');
test.done();
},
*/
/*
'buttons should set type': function (test) {
test.expect(2);
test.deepEqual(lintHtml(utf8Fixture('buttons/without-type.html')),
@ -306,22 +293,19 @@ exports.bootlint = {
'should not complain when type is set on buttons');
test.done();
},
*/
/*
'use disabled attribute on button.btn and input.btn instead of .disabled': function (test) {
test.expect(3);
test.deepEqual(lintHtml(utf8Fixture('buttons/button-disabled-class.html')),
['Using the `.disabled` class on a `<button>` or `<input>` only changes the appearance of the element. It doesn\'t prevent the user from interacting with the element (for example, clicking on it or focusing it). If you want to truly disable the element, use the `disabled` attribute instead.'],
'should complain when Bootstrap v2 grid classes are present.');
'should complain when disabled class is set on buttons');
test.deepEqual(lintHtml(utf8Fixture('buttons/input-btn-disabled-class.html')),
['Using the `.disabled` class on a `<button>` or `<input>` only changes the appearance of the element. It doesn\'t prevent the user from interacting with the element (for example, clicking on it or focusing it). If you want to truly disable the element, use the `disabled` attribute instead.'],
'should complain when Bootstrap v2 grid classes are present.');
'should complain when disabled class is set an element styled as a buttons');
test.deepEqual(lintHtml(utf8Fixture('buttons/disabled-attribute.html')),
[],
'should not complain when disabled attribute is set on buttons');
test.done();
},
*/
/*
'inputs should set type': function (test) {
test.expect(2);
@ -367,21 +351,6 @@ exports.bootlint = {
},
*/
/*
'.active class and checked attribute for buttons plugin do not match': function (test) {
test.expect(3);
test.deepEqual(lintHtml(utf8Fixture('buttons-plugin/valid.html')),
[],
'should not complain when .active and checked correspond correctly.');
test.deepEqual(lintHtml(utf8Fixture('buttons-plugin/checkbox-bad.html')),
['`.active` class used without the `checked` attribute (or vice-versa) in a button group using the button.js plugin'],
'should complain when .active and checked do not correspond correctly in a checkbox button group.');
test.deepEqual(lintHtml(utf8Fixture('buttons-plugin/radio-bad.html')),
['`.active` class used without the `checked` attribute (or vice-versa) in a button group using the button.js plugin'],
'should complain when .active and checked do not correspond correctly in a radio button group.');
test.done();
},
*/
/*
'modals within other components': function (test) {
test.expect(2);
test.deepEqual(lintHtml(utf8Fixture('modal/within-table.html')),
@ -813,7 +782,6 @@ exports.bootlint = {
test.done();
},
*/
/*
'.btn not on <a>/<button>/<input>/<label>': function (test) {
test.expect(2);
test.deepEqual(lintHtml(utf8Fixture('buttons/btn-incorrect-element.html')),
@ -826,7 +794,6 @@ exports.bootlint = {
);
test.done();
},
*/
/*
'modal missing role dialog': function (test) {
test.expect(1);

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл