Skip to content

Commit a8185e0

Browse files
committed
Cleanup eslint error and remove not needed function (build 2)
Signed-off-by: Denis Golovin [email protected]
1 parent 62e5324 commit a8185e0

File tree

3 files changed

+20
-26
lines changed

3 files changed

+20
-26
lines changed

build/archive.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ export class Archive {
5454
fileName: string,
5555
prefix: string,
5656
): Promise<void> {
57-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
5857
return pify(targz.decompress)({
5958
src: zipFile,
6059
dest: extractTo,

src/componentsView.ts

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface WorkspaceEntry {
2020
}
2121

2222
class Labeled {
23-
constructor(public label: string) {}
23+
constructor(public label: string) { }
2424
}
2525

2626
class Project extends Labeled {
@@ -31,20 +31,16 @@ class Application extends Labeled {
3131

3232
type Entry = Project | Application | WorkspaceEntry | WorkspaceFolderComponent;
3333

34-
export interface WorkspaceFolderComponent extends vsc.TreeItem{
34+
export interface WorkspaceFolderComponent extends vsc.TreeItem {
3535
project: string;
3636
application: string;
3737
contextUri: vsc.Uri;
3838
}
3939

40-
function isWorkspaceFolderComponent(entry): entry is WorkspaceFolderComponent {
41-
return entry.contextUri;
42-
}
43-
4440
async function getComponentsInWorkspace(): Promise<WorkspaceFolderComponent[]> {
4541
const execs: Promise<CliExitData>[] = [];
4642
if (vsc.workspace.workspaceFolders) {
47-
vsc.workspace.workspaceFolders.forEach((folder)=> {
43+
vsc.workspace.workspaceFolders.forEach((folder) => {
4844
try {
4945
execs.push(getInstance().execute(Command.viewEnv(), folder.uri.fsPath, false));
5046
} catch (ignore) {
@@ -61,7 +57,7 @@ async function getComponentsInWorkspace(): Promise<WorkspaceFolderComponent[]> {
6157
const pathToS2iConfig = path.join(result.cwd.toString(), '.odo', 'config.yaml');
6258
if (pathExistsSync(pathToS2iConfig)) {
6359
// reconstruct env view form yaml file data
64-
const s2iConf = jsYaml.load(readFileSync(pathToS2iConfig, 'utf8')) as any;
60+
const s2iConf: any = jsYaml.load(readFileSync(pathToS2iConfig, 'utf8'));
6561
compData = {
6662
spec: {
6763
appName: s2iConf.ComponentSettings.Application,
@@ -81,7 +77,7 @@ async function getComponentsInWorkspace(): Promise<WorkspaceFolderComponent[]> {
8177
`Project: ${project}`,
8278
`Application: ${application}`,
8379
`Context: ${contextUri.fsPath}`,
84-
].join('\n');
80+
].join('\n');
8581
const description = `${project}/${application}`;
8682
return {
8783
project,
@@ -120,9 +116,9 @@ export class ComponentsTreeDataProvider extends BaseTreeDataProvider<Entry> {
120116
}
121117

122118
@vsCommand('openshift.component.revealInExplorer')
123-
public static async revealInExplorer(context: Entry): Promise<void> {
124-
if (isWorkspaceFolderComponent(context)) {
125-
await vsc.commands.executeCommand('workbench.view.explorer', );
119+
public static async revealInExplorer(context: WorkspaceFolderComponent): Promise<void> {
120+
if (context.contextUri) {
121+
await vsc.commands.executeCommand('workbench.view.explorer',);
126122
await vsc.commands.executeCommand('revealInExplorer', context.contextUri);
127123
}
128124
}
@@ -143,10 +139,8 @@ export class ComponentsTreeDataProvider extends BaseTreeDataProvider<Entry> {
143139
return ComponentsTreeDataProvider.dataProviderInstance;
144140
}
145141

146-
getTreeItem(element: Entry): vsc.TreeItem {
147-
if (isWorkspaceFolderComponent(element)) {
148-
return element;
149-
}
142+
getTreeItem(element: WorkspaceFolderComponent): vsc.TreeItem {
143+
return element;
150144
}
151145

152146
getChildren(element?: Entry): vsc.ProviderResult<Entry[]> {
@@ -156,4 +150,4 @@ export class ComponentsTreeDataProvider extends BaseTreeDataProvider<Entry> {
156150
return result;
157151
})
158152
}
159-
}
153+
}

test/ui/common/constants.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ export const VIEWS = {
1212
compTypes: 'Component Types',
1313
watchSessions: 'Watch Sessions',
1414
debugSessions: 'Debug Sessions',
15-
devFileRegistry: 'DefaultDevfileRegistry'
15+
devFileRegistry: 'DefaultDevfileRegistry',
1616
};
1717

1818
export const BUTTONS = {
1919
login: 'Login',
2020
kubeContext: 'Select Kubernetes Context',
2121
addCluster: 'Add OpenShift Cluster',
22-
newComponent: 'New Component'
22+
newComponent: 'New Component',
2323
};
2424

2525
export const INPUTS = {
@@ -28,24 +28,25 @@ export const INPUTS = {
2828
newUserQuickPick: 'Add new user...',
2929
newFolderQuickPick: 'Add new context folder to workspace',
3030
yes: 'Yes',
31-
no: 'No'
31+
no: 'No',
3232
};
3333

3434
export const MENUS = {
3535
newProject: 'New Project',
3636
delete: 'Delete',
37-
push: 'Push'
37+
push: 'Push',
3838
};
3939

4040
export const COMPONENTS = {
4141
nodejsDevfile: 'nodejs (devfile)',
4242
devfileComponent: (name: string) => `${name} (devfile)`,
43-
pushSuccess: 'Changes successfully pushed'
43+
pushSuccess: 'Changes successfully pushed',
4444
};
4545

4646
export const NOTIFICATIONS = {
47-
deleteProjectWarning: (projectName: string) => `Do you want to delete Project '${projectName}'?`,
47+
deleteProjectWarning: (projectName: string) =>
48+
`Do you want to delete Project '${projectName}'?`,
4849
projectDeleteSuccess: (projectName: string) => `Project '${projectName}' successfully deleted`,
4950
savePasswordPrompt: 'Do you want to save username and password?',
50-
loginSuccess: (cluster: string) => `Successfully logged in to '${cluster}'`
51-
};
51+
loginSuccess: (cluster: string) => `Successfully logged in to '${cluster}'`,
52+
};

0 commit comments

Comments
 (0)