зеркало из https://github.com/mozilla/commonplace.git
v0.6.3 move jshint to marketplace-gulp (bug 1092519)
This commit is contained in:
Родитель
30614e2a8a
Коммит
1e9a525ba0
|
@ -8,7 +8,6 @@ function help() {
|
|||
'Commands:',
|
||||
' extract_strings This command will extract strings into a `.pot` file.',
|
||||
' langpacks This command will generate langpacks out of `.po` files.',
|
||||
' lint Lints the current project.',
|
||||
' fiddle Installs Commonplace project dependencies.',
|
||||
'',
|
||||
'Read more: https://github.com/mozilla/commonplace/wiki/CLI-Tools'
|
||||
|
@ -43,7 +42,7 @@ switch (argv[0]) {
|
|||
commonplace.generate_langpacks();
|
||||
break;
|
||||
case 'lint':
|
||||
commonplace.lint();
|
||||
console.log('This command has been deprecated by Gulp. Use `make lint` instead.');
|
||||
break;
|
||||
case 'fiddle':
|
||||
commonplace.fiddle();
|
||||
|
|
|
@ -135,56 +135,6 @@ function extract_l10n() {
|
|||
}
|
||||
|
||||
|
||||
function lint() {
|
||||
var jshint = require('jshint').JSHINT;
|
||||
var src_dir = srcDir();
|
||||
|
||||
var results = [];
|
||||
function report(file, err) {
|
||||
console.error(
|
||||
path.relative(process.cwd(), file) + ': ' + err.code,
|
||||
'(line ' + err.line + ', pos ' + err.character + ')',
|
||||
err.reason
|
||||
);
|
||||
results.push({file: file, error: err});
|
||||
}
|
||||
|
||||
utils.globSync(src_dir, '.js', function(err, files) {
|
||||
if (err) {
|
||||
console.error('Error finding files for linting.', err);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
for (var i = 0, file; file = files[i++];) {
|
||||
// Skip over files in any `lib/` directory.
|
||||
if (path.dirname(file).split(path.sep).indexOf('lib') !== -1) {
|
||||
continue;
|
||||
}
|
||||
// Skip over `templates.js`.
|
||||
if (path.basename(file) === 'templates.js') {
|
||||
continue;
|
||||
}
|
||||
|
||||
var code = fs.readFileSync(file);
|
||||
if (!jshint(code.toString())) {
|
||||
jshint.errors.forEach(function(err) {
|
||||
if (!err) {
|
||||
return;
|
||||
}
|
||||
report(file, err);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (results.length) {
|
||||
console.warn(results.length + ' errors found');
|
||||
process.exit(1);
|
||||
} else {
|
||||
console.log('No errors found.');
|
||||
}
|
||||
}
|
||||
|
||||
function fiddle() {
|
||||
var now = (new Date()).getTime();
|
||||
var package_json_path = path.resolve(process.cwd(), 'package.json');
|
||||
|
@ -328,7 +278,6 @@ function fiddle() {
|
|||
|
||||
module.exports.generate_langpacks = generate_langpacks;
|
||||
module.exports.extract_l10n = extract_l10n;
|
||||
module.exports.lint = lint;
|
||||
module.exports.fiddle = fiddle;
|
||||
|
||||
module.exports.config = require('./config');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "commonplace",
|
||||
"description": "Reusable components for Firefox Marketplace frontend projects.",
|
||||
"version": "0.6.2",
|
||||
"version": "0.6.3",
|
||||
"main": "lib/commonplace",
|
||||
"preferGlobal": true,
|
||||
"repository": {
|
||||
|
|
Загрузка…
Ссылка в новой задаче