diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..3ae0c77 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,18 @@ +{ + "env": { "shared-node-browser":true }, + "globals": {}, + "parserOptions": { + "ecmaVersion": 3, + }, + "plugins": [ "html", "json" ], + "!extends": "eslint:recommended", + "rules": { + "no-console": 0, + "no-bitwise": 0, + "curly": 0, + "comma-style": [ 2, "last" ], + "no-trailing-spaces": 2, + "semi": [ 2, "always" ], + "comma-dangle": [ 2, "never" ] + } +} diff --git a/.travis.yml b/.travis.yml index ecbe283..c529897 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: node_js node_js: + - "8" - "7" - "6" - "5" @@ -8,8 +9,8 @@ node_js: - "0.10" - "0.8" before_install: - - "npm install -g npm@next" - - "npm install -g mocha" + - "npm install -g npm@4.3.0" + - "npm install -g mocha@2.x voc" - "npm install codepage" - "npm install blanket" - "npm install coveralls mocha-lcov-reporter" diff --git a/Makefile b/Makefile index fc2ecd9..b18c1a2 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,8 @@ ULIB=$(shell echo $(LIB) | tr a-z A-Z) DEPS=$(sort $(wildcard bits/*.js)) TARGET=$(LIB).js FLOWTARGET=$(LIB).flow.js +FLOWTGTS=$(TARGET) $(AUXTARGETS) +CLOSURE=/usr/local/lib/node_modules/google-closure-compiler/compiler.jar ## Main Targets @@ -19,14 +21,14 @@ all: $(TARGET) ## Build library and auxiliary scripts lib: OUTDIR=$(PWD)/lib make -C bits -$(TARGET) $(AUXTARGETS): %.js : %.flow.js +$(FLOWTGTS): %.js : %.flow.js node -e 'process.stdout.write(require("fs").readFileSync("$<","utf8").replace(/^[ \t]*\/\*[:#][^*]*\*\/\s*(\n)?/gm,"").replace(/\/\*[:#][^*]*\*\//gm,""))' > $@ $(FLOWTARGET): $(DEPS) lib cp lib/$(REQS).js $(FLOWTARGET) bits/01_version.js: package.json - echo "PRINTJ.version = '"`grep version package.json | awk '{gsub(/[^0-9a-z\.-]/,"",$$2); print $$2}'`"';" > $@ + echo "$(ULIB).version = '"`grep version package.json | awk '{gsub(/[^0-9a-z\.-]/,"",$$2); print $$2}'`"';" > $@ .PHONY: clean clean: clean-stress ## Remove targets and build artifacts @@ -69,12 +71,19 @@ clean-stress: ## Remove stress tests ## Code Checking .PHONY: lint -lint: $(TARGET) ## Run jshint and jscs checks +lint: $(TARGET) ## Run eslint checks + @eslint --ext .js,.njs,.json,.html,.htm $(TARGET) $(AUXTARGETS) $(CMDS) $(HTMLLINT) package.json bower.json + if [ -e $(CLOSURE) ]; then java -jar $(CLOSURE) $(FLOWTARGET) --jscomp_warning=reportUnknownTypes >/dev/null; fi + +.PHONY: old-lint +old-lint: $(TARGET) ## Run jshint and jscs checks @jshint --show-non-errors $(TARGET) $(AUXTARGETS) @jshint --show-non-errors $(CMDS) @jshint --show-non-errors package.json @jshint --show-non-errors --extract=always $(HTMLLINT) @jscs lib/*.js + if [ -e $(CLOSURE) ]; then java -jar $(CLOSURE) $(FLOWTARGET) --jscomp_warning=reportUnknownTypes >/dev/null; fi + .PHONY: flow flow: lint ## Run flow checker