more lint fixes
This commit is contained in:
parent
cc014de397
commit
3e545cdaa9
8 changed files with 29 additions and 38 deletions
|
|
@ -12,6 +12,7 @@ import {
|
|||
validateCompleteness
|
||||
} from './utils/validation';
|
||||
import { redactSecrets } from './utils/secrets';
|
||||
import type { Environment } from './types';
|
||||
|
||||
interface CliOptions {
|
||||
config?: string;
|
||||
|
|
@ -96,7 +97,7 @@ async function main() {
|
|||
}
|
||||
|
||||
const configPath = values.config || join(process.cwd(), 'config');
|
||||
const environment = values.env as any;
|
||||
const environment = values.env as Environment;
|
||||
|
||||
try {
|
||||
const manager = new ConfigManager({
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export class ConfigManager<T = Record<string, unknown>> {
|
|||
|
||||
// Add environment if not present
|
||||
if (typeof mergedConfig === 'object' && mergedConfig !== null && !('environment' in mergedConfig)) {
|
||||
(mergedConfig as any).environment = this.environment;
|
||||
(mergedConfig as Record<string, unknown>)['environment'] = this.environment;
|
||||
}
|
||||
|
||||
// Validate if schema provided
|
||||
|
|
|
|||
|
|
@ -44,25 +44,28 @@ export function validateConfig<T>(
|
|||
* Check for deprecated configuration options
|
||||
*/
|
||||
export function checkDeprecations(
|
||||
config: Record<string, any>,
|
||||
config: Record<string, unknown>,
|
||||
deprecations: Record<string, string>
|
||||
): ValidationResult['warnings'] {
|
||||
const warnings: ValidationResult['warnings'] = [];
|
||||
|
||||
function checkObject(obj: any, path: string[] = []): void {
|
||||
function checkObject(obj: Record<string, unknown>, path: string[] = []): void {
|
||||
for (const [key, value] of Object.entries(obj)) {
|
||||
const currentPath = [...path, key];
|
||||
const pathStr = currentPath.join('.');
|
||||
|
||||
if (pathStr in deprecations) {
|
||||
warnings?.push({
|
||||
path: pathStr,
|
||||
message: deprecations[pathStr]!,
|
||||
});
|
||||
const deprecationMessage = deprecations[pathStr];
|
||||
if (deprecationMessage) {
|
||||
warnings?.push({
|
||||
path: pathStr,
|
||||
message: deprecationMessage,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
||||
checkObject(value, currentPath);
|
||||
checkObject(value as Record<string, unknown>, currentPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue