AAE-48934 Eslint v9 migration (#12110)

* update

* update

* update

* working

* cr

* cr

* update

* use nx boundaries

* fixes

* fixes

* fixes

* cr

* cr

* update

* update

* update

* cr

* fix null

* cr

* cr

* cr

* cr

* cr

* update

* update

* update

* update

* update

* remove some duplications

* fix units
This commit is contained in:
Bartosz Sekula
2026-08-03 12:12:48 +02:00
committed by GitHub
parent 4123a89814
commit 3f232e75bc
325 changed files with 2327 additions and 1767 deletions
+8 -2
View File
@@ -29,6 +29,14 @@ interface AuditCommandArgs {
outDir?: string;
}
/**
* Render the audit report as a Markdown page.
*
* @param jsonAudit parsed npm audit JSON output
* @param projName project name
* @param projVersion project version
* @returns rendered Markdown string
*/
function renderAuditPage(jsonAudit: any, projName: string, projVersion: string): string {
const rows: string[] = [];
if (jsonAudit.auditReportVersion >= 2) {
@@ -122,7 +130,6 @@ Options:
}
return new Promise((resolve, reject) => {
// eslint-disable-next-line no-console
console.log(`Running audit on ${packagePath}`);
const packageJson = JSON.parse(fs.readFileSync(packagePath).toString());
@@ -172,7 +179,6 @@ Options:
fs.writeFileSync(outputFile, mdText);
// eslint-disable-next-line no-console
console.log(`Report saved as ${outputFile}`);
resolve(0);
});
+19 -3
View File
@@ -17,8 +17,6 @@
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/naming-convention */
import { argv, exit } from 'node:process';
import { parseArgs } from 'node:util';
import { spawnSync } from 'node:child_process';
@@ -146,7 +144,7 @@ function getCommits(options: DiffOptions): Array<Commit> {
.map((str: string) => {
try {
return JSON.parse(str) as Commit;
} catch (error) {
} catch {
logger.error(`Unparsable commit message: ${str}, dropping it... Please apply manual fix.`);
return null;
}
@@ -167,6 +165,15 @@ function commitAuthorAllowed(commit: Commit, authorFilter: string): boolean {
return !(filterRegex.test(commit.author) || filterRegex.test(commit.author_email));
}
/**
* Render changelog as Markdown.
*
* @param commits list of commits
* @param projName project name
* @param projVersion project version
* @param repoUrl repository URL
* @returns rendered Markdown string
*/
function renderChangelogMd(commits: Commit[], projName: string, projVersion: string, repoUrl: string): string {
const lines = commits.map((c) => `- [${c.hash}](${repoUrl}/commit/${c.hash}) ${escapeHtml(c.subject)}`);
return `---
@@ -179,6 +186,15 @@ ${lines.join('\n')}
`;
}
/**
* Render changelog as HTML.
*
* @param commits list of commits
* @param projName project name
* @param projVersion project version
* @param repoUrl repository URL
* @returns rendered HTML string
*/
function renderChangelogHtml(commits: Commit[], projName: string, projVersion: string, repoUrl: string): string {
const items = commits
.map((c) => ` <li>\n <a href="${repoUrl}/commit/${c.hash}">[${c.hash}]</a> ${escapeHtml(c.subject)}\n </li>`)
+12 -6
View File
@@ -90,8 +90,9 @@ async function healthCheck(nameService: string) {
}
/**
* Get deployed application
* Get deployed application.
*
* @returns list of deployed applications
*/
async function getApplications(): Promise<{ list: { entries: any[] } }> {
const url = `${args.host}/deployment-service/v1/applications`;
@@ -236,9 +237,10 @@ function getProjectRelease(projectId: string) {
}
/**
* Release project
* Release project.
*
* @param projectId project id
* @returns release response
*/
async function releaseProject(projectId: string) {
const url = `${args.host}/modeling-service/v1/projects/${projectId}/releases`;
@@ -307,9 +309,10 @@ function deleteProject(projectId: string) {
}
/**
* Import and release project
* Import and release project.
*
* @param absoluteFilePath path to project file
* @returns released project
*/
async function importAndReleaseProject(absoluteFilePath: string) {
const fileContent = fs.createReadStream(absoluteFilePath);
@@ -585,9 +588,10 @@ async function deployWithPayload(currentAbsentApp: any, projectRelease: any, env
}
/**
* Check if descriptor exists
* Check if descriptor exists.
*
* @param name descriptor name
* @returns `true` if descriptor exists
*/
async function checkDescriptorExist(name: string): Promise<boolean> {
logger.info(`Check descriptor ${name} exist in the list `);
@@ -606,10 +610,11 @@ async function checkDescriptorExist(name: string): Promise<boolean> {
}
/**
* Import and release project
* Import and release project.
*
* @param app application
* @param tag tag
* @returns released project
*/
async function importProjectAndRelease(app: any, tag?: string) {
const appLocationReplaced = app.file_location(tag);
@@ -667,10 +672,11 @@ function findFailingApps(deployedApps: any[]): any[] {
}
/**
* Get file from the remote
* Get file from the remote.
*
* @param url url to file
* @param name name
* @returns resolves when the file is downloaded
*/
async function getFileFromRemote(url: string, name: string): Promise<void> {
return fetch(url)
+12
View File
@@ -119,6 +119,7 @@ async function initializeDefaultFiles() {
/**
* Process a single file: upload if missing, then apply its action (lock/share/favorite).
*
* @param fileInfo file descriptor from ACS_DEFAULT
* @param fileInfo.name file name
* @param fileInfo.action action to apply (LOCK, SHARE, FAVORITE)
@@ -154,6 +155,7 @@ async function processFile(fileInfo: { name: string; action: string }, parentFol
/**
* Ensure a folder exists under the given parent. Creates it if missing.
* Handles 409 conflict (race condition) by fetching the existing folder.
*
* @param folderName folder name
* @param parentId parent node id
* @returns the folder node entry
@@ -196,6 +198,7 @@ async function ensureFolder(folderName: string, parentId: string): Promise<NodeE
/**
* Find a node by relative path under a parent. Returns null if not found (404).
*
* @param parentId parent node id
* @param fileName relative path / file name
* @returns the node entry or null if not found
@@ -214,6 +217,7 @@ async function findNodeByRelativePath(parentId: string, fileName: string): Promi
/**
* Upload a file to the given destination folder.
*
* @param fileName file name
* @param destinationId destination folder node id
* @returns the uploaded node entry
@@ -238,6 +242,7 @@ async function uploadFile(fileName: string, destinationId: string): Promise<Node
/**
* Ensure a file is locked. Skips if already locked.
*
* @param nodeId node id
* @param fileName file name (for logging)
* @param isAlreadyLocked whether the node is already locked
@@ -258,6 +263,7 @@ async function ensureLocked(nodeId: string, fileName: string, isAlreadyLocked =
/**
* Ensure a file is shared. Handles 409 (already shared) gracefully.
*
* @param nodeId node id
* @param fileName file name (for logging)
*/
@@ -277,6 +283,7 @@ async function ensureShared(nodeId: string, fileName: string) {
/**
* Ensure a file is favorite. Handles 409 (already favorite) gracefully.
*
* @param nodeId node id
* @param fileName file name (for logging)
*/
@@ -302,6 +309,7 @@ async function ensureFavorite(nodeId: string, fileName: string) {
/**
* Extract entry id from a node response. Throws if missing.
*
* @param nodeEntry node entry response
* @param label label for error message
* @returns the node id
@@ -318,6 +326,7 @@ function getEntryId(nodeEntry: NodeEntry, label: string): string {
/**
* Format an error for logging.
*
* @param error error object
* @returns formatted error string
*/
@@ -339,6 +348,7 @@ function formatError(error: any): string {
/**
* Retry wrapper for transient failures.
*
* @param fn async function to execute
* @param label label for logging
* @param maxAttempts maximum retry attempts
@@ -364,6 +374,7 @@ async function withRetry<T>(fn: () => Promise<T>, label: string, maxAttempts = 3
/**
* Async delay.
*
* @param ms milliseconds to wait
* @returns a promise that resolves after the delay
*/
@@ -373,6 +384,7 @@ function wait(ms: number): Promise<void> {
/**
* Check environment state and authenticate. Retries on transient failures.
*
* @param opts command options
* @param attempt current attempt number
*/
+18
View File
@@ -182,6 +182,7 @@ Options:
* If the app is already present, returns true (skip full init).
* If hruser can log in but the app is missing, imports, publishes and deploys it.
* Returns false only if hruser cannot log in or deployment fails.
*
* @returns `true` if app is deployed, otherwise `false`
*/
async function ensureE2eApplicationDeployed(): Promise<boolean> {
@@ -236,6 +237,7 @@ async function initializeDefaultApps() {
/**
* Check environment state and authenticate. Retries on transient failures.
*
* @param opts command options
* @param attempt current attempt number
*/
@@ -277,6 +279,7 @@ async function checkEnv(opts: InitApsEnvArgs, attempt = 1) {
/**
* Check if the default tenant is present
*
* @param tenantId tenant id
* @param tenantName tenant name
* @returns `true` if tenant is found, otherwise `false`
@@ -304,6 +307,7 @@ async function hasDefaultTenant(tenantId: number, tenantName: string): Promise<b
/**
* Create default tenant
*
* @param tenantName tenant name
* @returns the tenant id or null
*/
@@ -327,6 +331,7 @@ async function createDefaultTenant(tenantName: string) {
/**
* Create users
*
* @param tenantId tenant id
* @param user user object
* @returns the created user
@@ -355,6 +360,7 @@ async function createUsers(tenantId: number, user: any) {
/**
* Update Activiti license
*
* @param opts command options
* @returns `true` if license uploaded successfully, otherwise `false`
*/
@@ -383,6 +389,7 @@ async function updateLicense(opts: InitApsEnvArgs) {
/**
* Check if default application is deployed
*
* @param appName application name
* @returns `true` if application is deployed, otherwise `false`
*/
@@ -401,6 +408,7 @@ async function isDefaultAppDeployed(appName: string): Promise<boolean> {
/**
* Import and publish the application
*
* @param appName application name
* @returns the app definition result
*/
@@ -423,6 +431,7 @@ async function importPublishApp(appName: string): Promise<AppDefinitionUpdateRes
/**
* Deploy application
*
* @param appDefinitionId app definition id
*/
async function deployApp(appDefinitionId: number) {
@@ -442,6 +451,7 @@ async function deployApp(appDefinitionId: number) {
/**
* Checks if Activiti app has license
*
* @param opts command options
* @returns `true` if license is valid, otherwise `false`
*/
@@ -472,6 +482,7 @@ async function hasLicense(opts: InitApsEnvArgs): Promise<boolean> {
/**
* Get default users from the realm
*
* @param opts command options
* @returns array of default APS users or null
*/
@@ -500,6 +511,7 @@ async function getDefaultApsUsersFromRealm(opts: InitApsEnvArgs) {
/**
* Validate that ACS repo for Activiti is present
*
* @param opts command options
* @param tenantId tenant id
* @param contentName content service name
@@ -527,6 +539,7 @@ async function isContentRepoPresent(opts: InitApsEnvArgs, tenantId: number, cont
/**
* Add content service with basic auth
*
* @param opts command options
* @param tenantId tenant id
* @param name content name
@@ -567,6 +580,7 @@ async function addContentRepoWithBasic(opts: InitApsEnvArgs, tenantId: number, n
/**
* Authorize activiti user to ACS repo
*
* @param opts command options
* @param user user object
*/
@@ -600,6 +614,7 @@ async function authorizeUserToContentRepo(opts: InitApsEnvArgs, user: any) {
/**
* Authorize user with content using basic auth
*
* @param opts command options
* @param username username
* @param contentId content id
@@ -629,6 +644,7 @@ async function authorizeUserToContentWithBasic(opts: InitApsEnvArgs, username: s
/**
* Download APS license file
*
* @param apsLicensePath path to license file
* @returns `true` if download succeeded, otherwise `false`
*/
@@ -649,6 +665,7 @@ async function downloadLicenseFile(apsLicensePath: string) {
/**
* Format an error for logging.
*
* @param error error object
* @returns formatted error string
*/
@@ -670,6 +687,7 @@ function formatError(error: any): string {
/**
* Async delay.
*
* @param ms milliseconds to wait
* @returns a promise that resolves after the delay
*/
+15 -2
View File
@@ -101,6 +101,12 @@ function getPackageFile(packagePath: string): PackageInfo {
}
}
/**
* Convert a license expression to linked Markdown.
*
* @param rawExpression raw SPDX license expression
* @returns expression with Markdown links
*/
function toLinkedLicenseExpression(rawExpression: string): string {
return rawExpression.replace(/\*/g, '').replace(/[a-zA-Z0-9\-.]+/g, (match: string) => {
const lowerMatch = match.toLowerCase();
@@ -112,6 +118,14 @@ function toLinkedLicenseExpression(rawExpression: string): string {
});
}
/**
* Render the license page as Markdown.
*
* @param filteredPackages packages with license metadata
* @param projName project name
* @param projVersion project version
* @returns rendered Markdown string
*/
function renderLicensePage(filteredPackages: Record<string, PackageInfoWithMetadata>, projName: string, projVersion: string): string {
const rows = Object.entries(filteredPackages).map(([packageName, pack]) => {
const lastAtSignPos = packageName.lastIndexOf('@');
@@ -192,7 +206,6 @@ Options:
}
return new Promise((resolve, reject) => {
// eslint-disable-next-line no-console
console.info(`Checking ${packagePath}`);
const licenseScan = collectProductionLicenses(packagePath, {
denyList: ['GPL'],
@@ -223,7 +236,7 @@ Options:
const outputFile = path.join(outputPath, `license-info-${packageJson.version}.md`);
fs.writeFileSync(outputFile, mdText);
// eslint-disable-next-line no-console
console.log(`Report saved as ${outputFile}`);
resolve(0);
});
-2
View File
@@ -17,7 +17,6 @@
import { exit } from 'node:process';
/* eslint-disable */
let log = null;
log = {
@@ -33,4 +32,3 @@ log = {
};
export let logger = log;
/* eslint-enable */
+6 -1
View File
@@ -25,7 +25,12 @@ export class CheckEnv {
_alfrescoJsApi: AlfrescoApi;
counter = 0;
constructor(private host: string, private username: string, private password: string, private clientId: string = 'alfresco') {}
constructor(
private readonly host: string,
private readonly username: string,
private readonly password: string,
private readonly clientId: string = 'alfresco'
) {}
async checkEnv() {
try {
@@ -21,7 +21,10 @@ import { AlfrescoApi } from '@alfresco/js-api';
export class GovernanceCheckPlugin {
governanceHealth: GovernanceHealth;
constructor(private pluginInfo: PluginInterface, private alfrescoJsApi: AlfrescoApi) {
constructor(
private readonly pluginInfo: PluginInterface,
private readonly alfrescoJsApi: AlfrescoApi
) {
this.governanceHealth = new GovernanceHealth(this.pluginInfo, this.alfrescoJsApi);
}
+4 -3
View File
@@ -15,14 +15,15 @@
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/naming-convention */
import { logger } from '../logger';
import { PluginInterface } from './plugin-model';
import { AlfrescoApi, GsSitesApi } from '@alfresco/js-api';
export class GovernanceHealth {
constructor(private pluginInfo: PluginInterface, private alfrescoJsApi: AlfrescoApi) {}
constructor(
private readonly pluginInfo: PluginInterface,
private readonly alfrescoJsApi: AlfrescoApi
) {}
async isRecordManagementAvailable(): Promise<boolean> {
try {
+4 -1
View File
@@ -20,7 +20,10 @@ import { logger } from '../logger';
import { AlfrescoApi } from '@alfresco/js-api';
export class PluginConfiguration {
constructor(private plugInInfo: PluginInterface, private alfrescoJsApi: AlfrescoApi) {}
constructor(
private readonly plugInInfo: PluginInterface,
private readonly alfrescoJsApi: AlfrescoApi
) {}
async getAppConfig(url: string) {
return this.callCustomApi(url);
@@ -15,8 +15,6 @@
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/naming-convention */
import { PluginInterface } from './plugin-model';
import { logger } from '../logger';
import { ProcessAutomationHealth } from './process-automation-health';
@@ -26,7 +24,10 @@ import { exit } from 'node:process';
export class ProcessAutomationCheckPlugin {
processAutomationHealth: ProcessAutomationHealth;
constructor(private plugInInfo: PluginInterface, private alfrescoJsApi: AlfrescoApi) {
constructor(
private readonly plugInInfo: PluginInterface,
private readonly alfrescoJsApi: AlfrescoApi
) {
this.processAutomationHealth = new ProcessAutomationHealth(this.plugInInfo, this.alfrescoJsApi);
}
@@ -23,7 +23,10 @@ import { AlfrescoApi } from '@alfresco/js-api';
export class ProcessAutomationHealth {
config: PluginConfiguration;
constructor(private plugInInfo: PluginInterface, private alfrescoJsApi: AlfrescoApi) {
constructor(
private readonly plugInInfo: PluginInterface,
private readonly alfrescoJsApi: AlfrescoApi
) {
this.config = new PluginConfiguration(this.plugInInfo, this.alfrescoJsApi);
}
@@ -15,8 +15,6 @@
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/naming-convention */
import { exit } from 'node:process';
import { PluginInterface } from './plugin-model';
import { logger } from '../logger';
@@ -26,7 +24,10 @@ import { AlfrescoApi } from '@alfresco/js-api';
export class ProcessServiceCheckPlugin {
processServiceHealth: ProcessServiceHealth;
constructor(private plugInInfo: PluginInterface, private alfrescoJsApi: AlfrescoApi) {
constructor(
private readonly plugInInfo: PluginInterface,
private readonly alfrescoJsApi: AlfrescoApi
) {
this.processServiceHealth = new ProcessServiceHealth(this.plugInInfo, this.alfrescoJsApi);
}
@@ -23,7 +23,10 @@ import { AlfrescoApi, SystemPropertiesApi } from '@alfresco/js-api';
export class ProcessServiceHealth {
config: PluginConfiguration;
constructor(private plugInInfo: PluginInterface, private alfrescoJsApi: AlfrescoApi) {
constructor(
private readonly plugInInfo: PluginInterface,
private readonly alfrescoJsApi: AlfrescoApi
) {
this.config = new PluginConfiguration(this.plugInInfo, this.alfrescoJsApi);
}
-1
View File
@@ -16,7 +16,6 @@
*/
/* cSpell:disable */
/* eslint-disable @typescript-eslint/naming-convention */
export const ACTIVITI_CLOUD_APPS: any = {
SIMPLE_APP: {
+6
View File
@@ -15,6 +15,12 @@
* limitations under the License.
*/
/**
* Escape HTML special characters.
*
* @param text input string
* @returns escaped string
*/
export function escapeHtml(text: string): string {
return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
}