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

Fix lint issues #443

Merged
merged 18 commits into from
Aug 1, 2023
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
4 changes: 2 additions & 2 deletions buildScripts/bump-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function assertVersion() {
assert.ok(
(oldExtensionVersionSplit[1] < requestedVersionSplit[1] && requestedVersionSplit[2] === '0') || // Minor release
(oldExtensionVersionSplit[1] === requestedVersionSplit[1] && oldExtensionVersionSplit[2] < requestedVersionSplit[2]), // Patch release
'Input version must be bigger than current version'
'Input version must be bigger than current version',
);
assert.strictEqual(oldExtensionVersionSplit[0], requestedVersionSplit[0], 'Upgrading Major version using this script is forbidden');
}
Expand Down Expand Up @@ -71,7 +71,7 @@ function updateTasksVersion() {
' to X.' +
requestedVersionSplit[1] +
'.' +
requestedVersionSplit[2]
requestedVersionSplit[2],
);
updateTaskJsonWithNewVersion(taskVersionDirJson);
}
Expand Down
4 changes: 2 additions & 2 deletions jfrog-tasks-utils/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ declare module '@jfrog/tasks-utils' {
runTaskFunc: (cliPath: string) => void,
cliVersion?: string,
cliDownloadUrl?: string,
cliAuthHandlers?: ifm.IRequestHandler[]
cliAuthHandlers?: ifm.IRequestHandler[],
): void;
export function quote(str: string): string;
export function downloadCli(cliDownloadUrl?: string, cliAuthHandlers?: ifm.IRequestHandler[], cliVersion?: string): Promise<string>;
Expand All @@ -27,7 +27,7 @@ declare module '@jfrog/tasks-utils' {
requiredWorkDir: string,
configCommand: string,
repoResolver: string,
repoDeploy: string
repoDeploy: string,
): string[];
export function addProjectOption(cliCommand: string): string;
export function addServerIdOption(cliCommand: string, serverId: string): string;
Expand Down
4 changes: 2 additions & 2 deletions jfrog-tasks-utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const fileName = getCliExecutableName();
const jfrogCliToolName = 'jf';
const cliPackage = 'jfrog-cli-' + getArchitecture();
const jfrogFolderPath = encodePath(join(tl.getVariable('Agent.ToolsDirectory') || '', '_jf'));
const defaultJfrogCliVersion = '2.44.0';
const defaultJfrogCliVersion = '2.44.1';
const minCustomCliVersion = '2.10.0';
const minSupportedStdinSecretCliVersion = '2.36.0';
const minSupportedServerIdEnvCliVersion = '2.37.0';
Expand Down Expand Up @@ -271,7 +271,7 @@ function configureSpecificCliServer(service, urlFlag, serverId, cliPath, buildDi
cliCommand,
'--user=' + (isWindows() ? quote(serviceUser) : singleQuote(serviceUser)),
'--basic-auth-only',
secretInStdinSupported ? '--password-stdin' : '--password=' + (isWindows() ? quote(servicePassword) : singleQuote(servicePassword))
secretInStdinSupported ? '--password-stdin' : '--password=' + (isWindows() ? quote(servicePassword) : singleQuote(servicePassword)),
);
stdinSecret = secretInStdinSupported ? servicePassword : undefined;
}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"@types/mocha": "^10.0.1",
"@types/node": "^20.3.1",
"@types/q": "^1.5.5",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.9.0",
"prettier": "^2.8.8",
"prettier": "^3.0.0",
"tfx-cli": "^0.15.0",
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ define(['TFS/DistributedTask/TaskRestClient'], (taskRestClient) => {
timelineId,
recId,
'artifactoryType',
'buildDetails'
'buildDetails',
)
.then((attachmentContent) => {
let buildDetails = JSON.parse(bufferToString(attachmentContent));
Expand Down
2 changes: 1 addition & 1 deletion tasks/JFrogCliV2/jfrogCliRun.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function RunTaskCbk(cliPath) {
if (!cliCommand.startsWith(utils.jfrogCliToolName + ' ')) {
tl.setResult(
tl.TaskResult.Failed,
"Unexpected JFrog CLI command prefix. Expecting the command to start with 'jf '. The command received is: " + cliCommand
"Unexpected JFrog CLI command prefix. Expecting the command to start with 'jf '. The command received is: " + cliCommand,
);
utils.taskDefaultCleanup(cliPath, requiredWorkDir, [serverId]);
return;
Expand Down
2 changes: 1 addition & 1 deletion tasks/JFrogCollectIssues/collectIssues.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function RunTaskCbk(cliPath) {
cliCollectIssuesCommand,
utils.quote(buildName),
utils.quote(buildNumber),
'--config=' + utils.quote(configPath)
'--config=' + utils.quote(configPath),
);
cliCommand = utils.addProjectOption(cliCommand);
cliCommand = utils.addServerIdOption(cliCommand, serverId);
Expand Down
2 changes: 1 addition & 1 deletion tasks/JFrogConan/conanBuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function handleAddRemoteCommand() {
// Access token is not supported.
console.error(
'Access Token is not supported for authentication with Artifactory, please configure Artifactory service connection' +
' to work with basic authentication.'
' to work with basic authentication.',
);
setTaskResult(false);
return;
Expand Down
2 changes: 1 addition & 1 deletion tasks/JFrogDocker/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function RunTaskCbk(cliPath: string): void {
return;
}

let defaultWorkDir: string = tl.getVariable('System.DefaultWorkingDirectory') ?? '';
const defaultWorkDir: string = tl.getVariable('System.DefaultWorkingDirectory') ?? '';
if (!defaultWorkDir) {
tl.setResult(tl.TaskResult.Failed, 'Failed getting default working directory.');
return;
Expand Down
2 changes: 1 addition & 1 deletion tasks/JFrogGenericArtifacts/runGenericArtifacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function performArtifactSourceDownload(cliPath, workDir) {
utils.quote('*'),
utils.quote(downloadPath),
'--build=' + utils.quote(buildName + '/' + buildNumber),
'--fail-no-op'
'--fail-no-op',
);

// Add project flag if provided
Expand Down
24 changes: 12 additions & 12 deletions tasks/JFrogMaven/mavenBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ utils.executeCliTask(RunTaskCbk);
function RunTaskCbk(cliPath: string): void {
utils.setJdkHomeForJavaTasks();
checkAndSetMavenHome();
let workDir: string | undefined = tl.getVariable('System.DefaultWorkingDirectory');
const workDir: string | undefined = tl.getVariable('System.DefaultWorkingDirectory');
if (!workDir) {
tl.setResult(tl.TaskResult.Failed, 'Failed getting default working directory.');
return;
Expand All @@ -27,10 +27,10 @@ function RunTaskCbk(cliPath: string): void {
}

// Running Maven command
let pomFile: string | undefined = tl.getInput('mavenPOMFile') ?? '';
const pomFile: string | undefined = tl.getInput('mavenPOMFile') ?? '';
let goalsAndOptions: string | undefined = tl.getInput('goals') ?? '';
goalsAndOptions = utils.cliJoin(goalsAndOptions, '-f', pomFile);
let options: string = tl.getInput('options') ?? '';
const options: string = tl.getInput('options') ?? '';
if (options) {
goalsAndOptions = utils.cliJoin(goalsAndOptions, options);
}
Expand All @@ -48,20 +48,20 @@ function RunTaskCbk(cliPath: string): void {
}

function checkAndSetMavenHome(): void {
let m2HomeEnvVar: string | undefined = tl.getVariable('M2_HOME');
const m2HomeEnvVar: string | undefined = tl.getVariable('M2_HOME');
if (!m2HomeEnvVar) {
console.log('M2_HOME is not defined. Retrieving Maven home using mvn --version.');
// The M2_HOME environment variable is not defined.
// Since Maven installation can be located in different locations,
// depending on the installation type and the OS (for example: For Mac with brew install: /usr/local/Cellar/maven/{version}/libexec or Ubuntu with debian: /usr/share/maven),
// we need to grab the location using the mvn --version command
// Setup tool runner that executes Maven only to retrieve its version
let mvnExec: string = tl.which('mvn', true);
let res: string = tl.tool(mvnExec).arg('-version').execSync().stdout.trim();
let mavenHomeLine: string = res.split('\n')[1].trim();
let regexMatch: RegExpMatchArray | null = mavenHomeLine.match('^Maven\\shome:\\s(.+)');
const mvnExec: string = tl.which('mvn', true);
const res: string = tl.tool(mvnExec).arg('-version').execSync().stdout.trim();
const mavenHomeLine: string = res.split('\n')[1].trim();
const regexMatch: RegExpMatchArray | null = mavenHomeLine.match('^Maven\\shome:\\s(.+)');
if (regexMatch) {
let mavenHomePath: string = regexMatch[1];
const mavenHomePath: string = regexMatch[1];
console.log('The Maven home location: ' + mavenHomePath);
process.env['M2_HOME'] = mavenHomePath;
} else {
Expand All @@ -74,7 +74,7 @@ function createMavenConfigFile(cliPath: string, buildDir: string) {
let cliCommand: string = utils.cliJoin(cliPath, mavenConfigCommand);

// Configure resolver server, throws on failure.
let artifactoryResolver: string | undefined = tl.getInput('artifactoryResolverService');
const artifactoryResolver: string | undefined = tl.getInput('artifactoryResolverService');
if (artifactoryResolver) {
serverIdResolver = utils.assembleUniqueServerId('maven_resolver');
utils.configureArtifactoryCliServer(artifactoryResolver, serverIdResolver, cliPath, buildDir);
Expand All @@ -86,14 +86,14 @@ function createMavenConfigFile(cliPath: string, buildDir: string) {
}

// Configure deployer server, skip if missing. This allows user to resolve dependencies from artifactory without deployment.
let artifactoryDeployer: string = tl.getInput('artifactoryDeployService') ?? '';
const artifactoryDeployer: string = tl.getInput('artifactoryDeployService') ?? '';
if (artifactoryDeployer) {
serverIdDeployer = utils.assembleUniqueServerId('maven_deployer');
utils.configureArtifactoryCliServer(artifactoryDeployer, serverIdDeployer, cliPath, buildDir);
cliCommand = utils.cliJoin(cliCommand, '--server-id-deploy=' + utils.quote(serverIdDeployer));
cliCommand = utils.addStringParam(cliCommand, 'targetDeployReleaseRepo', 'repo-deploy-releases', true);
cliCommand = utils.addStringParam(cliCommand, 'targetDeploySnapshotRepo', 'repo-deploy-snapshots', true);
let filterDeployedArtifacts: boolean | undefined = tl.getBoolInput('filterDeployedArtifacts');
const filterDeployedArtifacts: boolean | undefined = tl.getBoolInput('filterDeployedArtifacts');
if (filterDeployedArtifacts) {
cliCommand = utils.addStringParam(cliCommand, 'includePatterns', 'include-patterns', false);
cliCommand = utils.addStringParam(cliCommand, 'excludePatterns', 'exclude-patterns', false);
Expand Down
2 changes: 1 addition & 1 deletion tasks/JFrogPublishBuildInfo/publishBuildInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function RunTaskCbk(cliPath) {
cliBuildPublishCommand,
utils.quote(buildName),
utils.quote(buildNumber),
excludeEnvVars ? '--env-exclude=' + utils.quote(excludeEnvVars) : ''
excludeEnvVars ? '--env-exclude=' + utils.quote(excludeEnvVars) : '',
);
cliCommand = addBuildUrl(cliCommand);
cliCommand = utils.addProjectOption(cliCommand);
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/collectIssues/collect.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const configYaml = {
aggregationStatus: 'RELEASED',
},
};
const configString = yaml.safeDump(configYaml);
const configString = yaml.dump(configYaml);

let inputs = {
buildName: 'Collect issues',
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/distribution/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ writeFileSync(
},
],
}),
'utf8'
'utf8',
);

let inputs = {
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/distribution/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ writeFileSync(
},
],
}),
'utf8'
'utf8',
);

let inputs = {
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/uploadAndDownloadFromFile/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ writeFileSync(
},
],
}),
'utf8'
'utf8',
);

let inputs = {
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/uploadAndDownloadFromFile/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ writeFileSync(
},
],
}),
'utf8'
'utf8',
);

let inputs = {
Expand Down
Loading
Loading