Add eslint config and run eslint if installed

This commit is contained in:
Łukasz Mierzwa
2017-06-01 19:58:49 -07:00
parent 1bafe12c29
commit 50fd2238d0
4 changed files with 36 additions and 8 deletions
+1
View File
@@ -0,0 +1 @@
assets/static/lru.js
+27
View File
@@ -0,0 +1,27 @@
env:
browser: true
jquery: true
extends:
- eslint:recommended
rules:
indent:
- error
- 4
linebreak-style:
- error
- unix
quotes:
- error
- double
array-bracket-spacing:
- warn
- always
block-spacing:
- warn
- always
brace-style:
- warn
- 1tbs
camelcase: warn
no-console: off
no-use-before-define: error
+3 -7
View File
@@ -6,15 +6,11 @@ go:
go_import_path: github.com/cloudflare/unsee
# nodejs is needed so that we can install jshint
addons:
apt:
packages:
- nodejs
# install jshint, it's used for linting js files (needs nodejs)
# install jshint & eslint, it's used for linting js files (needs nodejs)
before_script:
- nvm install 6
- npm install jshint
- npm install eslint
script:
- make test
+5 -1
View File
@@ -19,8 +19,9 @@ ifdef DEBUG
DOCKER_ARGS = -v $(CURDIR)/assets:$(CURDIR)/assets:ro
endif
# detect if jshint is installed
# detect if jshint and/or eslint is installed
JSHINT := $(shell which jshint)
ESLINT := $(shell which eslint)
.DEFAULT_GOAL := $(NAME)
@@ -81,6 +82,9 @@ lint: .build/deps.ok
ifneq ($(JSHINT),)
@$(JSHINT) assets/static/*.js
endif
ifneq ($(ESLINT),)
@$(ESLINT) assets/static/*.js
endif
.PHONY: test
test: lint bindata_assetfs.go