chore: change eslint-rules for tasks/
- use es2017 rules as NodeJS supports it today - add "prefer-const"
This commit is contained in:
committed by
Nils Knappmeier
parent
d1fb07b32b
commit
dc5495216d
@@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"globals": {
|
|
||||||
"require": true
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
// Disabling for tests, for now.
|
|
||||||
"no-path-concat": 0,
|
|
||||||
|
|
||||||
"no-var": 0,
|
|
||||||
"no-shadow": 0,
|
|
||||||
"handle-callback-err": 0,
|
|
||||||
"no-console": 0,
|
|
||||||
"no-process-env": 0,
|
|
||||||
"dot-notation": [2, {"allowKeywords": true}]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
module.exports = {
|
||||||
|
extends: ['../.eslintrc.js'],
|
||||||
|
parserOptions: {
|
||||||
|
sourceType: 'module',
|
||||||
|
ecmaVersion: 2017,
|
||||||
|
ecmaFeatures: {}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'no-process-env': 'off',
|
||||||
|
'prefer-const': 'warn'
|
||||||
|
}
|
||||||
|
};
|
||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
var _ = require('underscore'),
|
const _ = require('underscore'),
|
||||||
async = require('neo-async'),
|
async = require('neo-async'),
|
||||||
metrics = require('../bench');
|
metrics = require('../bench');
|
||||||
|
|
||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
grunt.registerTask('metrics', function() {
|
grunt.registerTask('metrics', function() {
|
||||||
var done = this.async(),
|
const done = this.async(),
|
||||||
execName = grunt.option('name'),
|
execName = grunt.option('name'),
|
||||||
events = {};
|
events = {};
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -1,16 +1,16 @@
|
|||||||
var childProcess = require('child_process');
|
const childProcess = require('child_process');
|
||||||
|
|
||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
grunt.registerTask('parser', 'Generate jison parser.', function() {
|
grunt.registerTask('parser', 'Generate jison parser.', function() {
|
||||||
var done = this.async();
|
const done = this.async();
|
||||||
|
|
||||||
var cmd = './node_modules/.bin/jison';
|
let cmd = './node_modules/.bin/jison';
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
cmd = 'node_modules\\.bin\\jison.cmd';
|
cmd = 'node_modules\\.bin\\jison.cmd';
|
||||||
}
|
}
|
||||||
|
|
||||||
var child = childProcess.spawn(
|
const child = childProcess.spawn(
|
||||||
cmd,
|
cmd,
|
||||||
['-m', 'js', 'src/handlebars.yy', 'src/handlebars.l'],
|
['-m', 'js', 'src/handlebars.yy', 'src/handlebars.l'],
|
||||||
{ stdio: 'inherit' }
|
{ stdio: 'inherit' }
|
||||||
@@ -22,14 +22,14 @@ module.exports = function(grunt) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var src = [
|
const src = [
|
||||||
'src/parser-prefix.js',
|
'src/parser-prefix.js',
|
||||||
'handlebars.js',
|
'handlebars.js',
|
||||||
'src/parser-suffix.js'
|
'src/parser-suffix.js'
|
||||||
]
|
]
|
||||||
.map(grunt.file.read)
|
.map(grunt.file.read)
|
||||||
.join('');
|
.join('');
|
||||||
grunt.file.delete('handlebars.js');
|
grunt.file['delete']('handlebars.js');
|
||||||
|
|
||||||
grunt.file.write('lib/handlebars/compiler/parser.js', src);
|
grunt.file.write('lib/handlebars/compiler/parser.js', src);
|
||||||
grunt.log.writeln('Parser "lib/handlebars/compiler/parser.js" created.');
|
grunt.log.writeln('Parser "lib/handlebars/compiler/parser.js" created.');
|
||||||
|
|||||||
+8
-8
@@ -1,4 +1,4 @@
|
|||||||
var _ = require('underscore'),
|
const _ = require('underscore'),
|
||||||
async = require('neo-async'),
|
async = require('neo-async'),
|
||||||
AWS = require('aws-sdk'),
|
AWS = require('aws-sdk'),
|
||||||
git = require('./util/git'),
|
git = require('./util/git'),
|
||||||
@@ -6,7 +6,7 @@ var _ = require('underscore'),
|
|||||||
|
|
||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
grunt.registerTask('publish:latest', function() {
|
grunt.registerTask('publish:latest', function() {
|
||||||
var done = this.async();
|
const done = this.async();
|
||||||
|
|
||||||
git.debug(function(remotes, branches) {
|
git.debug(function(remotes, branches) {
|
||||||
grunt.log.writeln('remotes: ' + remotes);
|
grunt.log.writeln('remotes: ' + remotes);
|
||||||
@@ -15,7 +15,7 @@ module.exports = function(grunt) {
|
|||||||
git.commitInfo(function(err, info) {
|
git.commitInfo(function(err, info) {
|
||||||
grunt.log.writeln('tag: ' + info.tagName);
|
grunt.log.writeln('tag: ' + info.tagName);
|
||||||
|
|
||||||
var files = [];
|
const files = [];
|
||||||
|
|
||||||
// Publish the master as "latest" and with the commit-id
|
// Publish the master as "latest" and with the commit-id
|
||||||
if (info.isMaster) {
|
if (info.isMaster) {
|
||||||
@@ -40,7 +40,7 @@ module.exports = function(grunt) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
grunt.registerTask('publish:version', function() {
|
grunt.registerTask('publish:version', function() {
|
||||||
var done = this.async();
|
const done = this.async();
|
||||||
initSDK();
|
initSDK();
|
||||||
|
|
||||||
git.commitInfo(function(err, info) {
|
git.commitInfo(function(err, info) {
|
||||||
@@ -52,7 +52,7 @@ module.exports = function(grunt) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function initSDK() {
|
function initSDK() {
|
||||||
var bucket = process.env.S3_BUCKET_NAME,
|
const bucket = process.env.S3_BUCKET_NAME,
|
||||||
key = process.env.S3_ACCESS_KEY_ID,
|
key = process.env.S3_ACCESS_KEY_ID,
|
||||||
secret = process.env.S3_SECRET_ACCESS_KEY;
|
secret = process.env.S3_SECRET_ACCESS_KEY;
|
||||||
|
|
||||||
@@ -63,13 +63,13 @@ module.exports = function(grunt) {
|
|||||||
AWS.config.update({ accessKeyId: key, secretAccessKey: secret });
|
AWS.config.update({ accessKeyId: key, secretAccessKey: secret });
|
||||||
}
|
}
|
||||||
function publish(files, callback) {
|
function publish(files, callback) {
|
||||||
var s3 = new AWS.S3(),
|
const s3 = new AWS.S3(),
|
||||||
bucket = process.env.S3_BUCKET_NAME;
|
bucket = process.env.S3_BUCKET_NAME;
|
||||||
|
|
||||||
async.each(
|
async.each(
|
||||||
_.keys(files),
|
_.keys(files),
|
||||||
function(file, callback) {
|
function(file, callback) {
|
||||||
var params = {
|
const params = {
|
||||||
Bucket: bucket,
|
Bucket: bucket,
|
||||||
Key: file,
|
Key: file,
|
||||||
Body: grunt.file.read(files[file])
|
Body: grunt.file.read(files[file])
|
||||||
@@ -87,7 +87,7 @@ module.exports = function(grunt) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
function fileMap(suffixes) {
|
function fileMap(suffixes) {
|
||||||
var map = {};
|
const map = {};
|
||||||
_.each(
|
_.each(
|
||||||
[
|
[
|
||||||
'handlebars.js',
|
'handlebars.js',
|
||||||
|
|||||||
+15
-15
@@ -1,13 +1,13 @@
|
|||||||
var childProcess = require('child_process'),
|
const childProcess = require('child_process'),
|
||||||
fs = require('fs'),
|
fs = require('fs'),
|
||||||
os = require('os');
|
os = require('os');
|
||||||
|
|
||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
grunt.registerTask('test:bin', function() {
|
grunt.registerTask('test:bin', function() {
|
||||||
var done = this.async();
|
const done = this.async();
|
||||||
|
|
||||||
var cmd = './bin/handlebars';
|
let cmd = './bin/handlebars';
|
||||||
var args = ['-a', 'spec/artifacts/empty.handlebars'];
|
const args = ['-a', 'spec/artifacts/empty.handlebars'];
|
||||||
|
|
||||||
// On Windows, the executable handlebars.js file cannot be run directly
|
// On Windows, the executable handlebars.js file cannot be run directly
|
||||||
if (os.platform() === 'win32') {
|
if (os.platform() === 'win32') {
|
||||||
@@ -19,7 +19,7 @@ module.exports = function(grunt) {
|
|||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = fs
|
const expected = fs
|
||||||
.readFileSync('./spec/expected/empty.amd.js')
|
.readFileSync('./spec/expected/empty.amd.js')
|
||||||
.toString()
|
.toString()
|
||||||
.replace(/\r\n/g, '\n');
|
.replace(/\r\n/g, '\n');
|
||||||
@@ -38,9 +38,9 @@ module.exports = function(grunt) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
grunt.registerTask('test:mocha', function() {
|
grunt.registerTask('test:mocha', function() {
|
||||||
var done = this.async();
|
const done = this.async();
|
||||||
|
|
||||||
var runner = childProcess.fork('./spec/env/runner', [], {
|
const runner = childProcess.fork('./spec/env/runner', [], {
|
||||||
stdio: 'inherit'
|
stdio: 'inherit'
|
||||||
});
|
});
|
||||||
runner.on('close', function(code) {
|
runner.on('close', function(code) {
|
||||||
@@ -51,24 +51,24 @@ module.exports = function(grunt) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
grunt.registerTask('test:cov', function() {
|
grunt.registerTask('test:cov', function() {
|
||||||
var done = this.async();
|
const done = this.async();
|
||||||
|
|
||||||
var runner = childProcess.fork(
|
const runner = childProcess.spawn(
|
||||||
'node_modules/istanbul/lib/cli.js',
|
'node_modules/istanbul/lib/cli.js',
|
||||||
['cover', '--source-map', '--', './spec/env/runner.js'],
|
['cover', '--source-map', '--', './spec/env/runner.js'],
|
||||||
{ stdio: 'inherit' }
|
{ stdio: 'inherit' }
|
||||||
);
|
);
|
||||||
runner.on('close', function(code) {
|
runner.on('exit', function(code) {
|
||||||
if (code != 0) {
|
if (code !== 0) {
|
||||||
grunt.fatal(code + ' tests failed');
|
grunt.fatal(code + ' tests failed');
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
grunt.registerTask('test:min', function() {
|
grunt.registerTask('test:min', function() {
|
||||||
var done = this.async();
|
const done = this.async();
|
||||||
|
|
||||||
var runner = childProcess.fork('./spec/env/runner', ['--min'], {
|
const runner = childProcess.fork('./spec/env/runner', ['--min'], {
|
||||||
stdio: 'inherit'
|
stdio: 'inherit'
|
||||||
});
|
});
|
||||||
runner.on('close', function(code) {
|
runner.on('close', function(code) {
|
||||||
@@ -80,9 +80,9 @@ module.exports = function(grunt) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
grunt.registerTask('test:check-cov', function() {
|
grunt.registerTask('test:check-cov', function() {
|
||||||
var done = this.async();
|
const done = this.async();
|
||||||
|
|
||||||
var runner = childProcess.fork(
|
const runner = childProcess.fork(
|
||||||
'node_modules/istanbul/lib/cli.js',
|
'node_modules/istanbul/lib/cli.js',
|
||||||
[
|
[
|
||||||
'check-coverage',
|
'check-coverage',
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
var childProcess = require('child_process');
|
const childProcess = require('child_process');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
debug: function(callback) {
|
debug: function(callback) {
|
||||||
@@ -99,13 +99,13 @@ module.exports = {
|
|||||||
throw new Error('git.tagName: ' + err.message);
|
throw new Error('git.tagName: ' + err.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
var tags = stdout.trim().split(/\n/);
|
let tags = stdout.trim().split(/\n/);
|
||||||
tags = tags.filter(function(info) {
|
tags = tags.filter(function(info) {
|
||||||
info = info.split('-');
|
info = info.split('-');
|
||||||
return info.length == 1;
|
return info.length == 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
var versionTags = tags.filter(function(info) {
|
const versionTags = tags.filter(function(info) {
|
||||||
return /^v/.test(info[0]);
|
return /^v/.test(info[0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
var async = require('neo-async'),
|
const async = require('neo-async'),
|
||||||
git = require('./util/git'),
|
git = require('./util/git'),
|
||||||
semver = require('semver');
|
semver = require('semver');
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ module.exports = function(grunt) {
|
|||||||
'version',
|
'version',
|
||||||
'Updates the current release version',
|
'Updates the current release version',
|
||||||
function() {
|
function() {
|
||||||
var done = this.async(),
|
const done = this.async(),
|
||||||
pkg = grunt.config('pkg'),
|
pkg = grunt.config('pkg'),
|
||||||
version = grunt.option('ver');
|
version = grunt.option('ver');
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ module.exports = function(grunt) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
function replace(path, regex, value) {
|
function replace(path, regex, value) {
|
||||||
var content = grunt.file.read(path);
|
let content = grunt.file.read(path);
|
||||||
content = content.replace(regex, value);
|
content = content.replace(regex, value);
|
||||||
grunt.file.write(path, content);
|
grunt.file.write(path, content);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user