Use ESLint instead of JSHint

Implement the swap and change various directives in the source code. The
"make hint" target becomes "make lint".

The change leads to quite some errors being reported by ESLint. These
will be fixed in subsequent commits.

Note the configuration enables just the recommended rules. Later I plan
to enable more rules to enforce the coding standard. The configuration
also sets the environment to "node", which is far from ideal as the
codebase contains a mix of CommonJS, Node.js and browser code. I hope to
clean this up at some point.
redux
David Majda 9 years ago
parent 48f5ea4b37
commit 768ece28e6

@ -0,0 +1,6 @@
{
"extends": "eslint:recommended",
"env": {
"node": true
}
}

@ -1,20 +0,0 @@
{
"curly": true,
"eqeqeq": true,
"evil": true,
"forin": true,
"freeze": true,
"immed": true,
"latedef": "nofunc",
"laxbreak": true,
"loopfunc": true,
"newcap": false,
"noarg": true,
"node": true,
"noempty": true,
"nonew": true,
"strict": true,
"trailing": true,
"validthis": true,
"-W082": false
}

@ -27,7 +27,7 @@ VERSION_FILE = VERSION
# ===== Executables =====
JSHINT = $(NODE_MODULES_BIN_DIR)/jshint
ESLINT = $(NODE_MODULES_BIN_DIR)/eslint
BROWSERIFY = $(NODE_MODULES_BIN_DIR)/browserify
UGLIFYJS = $(NODE_MODULES_BIN_DIR)/uglifyjs
JASMINE_NODE = $(NODE_MODULES_BIN_DIR)/jasmine-node
@ -82,14 +82,14 @@ spec:
benchmark:
$(BENCHMARK_RUN)
# Run JSHint on the source
hint:
$(JSHINT) \
# Run ESLint on the source
lint:
$(ESLINT) \
`find $(LIB_DIR) -name '*.js'` \
`find $(SPEC_DIR) -name '*.js' -and -not -path '$(SPEC_DIR)/vendor/*'` \
$(BENCHMARK_DIR)/*.js \
$(BENCHMARK_RUN) \
$(PEGJS)
.PHONY: all parser browser browserclean spec benchmark hint
.SILENT: all parser browser browserclean spec benchmark hint
.PHONY: all parser browser browserclean spec benchmark lint
.SILENT: all parser browser browserclean spec benchmark lint

@ -1,4 +1,4 @@
/* jshint node:false, browser:true, devel:true, jquery:true */
/* eslint-env browser, jquery */
/* global Runner */
$("#run").click(function() {

@ -43,13 +43,13 @@
"bin": "bin/pegjs",
"repository": "pegjs/pegjs",
"scripts": {
"test": "make hint && make spec"
"test": "make lint && make spec"
},
"devDependencies": {
"browserify": "11.2.0",
"eslint": "1.10.3",
"jasmine-node": "1.14.5",
"uglify-js": "2.4.24",
"jshint": "2.8.0"
"uglify-js": "2.4.24"
},
"engines": {
"node": ">=0.10"

@ -1,4 +1,4 @@
/* jshint jasmine:true */
/* eslint-env jasmine */
/* global PEG */
"use strict";

@ -1,4 +1,4 @@
/* jshint jasmine:true */
/* eslint-env jasmine */
/* global PEG */
"use strict";

@ -1,4 +1,4 @@
/* jshint jasmine:true */
/* eslint-env jasmine */
/* global PEG */
"use strict";

@ -1,4 +1,4 @@
/* jshint jasmine:true */
/* eslint-env jasmine */
/* global PEG */
"use strict";

@ -1,4 +1,4 @@
/* jshint jasmine:true */
/* eslint-env jasmine */
/* global PEG */
"use strict";

@ -1,4 +1,4 @@
/* jshint jasmine:true */
/* eslint-env jasmine */
/* global PEG */
"use strict";

@ -1,4 +1,4 @@
/* jshint jasmine:true */
/* eslint-env jasmine */
/* global PEG */
"use strict";

@ -1,4 +1,4 @@
/* jshint jasmine:true */
/* eslint-env jasmine */
/* global PEG */
"use strict";

@ -1,4 +1,4 @@
/* jshint jasmine:true */
/* eslint-env jasmine */
/* global PEG */
"use strict";

@ -1,4 +1,4 @@
/* jshint jasmine:true */
/* eslint-env jasmine */
/* global PEG */
"use strict";

@ -1,4 +1,4 @@
/* jshint jasmine:true */
/* eslint-env jasmine */
/* global PEG */
"use strict";

Loading…
Cancel
Save