Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import * as clc from "colorette";
import * as fs from "fs-extra";
import * as path from "path";
const cjson = require("cjson");

import { detectProjectRoot } from "./detectProjectRoot";
import { FirebaseError } from "./error";
Expand All @@ -17,7 +16,7 @@
import { getValidator, getErrorMessage } from "./firebaseConfigValidate";
import { logger } from "./logger";
import { loadCJSON } from "./loadCJSON";
const parseBoltRules = require("./parseBoltRules");

Check warning on line 19 in src/config.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Require statement not part of import statement

Check warning on line 19 in src/config.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value

export class Config {
static DEFAULT_FUNCTIONS_SOURCE = "functions";
Expand All @@ -36,20 +35,20 @@
"apphosting",
];

public options: any;

Check warning on line 38 in src/config.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
public projectDir: string;
public data: any = {};

Check warning on line 40 in src/config.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
public defaults: any = {};

Check warning on line 41 in src/config.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
public notes: any = {};

Check warning on line 42 in src/config.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type

private _src: any;

Check warning on line 44 in src/config.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type

/**
* @param src incoming firebase.json source, parsed by not validated.
* @param options command-line options.
*/
constructor(src: any, options: any = {}) {

Check warning on line 50 in src/config.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type

Check warning on line 50 in src/config.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
this.options = options;

Check warning on line 51 in src/config.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
this.projectDir = this.options.projectDir || detectProjectRoot(this.options);
this._src = src;

Expand Down Expand Up @@ -303,7 +302,10 @@
if (pd) {
try {
const filePath = path.resolve(pd, path.basename(filename));
const data = cjson.load(filePath);
let data: unknown = {};
if (fs.statSync(filePath).size > 0) {
data = loadCJSON(filePath);
}

// Validate config against JSON Schema. For now we just print these to debug
// logs but in a future CLI version they could be warnings and/or errors.
Expand Down
Loading