Replacing gjslint with jshint; fixing jshint for windows

This commit is contained in:
Yury Delendik 2013-02-04 12:41:46 -06:00
parent 4b4c70f5d1
commit cb68adb80f
4 changed files with 22 additions and 37 deletions

View File

@ -1,5 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* globals FirefoxCom */
'use strict'; 'use strict';
@ -42,7 +43,8 @@
return; return;
// get the related l10n object // get the related l10n object
var data = getL10nData(element.dataset.l10nId); var key = element.dataset.l10nId;
var data = getL10nData(key);
if (!data) if (!data)
return; return;

52
make.js
View File

@ -23,6 +23,7 @@
require('./external/shelljs/make'); require('./external/shelljs/make');
var builder = require('./external/builder/builder.js'); var builder = require('./external/builder/builder.js');
var crlfchecker = require('./external/crlfchecker/crlfchecker.js'); var crlfchecker = require('./external/crlfchecker/crlfchecker.js');
var path = require('path');
var ROOT_DIR = __dirname + '/', // absolute path to project's root var ROOT_DIR = __dirname + '/', // absolute path to project's root
BUILD_DIR = 'build/', BUILD_DIR = 'build/',
@ -971,49 +972,30 @@ target.server = function() {
target.lint = function() { target.lint = function() {
cd(ROOT_DIR); cd(ROOT_DIR);
echo(); echo();
echo('### Linting JS files (this can take a while!)'); echo('### Linting JS files');
var LINT_FILES = ['make.js',
'external/builder/*.js',
'external/crlfchecker/*.js',
'src/*.js',
'web/*.js',
'test/*.js',
'test/unit/*.js',
'extensions/firefox/*.js',
'extensions/firefox/components/*.js',
'extensions/chrome/*.js'];
exec('gjslint --nojsdoc ' + LINT_FILES.join(' '));
echo('Discarding the results by printing \"files checked, no errors found\"');
echo('Use \"node make jshint\"');
crlfchecker.checkIfCrlfIsPresent(LINT_FILES);
};
//
// make jshint
//
target.jshint = function() {
cd(ROOT_DIR);
echo();
echo('### Linting JS files (this can take a while!)');
var LINT_FILES = ['make.js', var LINT_FILES = ['make.js',
'external/builder/', 'external/builder/',
'external/crlfchecker/', 'external/crlfchecker/',
'src/', 'src/',
'web/*.js', 'web/',
'test/*.js', 'test/driver.js',
'test/unit/*.js', 'test/reporter.js',
'extensions/firefox/*.js', 'test/unit/',
'extensions/firefox/components/*.js', 'extensions/firefox/',
'extensions/chrome/*.js' 'extensions/chrome/'
]; ];
exit(exec('./node_modules/.bin/jshint --reporter test/reporter.js ' + var jshintPath = path.normalize('./node_modules/.bin/jshint');
if (!test('-f', jshintPath)) {
echo('jshint is not installed -- installing...');
exec('npm install jshint');
}
exit(exec('"' + jshintPath + '" --reporter test/reporter.js ' +
LINT_FILES.join(' ')).code); LINT_FILES.join(' ')).code);
crlfchecker.checkIfCrlfIsPresent(LINT_FILES);
}; };
// //

View File

@ -5,7 +5,7 @@
"jshint": "git://github.com/jshint/jshint.git#42ace75a" "jshint": "git://github.com/jshint/jshint.git#42ace75a"
}, },
"scripts": { "scripts": {
"test": "node make jshint" "test": "node make lint"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -43,6 +43,7 @@ module.exports = {
((len === 1) ? '' : 's') + '\n'); ((len === 1) ? '' : 's') + '\n');
process.exit(2); process.exit(2);
} else { } else {
process.stdout.write('files checked, no errors found\n');
process.exit(0); process.exit(0);
} }
} }