mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Improved ESLint configuration, integrated spellcheck and error fixes (#8931)
* integrate cspell with eslint, improved configuration * core: fix linting errors * core: fix lint warnings * content: lint fixes * process service lint fixes * lint: process services cloud * lint: insights * lint: extensions * [ci:force] lint: cli fixes * [ci:force] comment out dead code * [ci:force] exclude dead code * fix code and tests * rollback some changes * fix testing lib * fix demo shell * minor lint warning fixes * minor lint fixes * fix process services
This commit is contained in:
@@ -15,9 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApi, NodesApi, UploadApi } from '@alfresco/js-api';
|
||||
import { AlfrescoApi /*, NodesApi, UploadApi*/ } from '@alfresco/js-api';
|
||||
import { argv, exit } from 'node:process';
|
||||
import { Buffer } from 'node:buffer';
|
||||
// import { Buffer } from 'node:buffer';
|
||||
const program = require('commander');
|
||||
import { logger } from './logger';
|
||||
const MAX_RETRY = 3;
|
||||
@@ -71,7 +71,8 @@ async function checkEnv() {
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// TODO: https://alfresco.atlassian.net/browse/ACS-5873
|
||||
/*
|
||||
async function checkDiskSpaceFullEnv() {
|
||||
logger.info(`Start Check disk full space`);
|
||||
|
||||
@@ -108,6 +109,7 @@ async function checkDiskSpaceFullEnv() {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
function sleep(delay: number) {
|
||||
const start = new Date().getTime();
|
||||
|
@@ -497,7 +497,7 @@ async function checkDescriptorExist(name: string): Promise<boolean> {
|
||||
logger.info(`Check descriptor ${name} exist in the list `);
|
||||
const descriptorList = await getDescriptors();
|
||||
|
||||
if (descriptorList && descriptorList.list && descriptorList.entries) {
|
||||
if (descriptorList?.list && descriptorList.entries) {
|
||||
for (const descriptor of descriptorList.list.entries) {
|
||||
if (descriptor.entry.name === name) {
|
||||
if (descriptor.entry.deployed === false) {
|
||||
|
@@ -56,24 +56,29 @@ async function initializeDefaultFiles() {
|
||||
for (let j = 0; j < ACS_DEFAULT.files.length; j++) {
|
||||
const fileInfo = ACS_DEFAULT.files[j];
|
||||
switch (fileInfo.action) {
|
||||
case 'UPLOAD':
|
||||
case 'UPLOAD': {
|
||||
await uploadFile(fileInfo.name, parentFolderId);
|
||||
break;
|
||||
case 'LOCK':
|
||||
}
|
||||
case 'LOCK': {
|
||||
const fileToLock = await uploadFile(fileInfo.name, parentFolderId);
|
||||
await lockFile(fileToLock.entry.id);
|
||||
break;
|
||||
case 'SHARE':
|
||||
}
|
||||
case 'SHARE': {
|
||||
const fileToShare = await uploadFile(fileInfo.name, parentFolderId);
|
||||
await shareFile(fileToShare.entry.id);
|
||||
break;
|
||||
case 'FAVORITE':
|
||||
}
|
||||
case 'FAVORITE': {
|
||||
const fileToFav = await uploadFile(fileInfo.name, parentFolderId);
|
||||
await favoriteFile(fileToFav.entry.id);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
default: {
|
||||
logger.error('No action found for file ', fileInfo.name, parentFolderId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -117,8 +117,8 @@ async function main() {
|
||||
async function initializeDefaultApps() {
|
||||
for (let x = 0; x < ACTIVITI_APPS.apps.length; x++) {
|
||||
const appInfo = ACTIVITI_APPS.apps[x];
|
||||
const isDefaultAppDepl = await isDefaultAppDeployed(appInfo.name);
|
||||
if (isDefaultAppDepl !== undefined && !isDefaultAppDepl) {
|
||||
const isDeployed = await isDefaultAppDeployed(appInfo.name);
|
||||
if (isDeployed !== undefined && !isDeployed) {
|
||||
const appDefinition = await importPublishApp(`${appInfo.name}`);
|
||||
await deployApp(appDefinition.appDefinition.id);
|
||||
} else {
|
||||
@@ -248,7 +248,7 @@ async function isDefaultAppDeployed(appName: string) {
|
||||
try {
|
||||
const runtimeAppDefinitionsApi = new RuntimeAppDefinitionsApi(alfrescoJsApi);
|
||||
const availableApps = await runtimeAppDefinitionsApi.getAppDefinitions();
|
||||
const defaultApp = availableApps.data && availableApps.data.filter(app => app.name && app.name.includes(appName));
|
||||
const defaultApp = availableApps.data?.filter(app => app.name?.includes(appName));
|
||||
return defaultApp && defaultApp.length > 0;
|
||||
} catch (error) {
|
||||
logger.error(`Aps app failed to import/Publish!`);
|
||||
@@ -262,8 +262,8 @@ async function importPublishApp(appName: string) {
|
||||
const fileContent = createReadStream(pathFile);
|
||||
|
||||
try {
|
||||
const appdefinitionsApi = new AppDefinitionsApi(alfrescoJsApi);
|
||||
const result = await appdefinitionsApi.importAndPublishApp(fileContent, {renewIdmEntries: true});
|
||||
const appDefinitionsApi = new AppDefinitionsApi(alfrescoJsApi);
|
||||
const result = await appDefinitionsApi.importAndPublishApp(fileContent, {renewIdmEntries: true});
|
||||
logger.info(`Aps app imported and published!`);
|
||||
return result;
|
||||
} catch (error) {
|
||||
@@ -398,7 +398,7 @@ async function authorizeUserToContentRepo(user: any) {
|
||||
['application/json'],
|
||||
['application/json']
|
||||
);
|
||||
logger.info(`Found ${content.data && content.data.length} contents`);
|
||||
logger.info(`Found ${content.data?.length} contents`);
|
||||
if (content.data) {
|
||||
for (let i = 0; i < content.data.length; i++) {
|
||||
if (content.data[i].authenticationType === 'basic') {
|
||||
|
@@ -63,6 +63,7 @@ export const deletePod = (args: KubeArgs) => {
|
||||
export const getNamespaces = (): string[] => {
|
||||
logger.info('Perform get namespaces name...');
|
||||
const result = exec('kubectl', [`get`, `namespaces`, `-l`, `type=application`, `-o`, `name`], {});
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
const namespaces = result.replace(/namespace[\/]+/g, '').split(/\r?\n/);
|
||||
logger.info(`namespaces found: ${namespaces}`);
|
||||
return namespaces;
|
||||
|
@@ -51,12 +51,12 @@ const missingRepositories = {
|
||||
function licenseWithMDLinks(licenseExp: string): string {
|
||||
let licenseUrl = '';
|
||||
|
||||
if (licenseList[licenseExp] && licenseList[licenseExp]['url']) {
|
||||
if (licenseList[licenseExp]?.['url']) {
|
||||
licenseUrl = licenseList[licenseExp]['url'];
|
||||
} else {
|
||||
const substituteLicString = nonStandardLicenses[licenseExp.toLowerCase()];
|
||||
|
||||
if (licenseList[substituteLicString] && licenseList[substituteLicString]['url']) {
|
||||
if (licenseList[substituteLicString]?.['url']) {
|
||||
licenseUrl = licenseList[substituteLicString]['url'];
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ export default function main(_args: string[], workingDir: string) {
|
||||
const pack = packages[packageName];
|
||||
pack['licenseExp'] = pack['licenses'].toString()
|
||||
.replace(/\*/, '')
|
||||
.replace(/[a-zA-Z0-9\-\.]+/g, (match: string) => {
|
||||
.replace(/[a-zA-Z0-9\-.]+/g, (match: string) => {
|
||||
const lowerMatch = match.toLowerCase();
|
||||
|
||||
if ((lowerMatch !== 'and') && (lowerMatch !== 'or') && (lowerMatch !== 'with')) {
|
||||
|
@@ -32,7 +32,7 @@ export class ProcessAutomationHealth {
|
||||
const url = `${this.plugInInfo.host}/${this.plugInInfo.appName}/ui/${this.plugInInfo.uiName}/app.config.json`;
|
||||
const appConfig = await this.config.getAppConfig(url);
|
||||
let isEnabled = true;
|
||||
if (appConfig && appConfig.plugins && appConfig.plugins[this.plugInInfo.name]) {
|
||||
if (appConfig?.plugins?.[this.plugInInfo.name]) {
|
||||
logger.info(`The plugin ${this.plugInInfo.name} has been correctly configured in app.config.json`);
|
||||
} else {
|
||||
this.logConfigurationError();
|
||||
|
@@ -32,7 +32,7 @@ export class ProcessServiceHealth {
|
||||
const url = `${this.plugInInfo.host}/app.config.json`;
|
||||
const appConfig = await this.config.getAppConfig(url);
|
||||
let isEnabled = true;
|
||||
if (appConfig && appConfig.plugins && appConfig.plugins[this.plugInInfo.name]) {
|
||||
if (appConfig?.plugins?.[this.plugInInfo.name]) {
|
||||
logger.info(`The plugin ${this.plugInInfo.name} has been correctly configured in app.config.json`);
|
||||
} else {
|
||||
this.logConfigurationError();
|
||||
|
@@ -38,6 +38,7 @@ function getSha(args: CommitArgs): string {
|
||||
function replacePerform(args: CommitArgs, sha: string) {
|
||||
logger.info(`Replace commit ${sha} in package...`);
|
||||
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
const sedRule = `s/\"commit\": \".*\"/\"commit\": \"${sha}\"/g`;
|
||||
|
||||
if (args.skipGnu) {
|
||||
|
Reference in New Issue
Block a user