Skip to content

Commit

Permalink
chore: disable lots of eslint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
FauxFaux committed Nov 19, 2019
1 parent 9cac115 commit 5e90504
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"prettier/@typescript-eslint"
],
"rules": {
"@typescript-eslint/no-use-before-define": "warn",
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/await-thenable": "error",
Expand Down
14 changes: 9 additions & 5 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
const debug = require('debug')('snyk:config');
const nconf = require('nconf');
import * as debugFactory from 'debug';
import * as nconf from 'nconf';
import * as path from 'path';
import * as _ from 'lodash';

// eslint-disable-next-line @typescript-eslint/no-require-imports
require('./nconf-truth');
const path = require('path');
const _ = require('lodash');

const debug = debugFactory('snyk:config');

export type Json =
| string
Expand Down Expand Up @@ -70,7 +74,7 @@ export function loadConfig(
}

// recursively replace ${VAL} in config values with process.env.VAL
function substituteEnvVarValues(config) {
function substituteEnvVarValues(config): void {
Object.keys(config).forEach(function(key) {
// recurse through nested objects
if (typeof config[key] === 'object') {
Expand Down
10 changes: 8 additions & 2 deletions lib/nconf-truth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
*/

import * as nconf from 'nconf';
const common = require('nconf/lib/nconf/common');
import * as common from 'nconf/lib/nconf/common';

nconf.Env.prototype.loadEnv = function() {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore intentionally monkey-patching internals
// eslint-disable-next-line @typescript-eslint/no-explicit-any
nconf.Env.prototype.loadEnv = function(): any {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;

this.readOnly = false;
Expand All @@ -28,6 +32,8 @@ nconf.Env.prototype.loadEnv = function() {
}

if (self.separator) {
// spread would be better here; maybe next time...
// eslint-disable-next-line prefer-spread
self.set(common.key.apply(common, key.split(self.separator)), value);
} else {
self.set(key, value);
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"author": "Remy Sharp",
"license": "Apache-2.0",
"devDependencies": {
"@types/lodash": "^4.14.147",
"@types/nconf": "^0.10.0",
"@types/node": "^6.14.9",
"@typescript-eslint/eslint-plugin": "^2.7.0",
"@typescript-eslint/parser": "^2.7.0",
Expand Down

0 comments on commit 5e90504

Please sign in to comment.