mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-23 23:21:00 +01:00
Fix linter errors and warnings
This commit is contained in:
parent
bcf634faa8
commit
cedc65d9fa
@ -1,4 +1,7 @@
|
|||||||
/build
|
/build
|
||||||
/material
|
/material
|
||||||
/site
|
/site
|
||||||
/lib
|
|
||||||
|
# Temporary
|
||||||
|
/tests/regression
|
||||||
|
/lib/tasks/tests/regression
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
"rules": {
|
"rules": {
|
||||||
"array-callback-return": 2,
|
"array-callback-return": 2,
|
||||||
"array-bracket-spacing": 2,
|
"array-bracket-spacing": 2,
|
||||||
"arrow-body-style": 2,
|
"arrow-body-style": [2, "always"],
|
||||||
"arrow-parens": [2, "as-needed"],
|
"arrow-parens": [2, "as-needed"],
|
||||||
"arrow-spacing": 2,
|
"arrow-spacing": 2,
|
||||||
"block-scoped-var": 2,
|
"block-scoped-var": 2,
|
||||||
|
@ -39,7 +39,6 @@ addons:
|
|||||||
# Install dependencies
|
# Install dependencies
|
||||||
before_script:
|
before_script:
|
||||||
- sudo pip install -r requirements.txt
|
- sudo pip install -r requirements.txt
|
||||||
- npm install
|
|
||||||
|
|
||||||
# Perform build and tests
|
# Perform build and tests
|
||||||
script: npm run build
|
script: npm run build
|
||||||
|
@ -60,8 +60,8 @@ const args = yargs
|
|||||||
* Override gulp.src() for nicer error handling.
|
* Override gulp.src() for nicer error handling.
|
||||||
*/
|
*/
|
||||||
const src = gulp.src
|
const src = gulp.src
|
||||||
gulp.src = (...glob) =>
|
gulp.src = (...glob) => {
|
||||||
src.apply(gulp, glob)
|
return src.apply(gulp, glob)
|
||||||
.pipe(
|
.pipe(
|
||||||
plumber(function(error) {
|
plumber(function(error) {
|
||||||
util.log(util.colors.red(
|
util.log(util.colors.red(
|
||||||
@ -86,12 +86,14 @@ gulp.src = (...glob) =>
|
|||||||
if (args._[0] !== "watch")
|
if (args._[0] !== "watch")
|
||||||
throw error
|
throw error
|
||||||
}))
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helper function to load a task
|
* Helper function to load a task
|
||||||
*/
|
*/
|
||||||
const load = task =>
|
const load = task => {
|
||||||
require(`./${config.lib}/tasks/${task}`)(gulp, config, args)
|
require(`./${config.lib}/tasks/${task}`)(gulp, config, args)
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
* Images
|
* Images
|
||||||
@ -114,12 +116,12 @@ gulp.task("assets:images:build:svg",
|
|||||||
*/
|
*/
|
||||||
gulp.task("assets:images:build", args.clean ? [
|
gulp.task("assets:images:build", args.clean ? [
|
||||||
"assets:images:clean"
|
"assets:images:clean"
|
||||||
] : [], () =>
|
] : [], () => {
|
||||||
gulp.start([
|
return gulp.start([
|
||||||
"assets:images:build:ico",
|
"assets:images:build:ico",
|
||||||
"assets:images:build:svg"
|
"assets:images:build:svg"
|
||||||
])
|
])
|
||||||
)
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clean images generated by build
|
* Clean images generated by build
|
||||||
@ -152,7 +154,7 @@ gulp.task("assets:javascripts:build", (args.clean ? [
|
|||||||
] : []).concat(args.lint ? [
|
] : []).concat(args.lint ? [
|
||||||
"assets:javascripts:lint"
|
"assets:javascripts:lint"
|
||||||
] : []), () => {
|
] : []), () => {
|
||||||
gulp.start([
|
return gulp.start([
|
||||||
"assets:javascripts:build:application",
|
"assets:javascripts:build:application",
|
||||||
"assets:javascripts:build:modernizr"
|
"assets:javascripts:build:modernizr"
|
||||||
])
|
])
|
||||||
|
15
bin/lint
15
bin/lint
@ -27,5 +27,18 @@ if [ ! -d ../node_modules ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run command
|
# Run ESLint
|
||||||
|
$(pwd)/node_modules/.bin/eslint .
|
||||||
|
ESLINT=$?
|
||||||
|
|
||||||
|
# Run Sass-Lint
|
||||||
$(pwd)/node_modules/.bin/sass-lint -c .sass-lint.yml -vq
|
$(pwd)/node_modules/.bin/sass-lint -c .sass-lint.yml -vq
|
||||||
|
SASSLINT=$?
|
||||||
|
|
||||||
|
# If one command failed, exit with error
|
||||||
|
if [ $ESLINT == 1 ] || [ $SASSLINT == 1 ]; then
|
||||||
|
exit 1
|
||||||
|
fi;
|
||||||
|
|
||||||
|
# Otherwise return with success
|
||||||
|
exit 0
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
# Check if "npm install" was executed
|
# Check if "npm install" was executed
|
||||||
if [ ! -d $(pwd)/node_modules ]; then
|
if [ ! -d $(pwd)/node_modules ]; then
|
||||||
ls $(pwd)
|
|
||||||
echo "\"node_modules\" not found:"
|
echo "\"node_modules\" not found:"
|
||||||
echo "npm install"
|
echo "npm install"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -40,7 +40,7 @@ export default (gulp, config, args) => {
|
|||||||
stream({
|
stream({
|
||||||
entry: [
|
entry: [
|
||||||
"whatwg-fetch",
|
"whatwg-fetch",
|
||||||
"application.js",
|
"application.js"
|
||||||
],
|
],
|
||||||
output: {
|
output: {
|
||||||
filename: "application.js",
|
filename: "application.js",
|
||||||
|
Loading…
Reference in New Issue
Block a user