Skip to content

Commit 05cfead

Browse files
committed
style(js-toolkit): make linter happy again
1 parent 5fda5ae commit 05cfead

File tree

6 files changed

+22
-14
lines changed

6 files changed

+22
-14
lines changed

projects/js-toolkit/packages/portal-adapt-base/src/build.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ import runNodeModulesBin from './util/runNodeModulesBin';
1010
import runPkgJsonScript from './util/runPkgJsonScript';
1111

1212
const {fail, info, print} = format;
13-
const {ProjectType} = project;
13+
const {ANGULAR_CLI, CREATE_REACT_APP, VUE_CLI} = project.ProjectType;
1414

1515
const templatesDir = new FilePath(__dirname).join('templates');
1616

1717
export default async function build(): Promise<void> {
1818
switch (project.default.probe.type) {
19-
case ProjectType.ANGULAR_CLI:
19+
case ANGULAR_CLI:
2020
await buildWith('build');
2121
break;
2222

23-
case ProjectType.CREATE_REACT_APP:
23+
case CREATE_REACT_APP:
2424
await buildWith('build');
2525
break;
2626

27-
case ProjectType.VUE_CLI:
27+
case VUE_CLI:
2828
await buildWith('build', ['--prod=true']);
2929
break;
3030

projects/js-toolkit/packages/portal-base/src/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function runBundler(): void {
114114
);
115115
const bundlerDir = path.dirname(bundlerPkgJsonPath);
116116

117-
/* eslint-disable-next-line @liferay/no-dynamic-require */
117+
/* eslint-disable-next-line */
118118
const bundlerPkgJson = require(bundlerPkgJsonPath);
119119
const bundlerPath = path.resolve(
120120
bundlerDir,

projects/js-toolkit/packages/portal-base/src/deploy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default async function deploy(): Promise<void> {
2525
process.exit(1);
2626
}
2727

28-
let deployPath = configuration.get('deploy', 'path');
28+
let deployPath = configuration.get('deploy', 'path') as string;
2929

3030
if (!deployPath) {
3131
deployPath = await promptForDeployPath();

projects/js-toolkit/packages/portal-base/src/index.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ export interface Tasks {
1818
deploy?: {(): Promise<void>};
1919
}
2020

21-
export default function run(platformPath: string, taskOverrides: Tasks) {
21+
export default async function run(
22+
platformPath: string,
23+
taskOverrides: Tasks
24+
): Promise<void> {
2225
if (process.argv.length < 3) {
2326
print(fail`No command provided`);
2427
process.exit(1);
@@ -35,17 +38,17 @@ export default function run(platformPath: string, taskOverrides: Tasks) {
3538
print(
3639
title`Building project for target platform: {${pkgJson.name}}`
3740
);
38-
tasks.build();
41+
await tasks.build();
3942
break;
4043

4144
case 'clean':
4245
print(title`Cleaning output folders`);
43-
tasks.clean();
46+
await tasks.clean();
4447
break;
4548

4649
case 'deploy':
4750
print(title`Deploying project to Liferay local installation`);
48-
tasks.deploy();
51+
await tasks.deploy();
4952
break;
5053

5154
default:

projects/js-toolkit/packages/portal-base/src/util/configuration.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import fs from 'fs';
77
import project from 'liferay-npm-build-tools-common/lib/project';
88

99
export type Command = 'deploy';
10+
export type ConfigurationValue = boolean | number | object | string;
1011

1112
export interface Configuration {
1213
deploy?: {
@@ -17,7 +18,7 @@ export interface Configuration {
1718
const CONFIGURATION_FILE = '.liferay.json';
1819
const configuration = load();
1920

20-
export function get(command: Command, key: string) {
21+
export function get(command: Command, key: string): ConfigurationValue {
2122
configuration[command] = configuration[command] || {};
2223

2324
return configuration[command][key];
@@ -51,7 +52,11 @@ function save(): void {
5152
);
5253
}
5354

54-
export function set(command: Command, key: string, value) {
55+
export function set(
56+
command: Command,
57+
key: string,
58+
value: ConfigurationValue
59+
): void {
5560
configuration[command] = configuration[command] || {};
5661
configuration[command][key] = value;
5762

projects/js-toolkit/packages/portal-base/src/util/sassImporter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {FilePath} from '@liferay/js-toolkit-core';
77
import fs from 'fs';
88
import {sync as resolve} from 'resolve';
99

10-
export default function (url: string) {
10+
export default function (url: string): {file: string} {
1111
const importDir = new FilePath(this.options.file).dirname();
1212

1313
let targetFile = tryImport(url, (file) => {
@@ -52,7 +52,7 @@ function sassResolve(module: string): string {
5252
return undefined;
5353
}
5454

55-
/* eslint-disable-next-line @liferay/no-dynamic-require */
55+
/* eslint-disable-next-line */
5656
const packageJson = require(resolvedPath);
5757
const entryPoint = packageJson.style || packageJson.main;
5858

0 commit comments

Comments
 (0)