mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-18 10:46:22 +00:00
Add type checking for javascript files
Change-type: patch
This commit is contained in:
parent
4fbd015083
commit
9c3295c912
@ -2,7 +2,10 @@
|
||||
"*.coffee": [
|
||||
"resin-lint"
|
||||
],
|
||||
"*.ts$|!(*webpack.config).js$": [
|
||||
"*.ts": [
|
||||
"resin-lint --typescript --fix",
|
||||
],
|
||||
"*!(*webpack.config).js": [
|
||||
"resin-lint --typescript --fix",
|
||||
],
|
||||
"test/**/*.coffee": [
|
||||
|
@ -26,7 +26,7 @@
|
||||
"packagejson:copy": "cp package.json build/",
|
||||
"testitems:copy": "cp -r test/data build/test/",
|
||||
"lint:coffee": "balena-lint src/ test/",
|
||||
"lint:typescript": "balena-lint -e ts -e js --typescript src/ test/ typings/ && tsc --noEmit"
|
||||
"lint:typescript": "balena-lint -e ts -e js --typescript src/ test/ typings/ && tsc --noEmit && tsc --noEmit --project tsconfig.js.json"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
@ -347,7 +347,7 @@ export class Images extends (EventEmitter as new () => ImageEventEmitter) {
|
||||
}
|
||||
|
||||
private async getImagesForCleanup(): Promise<string[]> {
|
||||
const images = [];
|
||||
const images: string[] = [];
|
||||
|
||||
const [
|
||||
supervisorImageInfo,
|
||||
|
@ -420,7 +420,7 @@ export function createV2Api(router: Router, applications: ApplicationManager) {
|
||||
);
|
||||
});
|
||||
|
||||
let overallDownloadProgress = null;
|
||||
let overallDownloadProgress: number | null = null;
|
||||
if (downloads > 0) {
|
||||
overallDownloadProgress = downloadProgressTotal / downloads;
|
||||
}
|
||||
|
@ -798,7 +798,7 @@ export class DeviceState extends (EventEmitter as new () => DeviceStateEventEmit
|
||||
// TODO: This function is a bit of a mess
|
||||
const pause = () => {
|
||||
return Bluebird.try(() => {
|
||||
let res = null;
|
||||
let res;
|
||||
this.applyBlocker = new Promise(resolve => {
|
||||
res = resolve;
|
||||
});
|
||||
|
@ -169,7 +169,7 @@ export function get(): Bluebird<HostConfig> {
|
||||
}
|
||||
|
||||
export function patch(conf: HostConfig, configModel: Config): Bluebird<void> {
|
||||
const promises = [];
|
||||
const promises: Array<Promise<void>> = [];
|
||||
if (conf != null && conf.network != null) {
|
||||
if (conf.network.proxy != null) {
|
||||
promises.push(setProxy(conf.network.proxy));
|
||||
|
@ -151,6 +151,6 @@ exports.up = function(knex, Promise) {
|
||||
]);
|
||||
};
|
||||
|
||||
exports.down = function(knex, Promise) {
|
||||
exports.down = function(_knex, Promise) {
|
||||
return Promise.reject(new Error('Not implemented'));
|
||||
};
|
||||
|
@ -315,6 +315,6 @@ exports.up = function(knex, Promise) {
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function(knex, Promise) {
|
||||
exports.down = function(_knex, Promise) {
|
||||
return Promise.reject(new Error('Not implemented'));
|
||||
};
|
||||
|
@ -1,10 +1,10 @@
|
||||
// Adds a dockerImageId column to the image table to identify images downloaded with deltas
|
||||
exports.up = function(knex, Promise) {
|
||||
exports.up = function(knex) {
|
||||
return knex.schema.table('image', t => {
|
||||
t.string('dockerImageId');
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function(knex, Promise) {
|
||||
exports.down = function(_knex, Promise) {
|
||||
return Promise.reject(new Error('Not implemented'));
|
||||
};
|
||||
|
@ -2,12 +2,12 @@ const fs = require('fs');
|
||||
const configJsonPath = process.env.CONFIG_MOUNT_POINT;
|
||||
|
||||
exports.up = function(knex, Promise) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise(resolve => {
|
||||
if (!configJsonPath) {
|
||||
console.log(
|
||||
'Unable to locate config.json! Things may fail unexpectedly!',
|
||||
);
|
||||
resolve({});
|
||||
return resolve({});
|
||||
}
|
||||
fs.readFile(configJsonPath, (err, data) => {
|
||||
if (err) {
|
||||
@ -40,6 +40,6 @@ exports.up = function(knex, Promise) {
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function(knex, Promise) {
|
||||
exports.down = function(_knex, Promise) {
|
||||
return Promise.reject(new Error('Not Implemented'));
|
||||
};
|
||||
|
@ -2,7 +2,7 @@ const fs = require('fs');
|
||||
const configJsonPath = process.env.CONFIG_MOUNT_POINT;
|
||||
|
||||
exports.up = function(knex, Promise) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise(resolve => {
|
||||
if (!configJsonPath) {
|
||||
console.log(
|
||||
'Unable to locate config.json! Things may fail unexpectedly!',
|
||||
@ -65,6 +65,6 @@ exports.up = function(knex, Promise) {
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function(knex, Promise) {
|
||||
exports.down = function(_knex, Promise) {
|
||||
return Promise.reject(new Error('Not Implemented'));
|
||||
};
|
||||
|
@ -1,10 +1,10 @@
|
||||
exports.up = (knex, Promise) => {
|
||||
exports.up = knex => {
|
||||
return knex.schema.createTable('engineSnapshot', t => {
|
||||
t.string('snapshot'); // Engine snapshot encoded as JSON.
|
||||
t.string('timestamp'); // When the snapshot was created.
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = (knex, Promise) => {
|
||||
exports.down = (_knex, Promise) => {
|
||||
return Promise.reject(new Error('Not Implemented'));
|
||||
};
|
||||
|
@ -3,7 +3,7 @@ const _ = require('lodash');
|
||||
// We take legacy deviceConfig targets and store them without the RESIN_ prefix
|
||||
// (we also strip the BALENA_ prefix for completeness, even though no supervisors
|
||||
// using this prefix made it to production)
|
||||
exports.up = function(knex, Promise) {
|
||||
exports.up = function(knex) {
|
||||
return knex('deviceConfig')
|
||||
.select('targetValues')
|
||||
.then(devConfigs => {
|
||||
@ -18,6 +18,6 @@ exports.up = function(knex, Promise) {
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function(knex, Promise) {
|
||||
exports.down = function(_knex, Promise) {
|
||||
return Promise.reject(new Error('Not Implemented'));
|
||||
};
|
||||
|
@ -61,6 +61,6 @@ exports.up = function(knex, Promise) {
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function(knex, Promise) {
|
||||
exports.down = function(_knex, Promise) {
|
||||
return Promise.reject(new Error('Not Implemented'));
|
||||
};
|
||||
|
@ -42,6 +42,6 @@ exports.up = function(knex, Promise) {
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function(knex, Promise) {
|
||||
exports.down = function(_knex, Promise) {
|
||||
return Promise.reject(new Error('Not Implemented'));
|
||||
};
|
||||
|
@ -16,6 +16,6 @@ exports.up = function(knex) {
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function(knex, Promise) {
|
||||
exports.down = function(_knex, Promise) {
|
||||
return Promise.reject(new Error('Not Implemented'));
|
||||
};
|
||||
|
@ -5,6 +5,6 @@ exports.up = function(knex) {
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function(knex, Promise) {
|
||||
exports.down = function(_knex, Promise) {
|
||||
return Promise.reject(new Error('Not Implemented'));
|
||||
};
|
||||
|
8
tsconfig.js.json
Normal file
8
tsconfig.js.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./tsconfig.release.json",
|
||||
"compilerOptions": {
|
||||
"noImplicitAny": false,
|
||||
"checkJs": true
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.js", "typings/**/*.d.ts"]
|
||||
}
|
Loading…
Reference in New Issue
Block a user