Add lots of linting
This commit is contained in:
@@ -2,6 +2,10 @@ import * as os from 'os'
|
||||
|
||||
// For internal use, subject to change.
|
||||
|
||||
interface CommandProperties {
|
||||
[key: string]: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
@@ -14,25 +18,25 @@ import * as os from 'os'
|
||||
*/
|
||||
export function issueCommand(
|
||||
command: string,
|
||||
properties: any,
|
||||
properties: CommandProperties,
|
||||
message: string
|
||||
) {
|
||||
): void {
|
||||
const cmd = new Command(command, properties, message)
|
||||
process.stdout.write(cmd.toString() + os.EOL)
|
||||
}
|
||||
|
||||
export function issue(name: string, message: string) {
|
||||
export function issue(name: string, message: string): void {
|
||||
issueCommand(name, {}, message)
|
||||
}
|
||||
|
||||
const CMD_PREFIX = '##['
|
||||
|
||||
class Command {
|
||||
constructor(
|
||||
command: string,
|
||||
properties: {[key: string]: string},
|
||||
message: string
|
||||
) {
|
||||
private readonly command: string
|
||||
private readonly message: string
|
||||
private readonly properties: CommandProperties
|
||||
|
||||
constructor(command: string, properties: CommandProperties, message: string) {
|
||||
if (!command) {
|
||||
command = 'missing.command'
|
||||
}
|
||||
@@ -42,11 +46,7 @@ class Command {
|
||||
this.message = message
|
||||
}
|
||||
|
||||
command: string
|
||||
message: string
|
||||
properties: {[key: string]: string}
|
||||
|
||||
toString() {
|
||||
toString(): string {
|
||||
let cmdStr = CMD_PREFIX + this.command
|
||||
|
||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
||||
@@ -67,7 +67,7 @@ class Command {
|
||||
|
||||
// safely append the message - avoid blowing up when attempting to
|
||||
// call .replace() if message is not a string for some reason
|
||||
const message: string = `${this.message || ''}`
|
||||
const message = `${this.message || ''}`
|
||||
cmdStr += escapeData(message)
|
||||
|
||||
return cmdStr
|
||||
|
||||
Reference in New Issue
Block a user