Add better lint checking.

Summary:
Make the lint checker check more files. Also, make arc run the
linter.

Test Plan:
 - `arc lint`
 - `make lint`

Reviewers: kevinb, alpert

Reviewed By: alpert

Differential Revision: https://phabricator.khanacademy.org/D17509
This commit is contained in:
Emily Eisenberg 2015-04-22 18:55:20 -07:00
parent eef108b2dd
commit af8c1307f7
6 changed files with 26 additions and 8 deletions

View File

@ -1,4 +1,8 @@
{
"project_id": "KaTeX",
"conduit_uri": "https://phabricator.khanacademy.org/"
"conduit_uri": "https://phabricator.khanacademy.org/",
"lint.engine": "ArcanistSingleLintEngine",
"lint.engine.single.linter": "ArcanistScriptAndRegexLinter",
"linter.scriptandregex.regex": "/^(?P<file>\\S+): line (?P<line>\\d+), col \\d+, (?P<message>.*)$/m",
"linter.scriptandregex.script": "make lint || true"
}

View File

@ -12,7 +12,7 @@ export UGLIFYJS = $(realpath ./node_modules/.bin/uglifyjs) \
setup:
npm install
lint: katex.js $(wildcard src/*.js)
lint: katex.js server.js cli.js $(wildcard src/*.js) $(wildcard test/*.js) $(wildcard contrib/*/*.js)
./node_modules/.bin/jshint $^
build/katex.js: katex.js $(wildcard src/*.js)

View File

@ -1,3 +1,9 @@
/* global beforeEach: false */
/* global jasmine: false */
/* global expect: false */
/* global it: false */
/* global describe: false */
var splitAtDelimiters = require("./splitAtDelimiters");
beforeEach(function() {
@ -28,6 +34,7 @@ beforeEach(function() {
var correct = result[i];
var good = true;
var diff;
if (real.type !== correct.type) {
good = false;

View File

@ -1,3 +1,5 @@
/* global katex */
var splitAtDelimiters = require("./splitAtDelimiters");
var splitWithDelimiters = function(text, delimiters) {
@ -48,9 +50,8 @@ var renderElem = function(elem, delimiters, ignoredTags) {
if (shouldRender) {
renderElem(childNode, delimiters, ignoredTags);
}
} else {
// Something else, ignore
}
// Otherwise, it's something else, and ignore it.
}
};

View File

@ -61,10 +61,10 @@ app.get("/katex.css", function(req, res, next) {
});
});
app.use(express.static(path.join(__dirname, "static")));
app.use(express.static(path.join(__dirname, "build")));
app.use("/test", express.static(path.join(__dirname, "test")));
app.use("/contrib", express.static(path.join(__dirname, "contrib")));
app.use(express["static"](path.join(__dirname, "static")));
app.use(express["static"](path.join(__dirname, "build")));
app.use("/test", express["static"](path.join(__dirname, "test")));
app.use("/contrib", express["static"](path.join(__dirname, "contrib")));
app.use(function(err, req, res, next) {
console.error(err.stack);

View File

@ -1,3 +1,9 @@
/* global beforeEach: false */
/* global jasmine: false */
/* global expect: false */
/* global it: false */
/* global describe: false */
var buildHTML = require("../src/buildHTML");
var buildMathML = require("../src/buildMathML");
var katex = require("../katex");