Move eslint settings to .eslintrc, and fix minor code style issues

This commit is contained in:
Timothy Warren 2016-03-11 13:29:01 -05:00
parent f431463c9a
commit 6dba16ac24
8 changed files with 44 additions and 66 deletions

38
.eslintrc Normal file
View File

@ -0,0 +1,38 @@
{
"env": {
"node": true,
"es6": true
},
"rules": {
"arrow-parens": [2, "as-needed"],
"no-console": [1],
"no-constant-condition": [1],
"no-extra-semi": [1],
"no-func-assign": [1],
"no-obj-calls": [2],
"no-unexpected-multiline" : [2],
"no-unneeded-ternary": [2],
"radix": [2],
"no-with": [2],
"no-eval": [2],
"no-unreachable": [1],
"no-irregular-whitespace": [1],
"no-new-wrappers": [2],
"no-new-func": [2],
"curly" : [2, "multi-line"],
"no-implied-eval": [2],
"no-invalid-this": [2],
"constructor-super": [2],
"no-dupe-args": [2],
"no-dupe-keys": [2],
"no-dupe-class-members": [2],
"no-this-before-super": [2],
"prefer-arrow-callback": [1],
"no-var": [2],
"valid-jsdoc": [1],
"strict": [2, "global"],
"callback-return": [1],
"object-shorthand": [1, "methods"],
"prefer-template": [1]
}
}

View File

@ -1,6 +0,0 @@
reporting:
reports:
- lcov
- lcovonly
report-config:
lcovonly: {file: ../coverage/lcov.info}

View File

@ -15,45 +15,6 @@ const TEST_FILES = [
'test/adapters/*_test.js'
];
const ESLINT_SETTINGS = {
"env": {
"node": true,
"es6": true
},
"rules": {
"arrow-parens": [2, "as-needed"],
"no-console": [1],
"no-constant-condition": [1],
"no-extra-semi": [1],
"no-func-assign": [1],
"no-obj-calls": [2],
"no-unexpected-multiline" : [2],
"no-unneeded-ternary": [2],
"radix": [2],
"no-with": [2],
"no-eval": [2],
"no-unreachable": [1],
"no-irregular-whitespace": [1],
"no-new-wrappers": [2],
"no-new-func": [2],
"curly" : [2, "multi-line"],
"no-implied-eval": [2],
"no-invalid-this": [2],
"constructor-super": [2],
"no-dupe-args": [2],
"no-dupe-keys": [2],
"no-dupe-class-members": [2],
"no-this-before-super": [2],
"prefer-arrow-callback": [1],
"no-var": [2],
"valid-jsdoc": [1],
"strict": [2, "global"],
"callback-return": [1],
"object-shorthand": [1, "methods"],
"prefer-template": [1]
}
};
const MOCHA_OPTIONS = {
ui: 'tdd',
bail: true,
@ -63,7 +24,7 @@ const MOCHA_OPTIONS = {
gulp.task('lint', () => {
pipe(gulp.src(SRC_FILES), [
eslint(ESLINT_SETTINGS),
eslint(),
eslint.format(),
eslint.failAfterError()
]);
@ -75,7 +36,7 @@ gulp.task('lint', () => {
gulp.task('lint-tests', ['lint'], () => {
pipe(gulp.src(['test/**/*.js']), [
eslint(ESLINT_SETTINGS),
eslint(),
eslint.format(),
eslint.failAfterError()
]);

View File

@ -93,6 +93,4 @@ class NodeQuery {
}
}
module.exports = (config => {
return new NodeQuery(config);
});
module.exports = (config => new NodeQuery(config));

View File

@ -50,9 +50,7 @@ module.exports = (() => {
sql += `SELECT ${cols.join(', ')}\n`;
vals.forEach(rowValues => {
let quoted = rowValues.map(value => {
return String(value).replace('\'', '\'\'');
});
let quoted = rowValues.map(value => String(value).replace('\'', '\'\''));
sql += `UNION ALL SELECT '${quoted.join('\', \'')}'\n`;
});

View File

@ -16,9 +16,7 @@ function promisify(fn) {
return function () {
let args = [].slice.call(arguments);
return new Promise(function (resolve, reject) {
fn.apply(undefined, args.concat((error, value) => {
return error ? reject(error) : resolve(value);
}));
fn.apply(undefined, args.concat((error, value) => error ? reject(error) : resolve(value)));
});
};
}

View File

@ -1,7 +0,0 @@
{
"preset": "airbnb",
"validateIndentation": null,
"requireLineFeedAtFileEnd": null,
"disallowSpaceAfterPrefixUnaryOperators": null,
"disallowMultipleVarDecl": null
}

View File

@ -23,9 +23,7 @@ suite('Dblite adapter tests -', () => {
let sql = `CREATE TABLE IF NOT EXISTS "create_test" ("id" INTEGER PRIMARY KEY, "key" TEXT, "val" TEXT);
CREATE TABLE IF NOT EXISTS "create_join" ("id" INTEGER PRIMARY KEY, "key" TEXT, "val" TEXT);`;
qb.query(sql, () => {
return done();
});
qb.query(sql, () => done());
});
/*---------------------------------------------------------------------------