Permalink
Browse files

Adding JSLint make task (nodelint as devDependencies)

  • Loading branch information...
1 parent e9c7aad commit aa848fa09cf9e50eecf04fbbc0be21bb9f36f145 @paularmstrong paularmstrong committed Aug 5, 2011
Showing with 96 additions and 11 deletions.
  1. +7 −0 Makefile
  2. +14 −11 package.json
  3. +41 −0 scripts/config-lint.js
  4. +34 −0 scripts/runlint.js
View
@@ -0,0 +1,7 @@
+all:
+ @echo ''
+
+lint:
+ @node scripts/runlint.js
+
+.PHONY: all lint
View
@@ -1,13 +1,16 @@
{
- "name": "node-t",
- "version": "0.1.0",
- "description": "A fast django-like templating engine for node.js",
- "keywords": ["template", "html", "django", "sandbox"],
- "repository": "git://github.com/skid/node-t.git",
- "author": "Dusko Jordanovski <jordanovskid@gmail.com>",
- "dependencies": {},
- "main": "index",
- "engines": {
- "node": ">= 0.4.1"
- }
+ "name": "node-t",
+ "version": "0.1.0",
+ "description": "A fast django-like templating engine for node.js",
+ "keywords": ["template", "html", "django", "sandbox"],
+ "repository": "git://github.com/skid/node-t.git",
+ "author": "Dusko Jordanovski <jordanovskid@gmail.com>",
+ "dependencies": {},
+ "devDependencies": {
+ "nodelint": "0.4.0"
+ },
+ "main": "index",
+ "engines": {
+ "node": ">= 0.4.1"
+ }
}
@@ -0,0 +1,41 @@
+module.exports = {
+ root: __dirname + '/../',
+ pathIgnore: ['*node_modules*']
+};
+
+var options = {
+ adsafe: false,
+ bitwise: false,
+ browser: true,
+ cap: false,
+ css: false,
+ debug: false,
+ devel: true,
+ eqeqeq: true,
+ evil: true,
+ forin: false,
+ fragment: false,
+ immed: false,
+ indent: 4,
+ laxbreak: true,
+ maxerr: 300,
+ maxlen: 600,
+ nomen: false,
+ newcap: true,
+ node: true, // jslint.com has an option for node, but the node module is not up to date yet
+ on: true,
+ onevar: true,
+ passfail: false,
+ plusplus: false,
+ predef: ['util', 'require', 'process', 'exports', 'escape', '__dirname', 'setTimeout'],
+ regexp: false,
+ rhino: false,
+ safe: false,
+ strict: true,
+ sub: false,
+ undef: true,
+ white: true,
+ widget: false,
+ windows: false
+};
+
View
@@ -0,0 +1,34 @@
+require.paths.unshift(__dirname + '/../node_modules/');
+
+var util = require('util'),
+ child_process = require('child_process'),
+ configFile = __dirname + '/config-lint',
+ ignore = '',
+ root, i;
+
+process.argv.forEach(function (val, index, array) {
+ if (index < 2) {
+ return;
+ }
+
+ if (val === '-c') {
+ configFile = process.argv[~~index + 1];
+ }
+});
+
+config = require(configFile);
+
+function runLint(error, stdout, stderr) {
+ var files = stdout.trim().replace(/\n/g, ' ');
+
+ child_process.exec('node ' + __dirname + '/../node_modules/nodelint/nodelint ' + files + ' --config ' + configFile + '.js', { cwd: config.root }, function (error, stdout, stderr) {
+ util.puts(stderr);
+ });
+}
+
+i = config.pathIgnore.length;
+while (i--) {
+ ignore += ' ! -path "' + config.pathIgnore[i] + '"';
+}
+
+child_process.exec('find . -name "*.js"' + ignore, { cwd: config.root }, runLint);

0 comments on commit aa848fa

Please sign in to comment.