mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-19 05:37:53 +00:00
Enable strict options by default and only disable specific ones
Change-type: patch
This commit is contained in:
parent
cc5fb4ac16
commit
2ae22b4fbd
@ -1,5 +1,5 @@
|
|||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
import { Transaction } from 'knex';
|
import type { Transaction } from 'knex';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import StrictEventEmitter from 'strict-event-emitter-types';
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
||||||
import { inspect } from 'util';
|
import { inspect } from 'util';
|
||||||
@ -54,7 +54,7 @@ export async function get<T extends SchemaTypeKey>(
|
|||||||
key: T,
|
key: T,
|
||||||
trx?: Transaction,
|
trx?: Transaction,
|
||||||
): Promise<SchemaReturn<T>> {
|
): Promise<SchemaReturn<T>> {
|
||||||
const $db = trx || db.models.bind(db);
|
const $db = trx || db.models;
|
||||||
|
|
||||||
if (Schema.schema.hasOwnProperty(key)) {
|
if (Schema.schema.hasOwnProperty(key)) {
|
||||||
const schemaKey = key as Schema.SchemaKey;
|
const schemaKey = key as Schema.SchemaKey;
|
||||||
@ -183,7 +183,7 @@ export async function set<T extends SchemaTypeKey>(
|
|||||||
if (trx != null) {
|
if (trx != null) {
|
||||||
await setValuesInTransaction(trx);
|
await setValuesInTransaction(trx);
|
||||||
} else {
|
} else {
|
||||||
await db.transaction((tx: Transaction) => setValuesInTransaction(tx));
|
await db.transaction((tx) => setValuesInTransaction(tx));
|
||||||
}
|
}
|
||||||
events.emit('change', keyValues as ConfigMap<SchemaTypeKey>);
|
events.emit('change', keyValues as ConfigMap<SchemaTypeKey>);
|
||||||
}
|
}
|
||||||
@ -235,7 +235,7 @@ export function valueIsValid<T extends SchemaTypeKey>(
|
|||||||
|
|
||||||
async function getSchema<T extends Schema.SchemaKey>(
|
async function getSchema<T extends Schema.SchemaKey>(
|
||||||
key: T,
|
key: T,
|
||||||
$db: Transaction,
|
$db: typeof db.models,
|
||||||
): Promise<unknown> {
|
): Promise<unknown> {
|
||||||
let value: unknown;
|
let value: unknown;
|
||||||
switch (Schema.schema[key].source) {
|
switch (Schema.schema[key].source) {
|
||||||
|
@ -2,10 +2,11 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2019",
|
"target": "ES2019",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"noImplicitAny": true,
|
"strict": true,
|
||||||
|
"strictFunctionTypes": false,
|
||||||
|
"strictPropertyInitialization": false,
|
||||||
"preserveConstEnums": true,
|
"preserveConstEnums": true,
|
||||||
"inlineSourceMap": true,
|
"inlineSourceMap": true,
|
||||||
"strictNullChecks": true,
|
|
||||||
"outDir": "./build/",
|
"outDir": "./build/",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"lib": ["es6"],
|
"lib": ["es6"],
|
||||||
|
Loading…
Reference in New Issue
Block a user