scripts/lint
#! /bin/bash
#
# Run ESLint on source files
#
# Usage:
# {{go}} {{cmd}} [<glob>...]
#
# Without <glob> arguments, lints all project files. With one or more <glob>
# arguments, only lints files matching '<glob>.js'.
declare -r __GO_LINT_GLOB_ARGS=('--ignore' 'node_modules:coverage' '.' '.js')
_lint_tab_completion() {
local word_index="$1"
shift
@go 'glob' '--complete' "$((word_index + ${#__GO_LINT_GLOB_ARGS[@]}))" \
"${__GO_LINT_GLOB_ARGS[@]}" "${args[@]}"
}
_lint() {
if [[ "$1" == '--complete' ]]; then
# Tab completions
_lint_tab_completion "${@:2}"
return
fi
eslint $(@go 'glob' "${__GO_LINT_GLOB_ARGS[@]}" "$@")
}
_lint "$@"