Merge pull request #1033 from waylan/linter

Add linters for JS and CSS.
This commit is contained in:
Waylan Limberg
2016-10-09 20:51:12 -04:00
committed by GitHub
8 changed files with 106 additions and 44 deletions

45
.csslintrc Normal file
View File

@@ -0,0 +1,45 @@
--exclude-list = mkdocs/themes/mkdocs/css/bootstrap-custom.min.css,
mkdocs/themes/readthedocs/css/bootstrap-custom.min.css,
mkdocs/themes/mkdocs/css/font-awesome-4.5.0.css,
mkdocs/themes/readthedocs/css/font-awesome-4.5.0.css,
mkdocs/themes/mkdocs/css/highlight.css,
mkdocs/themes/readthedocs/css/highlight.css,
mkdocs/themes/readthedocs/css/theme.css
--errors = known-properties,
box-sizing,
outline-none,
bulletproof-font-face,
compatible-vendor-prefixes,
errors,
duplicate-background-images,
duplicate-properties,
empty-rules,
selector-max-approaching,
gradients,
floats,
font-faces,
font-sizes,
shorthand,
import,
import-ie-limit,
text-indent,
rules-count,
regex-selectors,
selector-max,
selector-newline,
star-property-hack,
underscore-property-hack,
universal-selector,
unqualified-attributes,
vendor-prefix,
zero-units,
overqualified-elements,
unique-headings,
qualified-headings,
ids,
display-property-grouping,
fallback-colors,
box-model,
important,
adjoining-classes
--ignore = order-alphabetical

7
.jshintignore Normal file
View File

@@ -0,0 +1,7 @@
mkdocs/themes/**/js/highlight.pack.js
mkdocs/themes/**/js/jquery-**.min.js
mkdocs/themes/**/js/bootstrap-**.min.js
mkdocs/themes/**/js/modernizr-**.min.js
mkdocs/assets/search/mkdocs/js/require.js
mkdocs/assets/search/mkdocs/js/mustache.min.js
mkdocs/assets/search/mkdocs/js/lunr.min.js

View File

@@ -5,6 +5,8 @@ env:
- TOXENV=flake8
- TOXENV=markdown-lint
- TOXENV=linkchecker
- TOXENV=jshint
- TOXENV=csslint
- TOXENV=py26-integration
- TOXENV=py26-min-req
- TOXENV=py26-unittests
@@ -29,6 +31,8 @@ env:
install:
- pip install tox
- gem install mdl
- npm install -g jshint
- npm install -g csslint
script:
- git clean -f -d -x
- tox

View File

@@ -70,7 +70,7 @@ require([
*/
jQuery('#mkdocs_search_modal a').click(function(){
jQuery('#mkdocs_search_modal').modal('hide');
})
});
}
};

View File

@@ -5,29 +5,29 @@ body {
background-color: #f8f8f8;
}
body > div.container {
body > .container {
min-height: 400px;
}
ul.nav li.main {
ul.nav .main {
font-weight: bold;
}
div.col-md-3 {
.col-md-3 {
padding-left: 0;
}
div.col-md-9 {
.col-md-9 {
padding-bottom: 100px;
}
div.source-links {
.source-links {
float: right;
}
div.col-md-9 img {
.col-md-9 img {
max-width: 100%;
display: inline;
display: inline-block;
padding: 4px;
line-height: 1.428571429;
background-color: #fff;
@@ -36,10 +36,6 @@ div.col-md-9 img {
margin: 20px auto 30px auto;
}
h1, h2, h3 {
color: #444;
}
/*
* The code below adds some padding to the top of the current anchor target so
* that, when navigating to it, the header isn't hidden by the navbar at the
@@ -60,7 +56,7 @@ h1, h2, h3 {
animation: 0s 1s forwards collapse-anchor-padding-1;
}
body.clicky :target::before {
.clicky :target::before {
animation-name: collapse-anchor-padding-2;
}
@@ -79,11 +75,13 @@ body.clicky :target::before {
}
h1 {
color: #444;
font-weight: 400;
font-size: 42px;
}
h2, h3, h4, h5, h6 {
color: #444;
font-weight: 300;
}
@@ -117,6 +115,8 @@ pre code {
border: none;
white-space: pre;
word-wrap: normal;
font-family: monospace,serif;
font-size: 12px;
}
a code {
@@ -127,11 +127,6 @@ a:hover code, a:focus code {
color: #157AB5;
}
code, kbd, pre, samp {
font-family: monospace,serif;
font-size: 12px !important;
}
footer {
margin-top: 30px;
margin-bottom: 10px;
@@ -151,11 +146,11 @@ footer {
*/
/* By default it's not affixed in mobile views, so undo that */
.bs-sidebar.affix {
.bs-sidebar.affix { /* csslint allow: adjoining-classes */
position: static;
}
.bs-sidebar.well {
.bs-sidebar.well { /* csslint allow: adjoining-classes */
padding: 0;
max-height: 90%;
overflow-y: auto;
@@ -205,27 +200,27 @@ footer {
display: block;
}
/* Widen the fixed sidebar */
.bs-sidebar.affix,
.bs-sidebar.affix-bottom {
.bs-sidebar.affix, /* csslint allow: adjoining-classes */
.bs-sidebar.affix-bottom { /* csslint allow: adjoining-classes */
width: 213px;
}
.bs-sidebar.affix {
.bs-sidebar.affix { /* csslint allow: adjoining-classes */
position: fixed; /* Undo the static from mobile first approach */
top: 80px;
}
.bs-sidebar.affix-bottom {
.bs-sidebar.affix-bottom { /* csslint allow: adjoining-classes */
position: absolute; /* Undo the static from mobile first approach */
}
.bs-sidebar.affix-bottom .bs-sidenav,
.bs-sidebar.affix .bs-sidenav {
.bs-sidebar.affix-bottom .bs-sidenav, /* csslint allow: adjoining-classes */
.bs-sidebar.affix .bs-sidenav { /* csslint allow: adjoining-classes */
margin-top: 0;
margin-bottom: 0;
}
}
@media (min-width: 1200px) {
/* Widen the fixed sidebar again */
.bs-sidebar.affix-bottom,
.bs-sidebar.affix {
.bs-sidebar.affix-bottom, /* csslint allow: adjoining-classes */
.bs-sidebar.affix { /* csslint allow: adjoining-classes */
width: 263px;
}
}
@@ -251,19 +246,19 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head
text-align: left;
}
.admonition.note {
.admonition.note { /* csslint allow: adjoining-classes */
color: #3a87ad;
background-color: #d9edf7;
border-color: #bce8f1;
}
.admonition.warning {
.admonition.warning { /* csslint allow: adjoining-classes */
color: #c09853;
background-color: #fcf8e3;
border-color: #fbeed5;
}
.admonition.danger {
.admonition.danger { /* csslint allow: adjoining-classes */
color: #b94a48;
background-color: #f2dede;
border-color: #eed3d7;
@@ -311,11 +306,11 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head
border-left-color: #fff;
}
.dropdown-submenu.pull-left {
.dropdown-submenu.pull-left { /* csslint allow: adjoining-classes */
float: none;
}
.dropdown-submenu.pull-left>.dropdown-menu {
.dropdown-submenu.pull-left>.dropdown-menu { /* csslint allow: adjoining-classes */
left: -100%;
margin-left: 10px;
-webkit-border-radius: 6px 0 6px 6px;

View File

@@ -90,7 +90,7 @@ a:visited code {
*
* https://github.com/mkdocs/mkdocs/issues/411
*/
code.cs, code.c {
pre .cs, pre .c {
font-weight: inherit;
font-style: inherit;
}
@@ -113,21 +113,20 @@ code.cs, code.c {
* Additions specific to the search functionality provided by MkDocs
*/
#mkdocs-search-results article h3
{
.search-results article {
margin-top: 23px;
border-top: 1px solid #E1E4E5;
padding-top: 24px;
}
#mkdocs-search-results article:first-child h3 {
.search-results article:first-child {
border-top: none;
}
#mkdocs-search-query{
form .search-query {
width: 100%;
border-radius: 50px;
padding: 6px 12px;
padding: 6px 12px; /* csslint allow: box-model */
border-color: #D1D4D5;
}
@@ -151,9 +150,11 @@ code.cs, code.c {
*
* https://github.com/mkdocs/mkdocs/issues/656
*/
div.admonition code {
.admonition code {
color: #404040;
border: 1px solid #c7c9cb;
border: 1px solid rgba(0, 0, 0, 0.2);
background: #f8fbfd;
background: rgba(255, 255, 255, 0.7);
}
@@ -164,7 +165,7 @@ code.cs, code.c {
* https://github.com/mkdocs/mkdocs/issues/834
* https://github.com/mkdocs/mkdocs/pull/1034
*/
.rst-content table.docutils {
.rst-content .section .docutils {
width: 100%;
overflow: auto;
display: block;
@@ -172,6 +173,6 @@ code.cs, code.c {
}
td, th {
border: 1px solid #e1e4e5 !important;
border: 1px solid #e1e4e5 !important; /* csslint allow: important */
border-collapse: collapse;
}

View File

@@ -14,7 +14,7 @@
<input name="q" id="mkdocs-search-query" type="text" class="search_input search-query ui-autocomplete-input" placeholder="Search the Docs" autocomplete="off" autofocus>
</form>
<div id="mkdocs-search-results">
<div id="mkdocs-search-results" class="search-results">
Searching...
</div>

12
tox.ini
View File

@@ -1,7 +1,7 @@
[tox]
envlist =
py{26,27,33,34,35}-{unittests,integration,min-req},
flake8, markdown-lint, linkchecker
flake8, markdown-lint, linkchecker, jshint, csslint
[testenv]
passenv = LANG
@@ -32,3 +32,13 @@ deps=
commands=
{envpython} -m mkdocs.tests.integration --output={envtmpdir}/builds
linkchecker {envtmpdir}/builds/
[testenv:jshint]
whitelist_externals = jshint
passenv=*
commands=jshint mkdocs/
[testenv:csslint]
whitelist_externals = csslint
passenv=*
commands=csslint mkdocs/