Add basic linting rules
This commit is contained in:
parent
bfb0220fe1
commit
ca10d0eaf8
17 changed files with 28 additions and 27 deletions
2
.eslintignore
Normal file
2
.eslintignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
node_modules
|
||||
usage.js
|
8
.eslintrc.json
Normal file
8
.eslintrc.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"rules": {
|
||||
"no-unused-vars": "error"
|
||||
}
|
||||
}
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,3 +10,4 @@ node_modules/
|
|||
node_modules/*
|
||||
npm-debug.log
|
||||
coverage
|
||||
package-lock.json
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
var async = require('async'),
|
||||
common = require('./nconf/common'),
|
||||
var common = require('./nconf/common'),
|
||||
Provider = require('./nconf/provider').Provider;
|
||||
|
||||
//
|
||||
|
|
|
@ -91,7 +91,6 @@ Provider.prototype.file = function (key, options) {
|
|||
//
|
||||
Provider.prototype.use = function (name, options) {
|
||||
options = options || {};
|
||||
var type = options.type || name;
|
||||
|
||||
function sameOptions (store) {
|
||||
return Object.keys(options).every(function (key) {
|
||||
|
|
|
@ -10,8 +10,9 @@ var fs = require('fs'),
|
|||
util = require('util'),
|
||||
Secure = require('secure-keys'),
|
||||
formats = require('../formats'),
|
||||
Memory = require('./memory').Memory,
|
||||
exists = fs.exists || path.exists,
|
||||
Memory = require('./memory').Memory;
|
||||
|
||||
var exists = fs.exists || path.exists,
|
||||
existsSync = fs.existsSync || path.existsSync;
|
||||
|
||||
//
|
||||
|
@ -83,12 +84,10 @@ File.prototype.save = function (value, callback) {
|
|||
|
||||
//
|
||||
// ### function saveSync (value, callback)
|
||||
// #### @value {Object} _Ignored_ Left here for consistency
|
||||
// #### @callback {function} **Optional** Continuation to respond to when complete.
|
||||
// Saves the current configuration object to disk at `this.file`
|
||||
// using the format specified by `this.format` synchronously.
|
||||
//
|
||||
File.prototype.saveSync = function (value) {
|
||||
File.prototype.saveSync = function () {
|
||||
fs.writeFileSync(this.file, this.stringify());
|
||||
return this.store;
|
||||
};
|
||||
|
@ -168,8 +167,7 @@ File.prototype.loadSync = function () {
|
|||
// `this.secure` is enabled
|
||||
//
|
||||
File.prototype.stringify = function () {
|
||||
var data = this.store,
|
||||
self = this;
|
||||
var data = this.store;
|
||||
|
||||
if (this.secure) {
|
||||
data = this.keys.encrypt(data);
|
||||
|
@ -184,8 +182,7 @@ File.prototype.stringify = function () {
|
|||
// `this.secure` is enabled.
|
||||
//
|
||||
File.prototype.parse = function (contents) {
|
||||
var parsed = this.format.parse(contents),
|
||||
self = this;
|
||||
var parsed = this.format.parse(contents);
|
||||
|
||||
if (!this.secure) {
|
||||
return parsed;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.4",
|
||||
"eslint": "^4.9.0",
|
||||
"istanbul": "^0.4.1",
|
||||
"vows": "0.8.x"
|
||||
},
|
||||
|
@ -27,7 +28,8 @@
|
|||
"scripts": {
|
||||
"test": "vows test/*-test.js test/**/*-test.js --spec",
|
||||
"cover": "istanbul cover vows -- test/*-test.js test/**/*-test.js --spec",
|
||||
"coveralls": "cat coverage/lcov.info | coveralls"
|
||||
"coveralls": "cat coverage/lcov.info | coveralls",
|
||||
"lint": "eslint ."
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
vows = require('vows'),
|
||||
assert = require('assert'),
|
||||
helpers = require('./helpers'),
|
||||
nconf = require('../lib/nconf');
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
vows = require('vows'),
|
||||
assert = require('assert'),
|
||||
nconf = require('../lib/nconf'),
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
var path = require('path'),
|
||||
nconf = require('../../../lib/nconf');
|
||||
|
||||
//
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
var assert = require('assert'),
|
||||
spawn = require('child_process').spawn,
|
||||
util = require('util'),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
nconf = require('../lib/nconf');
|
||||
|
|
|
@ -54,7 +54,9 @@ vows.describe('nconf/hierarchy').addBatch({
|
|||
child;
|
||||
|
||||
try { fs.unlinkSync(configFile) }
|
||||
catch (ex) { }
|
||||
catch (ex) {
|
||||
// No-op
|
||||
}
|
||||
|
||||
child = spawn('node', [script].concat(argv));
|
||||
|
||||
|
|
|
@ -9,8 +9,7 @@ var fs = require('fs'),
|
|||
path = require('path'),
|
||||
vows = require('vows'),
|
||||
assert = require('assert'),
|
||||
nconf = require('../lib/nconf'),
|
||||
data = require('./fixtures/data').data;
|
||||
nconf = require('../lib/nconf')
|
||||
|
||||
vows.describe('nconf').addBatch({
|
||||
"When using the nconf": {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
var assert = require('assert'),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
spawn = require('child_process').spawn,
|
||||
vows = require('vows'),
|
||||
helpers = require('./helpers'),
|
||||
nconf = require('../lib/nconf');
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
var vows = require('vows'),
|
||||
assert = require('assert'),
|
||||
helpers = require('../helpers'),
|
||||
nconf = require('../../lib/nconf');
|
||||
|
||||
vows.describe('nconf/stores/argv').addBatch({
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
var vows = require('vows'),
|
||||
assert = require('assert'),
|
||||
helpers = require('../helpers'),
|
||||
nconf = require('../../lib/nconf');
|
||||
|
||||
vows.describe('nconf/stores/env').addBatch({
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
var vows = require('vows'),
|
||||
assert = require('assert'),
|
||||
helpers = require('../helpers'),
|
||||
nconf = require('../../lib/nconf');
|
||||
|
||||
vows.describe('nconf/stores/literal').addBatch({
|
||||
|
|
Loading…
Reference in a new issue