Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lint] Remove re-declare #1302

Merged
merged 1 commit into from
Sep 30, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 2 additions & 6 deletions src/Job/Job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export type JobCallback = {
};

export interface Job {
jobType: Job.Type;
jobType: JobType;
name: string;
notiTitle?: string;
valid: boolean;
Expand All @@ -42,15 +42,11 @@ export interface Job {
// - tool: apt-get
// - toolArgs: install pkg_name

export namespace Job {

export const enum Type {
export const enum JobType {
tUndefined = 0, // TODO maybe use Job.jobType = undefined?
tConfig,
tPrerequisites,
tInstall,
tUninstall,
// TODO add more
}

} // namespace Job
6 changes: 3 additions & 3 deletions src/Job/JobCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import assert from 'assert';

import {Command} from '../Backend/Command';

import {Job, JobCallback} from './Job';
import {Job, JobCallback, JobType} from './Job';
import {ToolArgs} from './ToolArgs';

// NOTE: JobBase will be replaced by this
class JobCommand implements Job {
jobType: Job.Type;
jobType: JobType;
name: string;
notiTitle?: string;
valid: boolean;
Expand All @@ -37,7 +37,7 @@ class JobCommand implements Job {

constructor(cmd: Command) {
// should be implemented by child classes
this.jobType = Job.Type.tUndefined;
this.jobType = JobType.tUndefined;
this.name = '';
this.valid = false;
this.workDir = require('os').homedir();
Expand Down
6 changes: 3 additions & 3 deletions src/Tests/MockJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

import {Job} from '../Job/Job';
import {Job, JobType} from '../Job/Job';
import {ToolArgs} from '../Job/ToolArgs';

class MockJob implements Job {
jobType: Job.Type = Job.Type.tUndefined;
jobType: JobType = JobType.tUndefined;
name: string;
root: boolean = false;
workDir: string = require('os').homedir();
Expand All @@ -44,7 +44,7 @@ class MockJob implements Job {
}

class MockFailedJob implements Job {
jobType: Job.Type = Job.Type.tUndefined;
jobType: JobType = JobType.tUndefined;
name: string;
root: boolean = false;
workDir: string = require('os').homedir();
Expand Down
4 changes: 2 additions & 2 deletions src/Tests/Toolchain/JobConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import {assert} from 'chai';

import {Command} from '../../Backend/Command';
import {Job} from '../../Job/Job';
import {JobType} from '../../Job/Job';
import {JobConfig} from '../../Toolchain/JobConfig';

suite('Toolchain', function() {
Expand All @@ -33,7 +33,7 @@ suite('Toolchain', function() {
assert.deepStrictEqual(job.toolArgs[0], cmd[1]);
assert.deepStrictEqual(job.toolArgs[1], cmd[2]);
assert.deepStrictEqual(job.name, 'config');
assert.equal(job.jobType, Job.Type.tConfig);
assert.equal(job.jobType, JobType.tConfig);
assert.isTrue(job.valid);
assert.isTrue(job.isCancelable);
});
Expand Down
4 changes: 2 additions & 2 deletions src/Tests/Toolchain/JobInstall.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import {assert} from 'chai';

import {Command} from '../../Backend/Command';
import {Job} from '../../Job/Job';
import {JobType} from '../../Job/Job';
import {JobInstall} from '../../Toolchain/JobInstall';

suite('Toolchain', function() {
Expand All @@ -33,7 +33,7 @@ suite('Toolchain', function() {
assert.deepStrictEqual(job.toolArgs[0], cmd[1]);
assert.deepStrictEqual(job.toolArgs[1], cmd[2]);
assert.deepStrictEqual(job.name, 'install');
assert.equal(job.jobType, Job.Type.tInstall);
assert.equal(job.jobType, JobType.tInstall);
assert.isTrue(job.valid);
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/Tests/Toolchain/JobPrerequisites.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import {assert} from 'chai';

import {Command} from '../../Backend/Command';
import {Job} from '../../Job/Job';
import {JobType} from '../../Job/Job';
import {JobPrerequisites} from '../../Toolchain/JobPrerequisites';

suite('Toolchain', function() {
Expand All @@ -31,7 +31,7 @@ suite('Toolchain', function() {
assert.deepStrictEqual(job.tool, cmd[0]);
assert.deepStrictEqual(job.toolArgs[0], cmd[1]);
assert.deepStrictEqual(job.name, 'prerequisites');
assert.equal(job.jobType, Job.Type.tPrerequisites);
assert.equal(job.jobType, JobType.tPrerequisites);
assert.isTrue(job.valid);
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/Tests/Toolchain/JobUninstall.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import {assert} from 'chai';

import {Command} from '../../Backend/Command';
import {Job} from '../../Job/Job';
import {JobType} from '../../Job/Job';
import {JobUninstall} from '../../Toolchain/JobUninstall';

suite('Toolchain', function() {
Expand All @@ -33,7 +33,7 @@ suite('Toolchain', function() {
assert.deepStrictEqual(job.toolArgs[0], cmd[1]);
assert.deepStrictEqual(job.toolArgs[1], cmd[2]);
assert.deepStrictEqual(job.name, 'uninstall');
assert.equal(job.jobType, Job.Type.tUninstall);
assert.equal(job.jobType, JobType.tUninstall);
assert.isTrue(job.valid);
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/Toolchain/JobConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
*/

import {Command} from '../Backend/Command';
import {Job} from '../Job/Job';
import {JobType} from '../Job/Job';
import {JobCommand} from '../Job/JobCommand';

class JobConfig extends JobCommand {
jobType: Job.Type;
jobType: JobType;
name: string;
valid: boolean;

constructor(cmd: Command) {
super(cmd);
this.jobType = Job.Type.tConfig;
this.jobType = JobType.tConfig;
this.name = 'config';
this.notiTitle = 'Running onecc...';
this.valid = true;
Expand Down
6 changes: 3 additions & 3 deletions src/Toolchain/JobInstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
*/

import {Command} from '../Backend/Command';
import {Job} from '../Job/Job';
import {JobType} from '../Job/Job';
import {JobCommand} from '../Job/JobCommand';

class JobInstall extends JobCommand {
jobType: Job.Type;
jobType: JobType;
name: string;
valid: boolean;

constructor(cmd: Command) {
super(cmd);
this.jobType = Job.Type.tInstall;
this.jobType = JobType.tInstall;
this.name = 'install';
this.notiTitle = 'Installing the toolchain...';
this.valid = true;
Expand Down
6 changes: 3 additions & 3 deletions src/Toolchain/JobPrerequisites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
*/

import {Command} from '../Backend/Command';
import {Job} from '../Job/Job';
import {JobType} from '../Job/Job';
import {JobCommand} from '../Job/JobCommand';

class JobPrerequisites extends JobCommand {
jobType: Job.Type;
jobType: JobType;
name: string;
valid: boolean;

constructor(cmd: Command) {
super(cmd);
this.jobType = Job.Type.tPrerequisites;
this.jobType = JobType.tPrerequisites;
this.name = 'prerequisites';
this.valid = true;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Toolchain/JobUninstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
*/

import {Command} from '../Backend/Command';
import {Job} from '../Job/Job';
import {JobType} from '../Job/Job';
import {JobCommand} from '../Job/JobCommand';

class JobUninstall extends JobCommand {
jobType: Job.Type;
jobType: JobType;
name: string;
valid: boolean;

constructor(cmd: Command) {
super(cmd);
this.jobType = Job.Type.tUninstall;
this.jobType = JobType.tUninstall;
this.name = 'uninstall';
this.notiTitle = 'Uninstalling the toolchain...';
this.valid = true;
Expand Down