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
-14
View File
@@ -1,14 +0,0 @@
.angular
nxcache
node_modules
dist
coverage
.github
.vscode
scripts
/angular.json
docs/**/*.md
lib/js-api/docs/**/*.md
.storybook
webpack.config.js
lib/core/src/lib/icon
-248
View File
@@ -1,248 +0,0 @@
module.exports = {
root: true,
ignorePatterns: ['projects/**/*', '**/node_modules/**/*', 'lib/cli/node_modules/**/*', '**/node_modules', '**/assets', '**/scripts', '**/docs'],
plugins: ['@nx'],
overrides: [
{
files: ['*.ts'],
parserOptions: {
project: ['tsconfig.json'],
createDefaultProgram: true
},
extends: [
'plugin:@nx/typescript',
'plugin:@nx/angular',
'plugin:@cspell/recommended',
'plugin:@angular-eslint/recommended',
'plugin:@angular-eslint/template/process-inline-templates',
'plugin:jsdoc/recommended-typescript-error'
// Uncomment this once all linting issues are fixed
// Note to developers:
// you can uncomment the full ruleset locally when fixing issues, and then comment
// that will allow splitting the work into smaller chunks
// 'plugin:unicorn/recommended'
],
plugins: [
'eslint-plugin-unicorn',
'eslint-plugin-rxjs',
'prettier',
'ban',
'license-header',
'@cspell',
'eslint-plugin-import',
'@angular-eslint/eslint-plugin',
'@typescript-eslint',
'jsdoc'
],
rules: {
// Uncomment this to enable prettier checks as part of the ESLint
// 'prettier/prettier': 'error',
'ban/ban': [
'error',
{ name: 'eval', message: 'Calls to eval is not allowed.' },
{ name: 'fdescribe', message: 'Calls to fdescribe is not allowed' },
{ name: 'fit', message: 'Calls to fit is not allowed' },
{ name: 'xit', message: 'Calls to xit is not allowed' },
{ name: 'xdescribe', message: 'Calls to xdescribe is not allowed' },
{ name: ['test', 'only'], message: 'Calls to test.only is not allowed' },
{ name: ['describe', 'only'], message: 'Calls to describe.only is not allowed' }
],
'@angular-eslint/component-selector': [
'error',
{
type: 'element',
prefix: ['adf', 'app'],
style: 'kebab-case'
}
],
'@angular-eslint/directive-selector': [
'error',
{
type: ['element', 'attribute'],
prefix: ['adf', 'app'],
style: 'kebab-case'
}
],
'@angular-eslint/no-host-metadata-property': 'off',
'@angular-eslint/no-input-prefix': 'error',
'@angular-eslint/prefer-inject': 'error',
'@typescript-eslint/consistent-type-definitions': 'error',
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/explicit-member-accessibility': [
'off',
{
accessibility: 'explicit'
}
],
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/prefer-optional-chain': 'warn',
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/naming-convention': [
'error',
{
selector: [
'classProperty',
'objectLiteralProperty',
'typeProperty',
'classMethod',
'objectLiteralMethod',
'typeMethod',
'accessor',
'enumMember'
],
format: null,
modifiers: ['requiresQuotes']
}
],
'@typescript-eslint/member-ordering': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'prefer-promise-reject-errors': 'error',
'brace-style': 'off',
'comma-dangle': 'error',
'default-case': 'error',
'import/order': 'off',
'max-len': [
'error',
{
code: 240
}
],
'no-bitwise': 'off',
'no-console': [
'error',
{
allow: [
'warn',
'dir',
'timeLog',
'assert',
'clear',
'count',
'countReset',
'group',
'groupEnd',
'table',
'dirxml',
'error',
'groupCollapsed',
'Console',
'profile',
'profileEnd',
'timeStamp',
'context'
]
}
],
'no-duplicate-imports': 'error',
'no-multiple-empty-lines': 'error',
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': ['off', { ignoreDeclarationMerge: true }],
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}
],
'no-return-await': 'error',
'rxjs/no-create': 'error',
'rxjs/no-subject-unsubscribe': 'error',
'rxjs/no-subject-value': 'error',
'rxjs/no-unsafe-takeuntil': 'error',
'unicorn/filename-case': 'error',
'unicorn/prefer-optional-catch-binding': 'error',
'@typescript-eslint/no-unused-expressions': [
'error',
{
allowShortCircuit: true,
allowTernary: true
}
],
'license-header/header': [
'error',
[
'/*!',
' * @license',
' * Copyright © 2005-2026 Hyland Software, Inc. and its affiliates. All rights reserved.',
' *',
' * Licensed under the Apache License, Version 2.0 (the "License");',
' * you may not use this file except in compliance with the License.',
' * You may obtain a copy of the License at',
' *',
' * http://www.apache.org/licenses/LICENSE-2.0',
' *',
' * Unless required by applicable law or agreed to in writing, software',
' * distributed under the License is distributed on an "AS IS" BASIS,',
' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',
' * See the License for the specific language governing permissions and',
' * limitations under the License.',
' */'
]
],
'no-restricted-syntax': [
'error',
{
selector: "Identifier[name='CUSTOM_ELEMENTS_SCHEMA']",
message: 'The use of CUSTOM_ELEMENTS_SCHEMA is not allowed. Consider alternatives for proper schema handling.'
},
{
selector: "Identifier[name='NO_ERRORS_SCHEMA']",
message: 'The use of NO_ERRORS_SCHEMA is not allowed. Consider alternatives for proper schema handling.'
},
{
selector: 'TSEnumDeclaration',
message: 'Enums are not allowed. Use string literal types (e.g., type Foo = "a" | "b") or const objects instead.'
},
{
selector: ':matches(Literal[value=/ng-reflect-/], TemplateElement[value.cooked=/ng-reflect-/])',
message: '*ng-reflect-* attributes should not be used. Consider alternatives for proper selectors.'
}
]
}
},
{
files: ['*.html'],
extends: ['plugin:@angular-eslint/template/recommended', 'plugin:@angular-eslint/template/accessibility'],
parser: '@angular-eslint/template-parser',
rules: {
'@angular-eslint/template/prefer-self-closing-tags': 'error'
}
},
{
files: ['*.spec.ts'],
plugins: ['@alfresco/eslint-angular'],
rules: {
'@alfresco/eslint-angular/no-angular-material-selectors': 'error',
'@angular-eslint/component-class-suffix': 'off'
}
},
{
files: ['*.ts'],
extends: ['plugin:@angular-eslint/template/process-inline-templates'],
excludedFiles: ['*.spec.ts']
},
{
files: ['*.json'],
parser: 'jsonc-eslint-parser',
rules: {
'comma-dangle': ['error', 'never']
}
},
{
files: ['**/*.stories.ts'],
rules: {
'@cspell/spellchecker': 'off'
}
}
],
extends: ['plugin:storybook/recommended']
};
-3
View File
@@ -1,3 +0,0 @@
{
"extends": ["./.eslintrc.js"]
}
+1 -1
View File
@@ -1,4 +1,4 @@
{ {
"*.{ts,js}": ["prettier --write", "eslint"], "*.{ts,js}": ["prettier --write", "eslint --flag v10_config_lookup_from_file"],
"*.{css,scss}": ["prettier --write", "stylelint --fix"] "*.{css,scss}": ["prettier --write", "stylelint --fix"]
} }
+357
View File
@@ -0,0 +1,357 @@
/*!
* @license
* Copyright © 2005-2026 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import { fixupPluginRules } from '@eslint/compat';
import unicorn from 'eslint-plugin-unicorn';
import rxjs from 'eslint-plugin-rxjs';
import prettier from 'eslint-plugin-prettier';
import ban from 'eslint-plugin-ban';
import licenseHeader from 'eslint-plugin-license-header';
import cspell from '@cspell/eslint-plugin';
import importPlugin from 'eslint-plugin-import';
import storybook from 'eslint-plugin-storybook';
import nxPlugin from '@nx/eslint-plugin';
import angularEslintEslintPlugin from '@angular-eslint/eslint-plugin';
import angularTemplateParser from '@angular-eslint/template-parser';
import tsParser from '@typescript-eslint/parser';
import jsonParser from 'jsonc-eslint-parser';
import alfrescoEslintAngular from './lib/eslint-angular/main.js';
import jsdoc from 'eslint-plugin-jsdoc';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [
{
ignores: [
'.angular',
'.DS_Store',
'.github',
'.history',
'.husky',
'.nx',
'.vscode',
'coverage',
'dist',
'**/docs',
'nxcache',
'tmp',
'projects/**/*',
'**/node_modules/**/*',
'lib/cli/node_modules/**/*',
'lib/core/src/lib/icon',
'**/node_modules',
'**/assets',
'/scripts'
]
},
// You can uncomment unicorn.configs['recommended'], fix a few issues, and comment it out again until all issues are resolved.
// Expect significant effort to fix all reported issues.
// Note to developers: when enabling unicorn.configs['recommended'], remove unicorn from plugins to avoid plugin redefinition errors.
// unicorn.configs['recommended'],
...storybook.configs['flat/recommended'],
{
files: ['**/*.{js,mjs,cjs,ts}'],
ignores: ['**/*.d.ts'],
plugins: {
'license-header': licenseHeader
},
rules: {
'license-header/header': [
'error',
[
'/*!',
' * @license',
' * Copyright © 2005-2026 Hyland Software, Inc. and its affiliates. All rights reserved.',
' *',
' * Licensed under the Apache License, Version 2.0 (the "License");',
' * you may not use this file except in compliance with the License.',
' * You may obtain a copy of the License at',
' *',
' * http://www.apache.org/licenses/LICENSE-2.0',
' *',
' * Unless required by applicable law or agreed to in writing, software',
' * distributed under the License is distributed on an "AS IS" BASIS,',
' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',
' * See the License for the specific language governing permissions and',
' * limitations under the License.',
' */'
]
]
}
},
{
files: ['**/*.ts', '**/*.js', '**/*.mjs'],
ignores: ['**/*.d.ts', '**/*.spec.ts'],
...jsdoc.configs['flat/recommended-typescript-error']
},
{
files: ['**/*.ts'],
ignores: ['**/*.d.ts', '**/*.mjs'],
...compat.extends(
'plugin:@nx/typescript',
'plugin:@nx/angular',
'plugin:@cspell/recommended',
'plugin:@angular-eslint/recommended',
'plugin:@angular-eslint/template/process-inline-templates'
)[0],
plugins: {
'@nx': nxPlugin,
jsdoc,
unicorn,
rxjs: fixupPluginRules(rxjs),
prettier: prettier,
ban: ban,
'@cspell': cspell,
import: importPlugin,
'@angular-eslint': angularEslintEslintPlugin,
'@typescript-eslint': typescriptEslint
},
languageOptions: {
parser: tsParser,
parserOptions: {
projectService: true,
allowDefaultProject: true,
tsconfigRootDir: __dirname,
sourceType: 'module'
}
},
rules: {
// Uncomment this to enable prettier checks as part of the ESLint
// Note to developers:
// you can uncomment the full ruleset locally when fixing issues, and then comment
// that will allow splitting the work into smaller chunks
// 'prettier/prettier': 'error',
'ban/ban': [
'error',
{ name: 'eval', message: 'Calls to eval is not allowed.' },
{ name: 'fdescribe', message: 'Calls to fdescribe is not allowed' },
{ name: 'fit', message: 'Calls to fit is not allowed' },
{ name: 'xit', message: 'Calls to xit is not allowed' },
{ name: 'xdescribe', message: 'Calls to xdescribe is not allowed' },
{ name: ['test', 'only'], message: 'Calls to test.only is not allowed' },
{ name: ['describe', 'only'], message: 'Calls to describe.only is not allowed' }
],
'@angular-eslint/component-selector': [
'error',
{
type: 'element',
prefix: ['adf', 'app'],
style: 'kebab-case'
}
],
'@angular-eslint/directive-selector': [
'error',
{
type: ['element', 'attribute'],
prefix: ['adf', 'app'],
style: 'kebab-case'
}
],
'@angular-eslint/no-host-metadata-property': 'off',
'@angular-eslint/no-input-prefix': 'error',
'@angular-eslint/prefer-inject': 'error',
'@typescript-eslint/consistent-type-definitions': 'error',
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/explicit-member-accessibility': [
'off',
{
accessibility: 'explicit'
}
],
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/prefer-optional-chain': 'warn',
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-var-requires': 'error',
'jsdoc/tag-lines': [
'error',
'any',
{
startLines: 1
}
],
'@typescript-eslint/naming-convention': [
'error',
{
selector: [
'classProperty',
'objectLiteralProperty',
'typeProperty',
'classMethod',
'objectLiteralMethod',
'typeMethod',
'accessor',
'enumMember'
],
format: null,
modifiers: ['requiresQuotes']
}
],
'@typescript-eslint/member-ordering': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'prefer-promise-reject-errors': 'error',
'brace-style': 'off',
'comma-dangle': 'error',
'default-case': 'error',
'import/order': 'off',
'max-len': [
'error',
{
code: 240
}
],
'no-bitwise': 'off',
'no-console': [
'error',
{
allow: [
'warn',
'dir',
'timeLog',
'assert',
'clear',
'count',
'countReset',
'group',
'groupEnd',
'table',
'dirxml',
'error',
'groupCollapsed',
'Console',
'profile',
'profileEnd',
'timeStamp',
'context'
]
}
],
'no-duplicate-imports': 'error',
'no-multiple-empty-lines': 'error',
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': ['off', { ignoreDeclarationMerge: true }],
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}
],
'no-return-await': 'error',
'rxjs/no-create': 'error',
'rxjs/no-subject-unsubscribe': 'error',
'rxjs/no-subject-value': 'error',
'rxjs/no-unsafe-takeuntil': 'error',
'unicorn/filename-case': 'error',
'unicorn/prefer-optional-catch-binding': 'error',
'@typescript-eslint/no-unused-expressions': [
'error',
{
allowShortCircuit: true,
allowTernary: true
}
],
'no-restricted-syntax': [
'error',
{
selector: "Identifier[name='CUSTOM_ELEMENTS_SCHEMA']",
message: 'The use of CUSTOM_ELEMENTS_SCHEMA is not allowed. Consider alternatives for proper schema handling.'
},
{
selector: "Identifier[name='NO_ERRORS_SCHEMA']",
message: 'The use of NO_ERRORS_SCHEMA is not allowed. Consider alternatives for proper schema handling.'
},
{
selector: 'TSEnumDeclaration',
message: 'Enums are not allowed. Use string literal types (e.g., type Foo = "a" | "b") or const objects instead.'
},
{
selector: ':matches(Literal[value=/ng-reflect-/], TemplateElement[value.cooked=/ng-reflect-/])',
message: '*ng-reflect-* attributes should not be used. Consider alternatives for proper selectors.'
}
]
}
},
{
files: ['**/*.html'],
...compat.extends(
'plugin:@angular-eslint/template/recommended',
'plugin:@angular-eslint/template/accessibility',
'plugin:@nx/angular-template'
)[0],
languageOptions: {
parser: angularTemplateParser
},
rules: {
'@angular-eslint/template/prefer-self-closing-tags': 'error'
}
},
{
files: ['**/*.spec.ts'],
plugins: {
'@alfresco/eslint-angular': alfrescoEslintAngular
},
rules: {
'@alfresco/eslint-angular/no-angular-material-selectors': 'error',
'@angular-eslint/component-class-suffix': 'off'
}
},
{
files: ['**/*.json'],
languageOptions: {
parser: jsonParser
},
rules: {
'comma-dangle': ['error', 'never']
}
},
{
files: ['**/*.stories.ts'],
rules: {
'@cspell/spellchecker': 'off'
}
},
{
files: ['**/*.mjs'],
rules: {
'unicorn/no-null': 'off'
},
languageOptions: {
parser: tsParser,
parserOptions: {
tsconfigRootDir: __dirname,
ecmaVersion: 'latest',
sourceType: 'module'
}
}
}
];
-50
View File
@@ -1,50 +0,0 @@
{
"extends": ["../../.eslintrc.js"],
"ignorePatterns": ["!**/*", "dist", "node_modules"],
"overrides": [
{
"files": ["*.ts"],
"extends": ["plugin:@nx/angular"],
"parserOptions": {
"project": ["lib/cli/tsconfig.json"],
"createDefaultProgram": true
},
"rules": {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/naming-convention": "warn",
"quote-props": "off",
"no-shadow": "warn",
"no-restricted-syntax": "off",
"no-underscore-dangle": "off",
"@typescript-eslint/consistent-type-assertions": "warn",
"@typescript-eslint/prefer-for-of": "off",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-require-imports": "off",
"default-case": "error",
"import/order": "off",
"max-len": [
"error",
{
"code": 240
}
],
"no-duplicate-imports": "error",
"no-multiple-empty-lines": "error",
"no-redeclare": "error",
"no-return-await": "error",
"no-console": "off"
}
},
{
"files": ["*.html"],
"parserOptions": {
"project": ["lib/cli/tsconfig.json"],
"createDefaultProgram": true
},
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
}
+49
View File
@@ -0,0 +1,49 @@
/*!
* @license
* Copyright © 2005-2026 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import rootConfig from '../../eslint.config.mjs';
export default [
...rootConfig,
{
files: ['**/*.ts'],
rules: {
'@nx/enforce-module-boundaries': [
'error',
{
enforceBuildableLibDependency: true,
allow: [],
depConstraints: [
{
sourceTag: 'scope:cli',
onlyDependOnLibsWithTags: ['scope:js-api']
}
]
}
],
'@typescript-eslint/no-var-requires': 'off',
'quote-props': 'off',
'no-shadow': 'warn',
'no-restricted-syntax': 'off',
'no-underscore-dangle': 'off',
'@typescript-eslint/consistent-type-assertions': 'warn',
'@typescript-eslint/prefer-for-of': 'off',
'no-redeclare': 'error',
'no-console': 'off',
}
}
];
+1
View File
@@ -4,6 +4,7 @@
"sourceRoot": "lib/cli", "sourceRoot": "lib/cli",
"projectType": "library", "projectType": "library",
"prefix": "adf", "prefix": "adf",
"tags": ["scope:cli", "type:tooling"],
"targets": { "targets": {
"build": { "build": {
"executor": "nx:run-commands", "executor": "nx:run-commands",
+8 -2
View File
@@ -29,6 +29,14 @@ interface AuditCommandArgs {
outDir?: string; 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 { function renderAuditPage(jsonAudit: any, projName: string, projVersion: string): string {
const rows: string[] = []; const rows: string[] = [];
if (jsonAudit.auditReportVersion >= 2) { if (jsonAudit.auditReportVersion >= 2) {
@@ -122,7 +130,6 @@ Options:
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// eslint-disable-next-line no-console
console.log(`Running audit on ${packagePath}`); console.log(`Running audit on ${packagePath}`);
const packageJson = JSON.parse(fs.readFileSync(packagePath).toString()); const packageJson = JSON.parse(fs.readFileSync(packagePath).toString());
@@ -172,7 +179,6 @@ Options:
fs.writeFileSync(outputFile, mdText); fs.writeFileSync(outputFile, mdText);
// eslint-disable-next-line no-console
console.log(`Report saved as ${outputFile}`); console.log(`Report saved as ${outputFile}`);
resolve(0); resolve(0);
}); });
+19 -3
View File
@@ -17,8 +17,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @typescript-eslint/naming-convention */
import { argv, exit } from 'node:process'; import { argv, exit } from 'node:process';
import { parseArgs } from 'node:util'; import { parseArgs } from 'node:util';
import { spawnSync } from 'node:child_process'; import { spawnSync } from 'node:child_process';
@@ -146,7 +144,7 @@ function getCommits(options: DiffOptions): Array<Commit> {
.map((str: string) => { .map((str: string) => {
try { try {
return JSON.parse(str) as Commit; return JSON.parse(str) as Commit;
} catch (error) { } catch {
logger.error(`Unparsable commit message: ${str}, dropping it... Please apply manual fix.`); logger.error(`Unparsable commit message: ${str}, dropping it... Please apply manual fix.`);
return null; return null;
} }
@@ -167,6 +165,15 @@ function commitAuthorAllowed(commit: Commit, authorFilter: string): boolean {
return !(filterRegex.test(commit.author) || filterRegex.test(commit.author_email)); 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 { 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)}`); const lines = commits.map((c) => `- [${c.hash}](${repoUrl}/commit/${c.hash}) ${escapeHtml(c.subject)}`);
return `--- 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 { function renderChangelogHtml(commits: Commit[], projName: string, projVersion: string, repoUrl: string): string {
const items = commits const items = commits
.map((c) => ` <li>\n <a href="${repoUrl}/commit/${c.hash}">[${c.hash}]</a> ${escapeHtml(c.subject)}\n </li>`) .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[] } }> { async function getApplications(): Promise<{ list: { entries: any[] } }> {
const url = `${args.host}/deployment-service/v1/applications`; const url = `${args.host}/deployment-service/v1/applications`;
@@ -236,9 +237,10 @@ function getProjectRelease(projectId: string) {
} }
/** /**
* Release project * Release project.
* *
* @param projectId project id * @param projectId project id
* @returns release response
*/ */
async function releaseProject(projectId: string) { async function releaseProject(projectId: string) {
const url = `${args.host}/modeling-service/v1/projects/${projectId}/releases`; 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 * @param absoluteFilePath path to project file
* @returns released project
*/ */
async function importAndReleaseProject(absoluteFilePath: string) { async function importAndReleaseProject(absoluteFilePath: string) {
const fileContent = fs.createReadStream(absoluteFilePath); 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 * @param name descriptor name
* @returns `true` if descriptor exists
*/ */
async function checkDescriptorExist(name: string): Promise<boolean> { async function checkDescriptorExist(name: string): Promise<boolean> {
logger.info(`Check descriptor ${name} exist in the list `); 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 app application
* @param tag tag * @param tag tag
* @returns released project
*/ */
async function importProjectAndRelease(app: any, tag?: string) { async function importProjectAndRelease(app: any, tag?: string) {
const appLocationReplaced = app.file_location(tag); 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 url url to file
* @param name name * @param name name
* @returns resolves when the file is downloaded
*/ */
async function getFileFromRemote(url: string, name: string): Promise<void> { async function getFileFromRemote(url: string, name: string): Promise<void> {
return fetch(url) 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). * Process a single file: upload if missing, then apply its action (lock/share/favorite).
*
* @param fileInfo file descriptor from ACS_DEFAULT * @param fileInfo file descriptor from ACS_DEFAULT
* @param fileInfo.name file name * @param fileInfo.name file name
* @param fileInfo.action action to apply (LOCK, SHARE, FAVORITE) * @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. * Ensure a folder exists under the given parent. Creates it if missing.
* Handles 409 conflict (race condition) by fetching the existing folder. * Handles 409 conflict (race condition) by fetching the existing folder.
*
* @param folderName folder name * @param folderName folder name
* @param parentId parent node id * @param parentId parent node id
* @returns the folder node entry * @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). * Find a node by relative path under a parent. Returns null if not found (404).
*
* @param parentId parent node id * @param parentId parent node id
* @param fileName relative path / file name * @param fileName relative path / file name
* @returns the node entry or null if not found * @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. * Upload a file to the given destination folder.
*
* @param fileName file name * @param fileName file name
* @param destinationId destination folder node id * @param destinationId destination folder node id
* @returns the uploaded node entry * @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. * Ensure a file is locked. Skips if already locked.
*
* @param nodeId node id * @param nodeId node id
* @param fileName file name (for logging) * @param fileName file name (for logging)
* @param isAlreadyLocked whether the node is already locked * @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. * Ensure a file is shared. Handles 409 (already shared) gracefully.
*
* @param nodeId node id * @param nodeId node id
* @param fileName file name (for logging) * @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. * Ensure a file is favorite. Handles 409 (already favorite) gracefully.
*
* @param nodeId node id * @param nodeId node id
* @param fileName file name (for logging) * @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. * Extract entry id from a node response. Throws if missing.
*
* @param nodeEntry node entry response * @param nodeEntry node entry response
* @param label label for error message * @param label label for error message
* @returns the node id * @returns the node id
@@ -318,6 +326,7 @@ function getEntryId(nodeEntry: NodeEntry, label: string): string {
/** /**
* Format an error for logging. * Format an error for logging.
*
* @param error error object * @param error error object
* @returns formatted error string * @returns formatted error string
*/ */
@@ -339,6 +348,7 @@ function formatError(error: any): string {
/** /**
* Retry wrapper for transient failures. * Retry wrapper for transient failures.
*
* @param fn async function to execute * @param fn async function to execute
* @param label label for logging * @param label label for logging
* @param maxAttempts maximum retry attempts * @param maxAttempts maximum retry attempts
@@ -364,6 +374,7 @@ async function withRetry<T>(fn: () => Promise<T>, label: string, maxAttempts = 3
/** /**
* Async delay. * Async delay.
*
* @param ms milliseconds to wait * @param ms milliseconds to wait
* @returns a promise that resolves after the delay * @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. * Check environment state and authenticate. Retries on transient failures.
*
* @param opts command options * @param opts command options
* @param attempt current attempt number * @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 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. * 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 false only if hruser cannot log in or deployment fails.
*
* @returns `true` if app is deployed, otherwise `false` * @returns `true` if app is deployed, otherwise `false`
*/ */
async function ensureE2eApplicationDeployed(): Promise<boolean> { async function ensureE2eApplicationDeployed(): Promise<boolean> {
@@ -236,6 +237,7 @@ async function initializeDefaultApps() {
/** /**
* Check environment state and authenticate. Retries on transient failures. * Check environment state and authenticate. Retries on transient failures.
*
* @param opts command options * @param opts command options
* @param attempt current attempt number * @param attempt current attempt number
*/ */
@@ -277,6 +279,7 @@ async function checkEnv(opts: InitApsEnvArgs, attempt = 1) {
/** /**
* Check if the default tenant is present * Check if the default tenant is present
*
* @param tenantId tenant id * @param tenantId tenant id
* @param tenantName tenant name * @param tenantName tenant name
* @returns `true` if tenant is found, otherwise `false` * @returns `true` if tenant is found, otherwise `false`
@@ -304,6 +307,7 @@ async function hasDefaultTenant(tenantId: number, tenantName: string): Promise<b
/** /**
* Create default tenant * Create default tenant
*
* @param tenantName tenant name * @param tenantName tenant name
* @returns the tenant id or null * @returns the tenant id or null
*/ */
@@ -327,6 +331,7 @@ async function createDefaultTenant(tenantName: string) {
/** /**
* Create users * Create users
*
* @param tenantId tenant id * @param tenantId tenant id
* @param user user object * @param user user object
* @returns the created user * @returns the created user
@@ -355,6 +360,7 @@ async function createUsers(tenantId: number, user: any) {
/** /**
* Update Activiti license * Update Activiti license
*
* @param opts command options * @param opts command options
* @returns `true` if license uploaded successfully, otherwise `false` * @returns `true` if license uploaded successfully, otherwise `false`
*/ */
@@ -383,6 +389,7 @@ async function updateLicense(opts: InitApsEnvArgs) {
/** /**
* Check if default application is deployed * Check if default application is deployed
*
* @param appName application name * @param appName application name
* @returns `true` if application is deployed, otherwise `false` * @returns `true` if application is deployed, otherwise `false`
*/ */
@@ -401,6 +408,7 @@ async function isDefaultAppDeployed(appName: string): Promise<boolean> {
/** /**
* Import and publish the application * Import and publish the application
*
* @param appName application name * @param appName application name
* @returns the app definition result * @returns the app definition result
*/ */
@@ -423,6 +431,7 @@ async function importPublishApp(appName: string): Promise<AppDefinitionUpdateRes
/** /**
* Deploy application * Deploy application
*
* @param appDefinitionId app definition id * @param appDefinitionId app definition id
*/ */
async function deployApp(appDefinitionId: number) { async function deployApp(appDefinitionId: number) {
@@ -442,6 +451,7 @@ async function deployApp(appDefinitionId: number) {
/** /**
* Checks if Activiti app has license * Checks if Activiti app has license
*
* @param opts command options * @param opts command options
* @returns `true` if license is valid, otherwise `false` * @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 * Get default users from the realm
*
* @param opts command options * @param opts command options
* @returns array of default APS users or null * @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 * Validate that ACS repo for Activiti is present
*
* @param opts command options * @param opts command options
* @param tenantId tenant id * @param tenantId tenant id
* @param contentName content service name * @param contentName content service name
@@ -527,6 +539,7 @@ async function isContentRepoPresent(opts: InitApsEnvArgs, tenantId: number, cont
/** /**
* Add content service with basic auth * Add content service with basic auth
*
* @param opts command options * @param opts command options
* @param tenantId tenant id * @param tenantId tenant id
* @param name content name * @param name content name
@@ -567,6 +580,7 @@ async function addContentRepoWithBasic(opts: InitApsEnvArgs, tenantId: number, n
/** /**
* Authorize activiti user to ACS repo * Authorize activiti user to ACS repo
*
* @param opts command options * @param opts command options
* @param user user object * @param user user object
*/ */
@@ -600,6 +614,7 @@ async function authorizeUserToContentRepo(opts: InitApsEnvArgs, user: any) {
/** /**
* Authorize user with content using basic auth * Authorize user with content using basic auth
*
* @param opts command options * @param opts command options
* @param username username * @param username username
* @param contentId content id * @param contentId content id
@@ -629,6 +644,7 @@ async function authorizeUserToContentWithBasic(opts: InitApsEnvArgs, username: s
/** /**
* Download APS license file * Download APS license file
*
* @param apsLicensePath path to license file * @param apsLicensePath path to license file
* @returns `true` if download succeeded, otherwise `false` * @returns `true` if download succeeded, otherwise `false`
*/ */
@@ -649,6 +665,7 @@ async function downloadLicenseFile(apsLicensePath: string) {
/** /**
* Format an error for logging. * Format an error for logging.
*
* @param error error object * @param error error object
* @returns formatted error string * @returns formatted error string
*/ */
@@ -670,6 +687,7 @@ function formatError(error: any): string {
/** /**
* Async delay. * Async delay.
*
* @param ms milliseconds to wait * @param ms milliseconds to wait
* @returns a promise that resolves after the delay * @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 { function toLinkedLicenseExpression(rawExpression: string): string {
return rawExpression.replace(/\*/g, '').replace(/[a-zA-Z0-9\-.]+/g, (match: string) => { return rawExpression.replace(/\*/g, '').replace(/[a-zA-Z0-9\-.]+/g, (match: string) => {
const lowerMatch = match.toLowerCase(); 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 { function renderLicensePage(filteredPackages: Record<string, PackageInfoWithMetadata>, projName: string, projVersion: string): string {
const rows = Object.entries(filteredPackages).map(([packageName, pack]) => { const rows = Object.entries(filteredPackages).map(([packageName, pack]) => {
const lastAtSignPos = packageName.lastIndexOf('@'); const lastAtSignPos = packageName.lastIndexOf('@');
@@ -192,7 +206,6 @@ Options:
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// eslint-disable-next-line no-console
console.info(`Checking ${packagePath}`); console.info(`Checking ${packagePath}`);
const licenseScan = collectProductionLicenses(packagePath, { const licenseScan = collectProductionLicenses(packagePath, {
denyList: ['GPL'], denyList: ['GPL'],
@@ -223,7 +236,7 @@ Options:
const outputFile = path.join(outputPath, `license-info-${packageJson.version}.md`); const outputFile = path.join(outputPath, `license-info-${packageJson.version}.md`);
fs.writeFileSync(outputFile, mdText); fs.writeFileSync(outputFile, mdText);
// eslint-disable-next-line no-console
console.log(`Report saved as ${outputFile}`); console.log(`Report saved as ${outputFile}`);
resolve(0); resolve(0);
}); });
-2
View File
@@ -17,7 +17,6 @@
import { exit } from 'node:process'; import { exit } from 'node:process';
/* eslint-disable */
let log = null; let log = null;
log = { log = {
@@ -33,4 +32,3 @@ log = {
}; };
export let logger = log; export let logger = log;
/* eslint-enable */
+6 -1
View File
@@ -25,7 +25,12 @@ export class CheckEnv {
_alfrescoJsApi: AlfrescoApi; _alfrescoJsApi: AlfrescoApi;
counter = 0; 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() { async checkEnv() {
try { try {
@@ -21,7 +21,10 @@ import { AlfrescoApi } from '@alfresco/js-api';
export class GovernanceCheckPlugin { export class GovernanceCheckPlugin {
governanceHealth: GovernanceHealth; 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); this.governanceHealth = new GovernanceHealth(this.pluginInfo, this.alfrescoJsApi);
} }
+4 -3
View File
@@ -15,14 +15,15 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @typescript-eslint/naming-convention */
import { logger } from '../logger'; import { logger } from '../logger';
import { PluginInterface } from './plugin-model'; import { PluginInterface } from './plugin-model';
import { AlfrescoApi, GsSitesApi } from '@alfresco/js-api'; import { AlfrescoApi, GsSitesApi } from '@alfresco/js-api';
export class GovernanceHealth { export class GovernanceHealth {
constructor(private pluginInfo: PluginInterface, private alfrescoJsApi: AlfrescoApi) {} constructor(
private readonly pluginInfo: PluginInterface,
private readonly alfrescoJsApi: AlfrescoApi
) {}
async isRecordManagementAvailable(): Promise<boolean> { async isRecordManagementAvailable(): Promise<boolean> {
try { try {
+4 -1
View File
@@ -20,7 +20,10 @@ import { logger } from '../logger';
import { AlfrescoApi } from '@alfresco/js-api'; import { AlfrescoApi } from '@alfresco/js-api';
export class PluginConfiguration { export class PluginConfiguration {
constructor(private plugInInfo: PluginInterface, private alfrescoJsApi: AlfrescoApi) {} constructor(
private readonly plugInInfo: PluginInterface,
private readonly alfrescoJsApi: AlfrescoApi
) {}
async getAppConfig(url: string) { async getAppConfig(url: string) {
return this.callCustomApi(url); return this.callCustomApi(url);
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @typescript-eslint/naming-convention */
import { PluginInterface } from './plugin-model'; import { PluginInterface } from './plugin-model';
import { logger } from '../logger'; import { logger } from '../logger';
import { ProcessAutomationHealth } from './process-automation-health'; import { ProcessAutomationHealth } from './process-automation-health';
@@ -26,7 +24,10 @@ import { exit } from 'node:process';
export class ProcessAutomationCheckPlugin { export class ProcessAutomationCheckPlugin {
processAutomationHealth: ProcessAutomationHealth; 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); this.processAutomationHealth = new ProcessAutomationHealth(this.plugInInfo, this.alfrescoJsApi);
} }
@@ -23,7 +23,10 @@ import { AlfrescoApi } from '@alfresco/js-api';
export class ProcessAutomationHealth { export class ProcessAutomationHealth {
config: PluginConfiguration; 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); this.config = new PluginConfiguration(this.plugInInfo, this.alfrescoJsApi);
} }
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @typescript-eslint/naming-convention */
import { exit } from 'node:process'; import { exit } from 'node:process';
import { PluginInterface } from './plugin-model'; import { PluginInterface } from './plugin-model';
import { logger } from '../logger'; import { logger } from '../logger';
@@ -26,7 +24,10 @@ import { AlfrescoApi } from '@alfresco/js-api';
export class ProcessServiceCheckPlugin { export class ProcessServiceCheckPlugin {
processServiceHealth: ProcessServiceHealth; 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); this.processServiceHealth = new ProcessServiceHealth(this.plugInInfo, this.alfrescoJsApi);
} }
@@ -23,7 +23,10 @@ import { AlfrescoApi, SystemPropertiesApi } from '@alfresco/js-api';
export class ProcessServiceHealth { export class ProcessServiceHealth {
config: PluginConfiguration; 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); this.config = new PluginConfiguration(this.plugInInfo, this.alfrescoJsApi);
} }
-1
View File
@@ -16,7 +16,6 @@
*/ */
/* cSpell:disable */ /* cSpell:disable */
/* eslint-disable @typescript-eslint/naming-convention */
export const ACTIVITI_CLOUD_APPS: any = { export const ACTIVITI_CLOUD_APPS: any = {
SIMPLE_APP: { SIMPLE_APP: {
+6
View File
@@ -15,6 +15,12 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* Escape HTML special characters.
*
* @param text input string
* @returns escaped string
*/
export function escapeHtml(text: string): string { export function escapeHtml(text: string): string {
return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;'); return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
} }
+1 -2
View File
@@ -15,9 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
// eslint-disable-next-line @typescript-eslint/no-var-requires
const expand = require('dotenv-expand'); const expand = require('dotenv-expand');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const nodeDotEnv = require('dotenv'); const nodeDotEnv = require('dotenv');
export const dotenv = () => expand(nodeDotEnv); export const dotenv = () => expand(nodeDotEnv);
-1
View File
@@ -1 +0,0 @@
coverage
-103
View File
@@ -1,103 +0,0 @@
{
"extends": ["../../.eslintrc.js"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": ["plugin:@nx/angular"],
"parserOptions": {
"project": [
"lib/content-services/tsconfig.lib.json",
"lib/content-services/tsconfig.spec.json",
"lib/content-services/.storybook/tsconfig.json"
],
"createDefaultProgram": true
},
"rules": {
"jsdoc/tag-lines": [
"error",
"any",
{
"startLines": 1
}
],
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/consistent-type-assertions": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/member-ordering": "off",
"no-underscore-dangle": [
"error",
{
"allowAfterThis": true
}
],
"no-shadow": "warn",
"quote-props": "off",
"object-shorthand": "warn",
"prefer-const": "warn",
"arrow-body-style": "warn",
"@angular-eslint/no-output-native": "off",
"space-before-function-paren": "off",
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": ["adf", "app"],
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": ["element", "attribute"],
"prefix": ["adf", "app"],
"style": "kebab-case"
}
],
"@angular-eslint/no-input-prefix": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-var-requires": "error",
"comma-dangle": "error",
"default-case": "error",
"import/order": "off",
"max-len": [
"error",
{
"code": 240
}
],
"no-bitwise": "off",
"no-duplicate-imports": "error",
"no-multiple-empty-lines": "error",
"no-return-await": "error",
"rxjs/no-create": "error",
"rxjs/no-subject-unsubscribe": "error",
"rxjs/no-subject-value": "error",
"rxjs/no-unsafe-takeuntil": "error",
"unicorn/filename-case": "error",
"@angular-eslint/prefer-standalone": "off"
}
},
{
"files": ["*.html"],
"parserOptions": {
"project": ["lib/content-services/tsconfig.lib.json", "lib/content-services/tsconfig.spec.json"],
"createDefaultProgram": true
},
"extends": ["plugin:@nx/angular-template"],
"rules": {
"@angular-eslint/template/no-autofocus": "error",
"@angular-eslint/template/no-positive-tabindex": "error"
}
}
]
}
+23
View File
@@ -1,3 +1,20 @@
/*!
* @license
* Copyright © 2005-2026 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path'; import { dirname } from 'node:path';
import type { StorybookConfig } from '@storybook/angular'; import type { StorybookConfig } from '@storybook/angular';
@@ -21,6 +38,12 @@ const config: StorybookConfig = {
export default config; export default config;
/**
* Resolve absolute path for a package.
*
* @param value package name
* @returns absolute path to the package
*/
function getAbsolutePath(value: string): any { function getAbsolutePath(value: string): any {
return dirname(fileURLToPath(import.meta.resolve(`${value}/package.json`))); return dirname(fileURLToPath(import.meta.resolve(`${value}/package.json`)));
} }
@@ -1,3 +1,20 @@
/*!
* @license
* Copyright © 2005-2026 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { Preview } from '@storybook/angular'; import type { Preview } from '@storybook/angular';
const preview: Preview = { const preview: Preview = {
+68
View File
@@ -0,0 +1,68 @@
/*!
* @license
* Copyright © 2005-2026 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import rootConfig from '../../eslint.config.mjs';
export default [
...rootConfig,
{
files: ['**/*.ts'],
rules: {
'@nx/enforce-module-boundaries': [
'error',
{
enforceBuildableLibDependency: true,
allow: [],
depConstraints: [
{
sourceTag: 'scope:content-services',
onlyDependOnLibsWithTags: ['scope:js-api', 'scope:core', 'scope:extensions']
}
]
}
],
'@typescript-eslint/consistent-type-assertions': 'warn',
'@typescript-eslint/prefer-for-of': 'warn',
'no-underscore-dangle': [
'error',
{
allowAfterThis: true
}
],
'no-shadow': 'warn',
'quote-props': 'off',
'object-shorthand': 'warn',
'prefer-const': 'warn',
'arrow-body-style': 'warn',
'space-before-function-paren': 'off',
'@angular-eslint/prefer-standalone': 'off'
}
},
{
files: ['lib/content-services/**/*.html'],
rules: {
'@angular-eslint/template/no-autofocus': 'error',
'@angular-eslint/template/no-positive-tabindex': 'error'
}
},
{
files: ['**/.storybook/**/*.ts'],
rules: {
'@nx/enforce-module-boundaries': 'off'
}
}
];
+1
View File
@@ -4,6 +4,7 @@
"sourceRoot": "lib/content-services/src", "sourceRoot": "lib/content-services/src",
"projectType": "library", "projectType": "library",
"prefix": "adf", "prefix": "adf",
"tags": ["scope:content-services", "type:library"],
"targets": { "targets": {
"build": { "build": {
"executor": "@angular/build:ng-packagr", "executor": "@angular/build:ng-packagr",
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @typescript-eslint/naming-convention */
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { PropertyGroupTranslatorService, RECOGNISED_ECM_TYPES } from './property-groups-translator.service'; import { PropertyGroupTranslatorService, RECOGNISED_ECM_TYPES } from './property-groups-translator.service';
import { Property, OrganisedPropertyGroup } from '../interfaces/content-metadata.interfaces'; import { Property, OrganisedPropertyGroup } from '../interfaces/content-metadata.interfaces';
@@ -34,7 +34,6 @@ import { SitesService } from '../common/services/sites.service';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class ContentNodeDialogService { export class ContentNodeDialogService {
private readonly dialog = inject(MatDialog); private readonly dialog = inject(MatDialog);
private readonly contentService = inject(ContentService); private readonly contentService = inject(ContentService);
@@ -28,9 +28,8 @@ import { NodeEntryEvent, ShareDataRow } from '../../document-list';
import { SearchQueryBuilderService } from '../../search'; import { SearchQueryBuilderService } from '../../search';
import { SitesService } from '../../common/services/sites.service'; import { SitesService } from '../../common/services/sites.service';
import { NodesApiService } from '../../common/services/nodes-api.service'; import { NodesApiService } from '../../common/services/nodes-api.service';
import { UnitTestingUtils } from '../../../../../core/src/lib/testing/unit-testing-utils';
import { provideRouter } from '@angular/router'; import { provideRouter } from '@angular/router';
import { NoopAuthModule } from '@alfresco/adf-core'; import { NoopAuthModule, UnitTestingUtils } from '@alfresco/adf-core';
const fakeResultSetPaging: ResultSetPaging = { const fakeResultSetPaging: ResultSetPaging = {
list: { list: {
@@ -70,6 +69,12 @@ describe('ContentNodeSelectorPanelComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
}; };
const searchAndTriggerDebounce = (searchTerm = 'string-to-search'): void => {
typeToSearchBox(searchTerm);
tick(debounceSearch);
fixture.detectChanges();
};
const getSearchIcon = (type: string): DebugElement => testingUtils.getByCSS(`[data-automation-id="content-node-selector-search-${type}"]`); const getSearchIcon = (type: string): DebugElement => testingUtils.getByCSS(`[data-automation-id="content-node-selector-search-${type}"]`);
const triggerSearchResults = (searchResults: ResultSetPaging): void => { const triggerSearchResults = (searchResults: ResultSetPaging): void => {
@@ -160,10 +165,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
}); });
it('should the user query get updated when the user types in the search input', fakeAsync(() => { it('should the user query get updated when the user types in the search input', fakeAsync(() => {
typeToSearchBox('search-term'); searchAndTriggerDebounce('search-term');
tick(debounceSearch);
fixture.detectChanges();
expect(searchSpy).toHaveBeenCalled(); expect(searchSpy).toHaveBeenCalled();
expect(searchQueryBuilderService.userQuery).toEqual('(search-term*)'); expect(searchQueryBuilderService.userQuery).toEqual('(search-term*)');
@@ -171,39 +173,27 @@ describe('ContentNodeSelectorPanelComponent', () => {
})); }));
it('should set the query builder search mode to formula when the user types in the search input', fakeAsync(() => { it('should set the query builder search mode to formula when the user types in the search input', fakeAsync(() => {
typeToSearchBox('search-term'); searchAndTriggerDebounce('search-term');
tick(debounceSearch);
fixture.detectChanges();
expect(searchQueryBuilderService.searchMode).toEqual('formula'); expect(searchQueryBuilderService.searchMode).toEqual('formula');
})); }));
it('should add the wildcard suffix to the user query when wildcards are enabled', fakeAsync(() => { it('should add the wildcard suffix to the user query when wildcards are enabled', fakeAsync(() => {
spyOnProperty(searchQueryBuilderService, 'wildcardsEnabled', 'get').and.returnValue(true); spyOnProperty(searchQueryBuilderService, 'wildcardsEnabled', 'get').and.returnValue(true);
typeToSearchBox('search-term'); searchAndTriggerDebounce('search-term');
tick(debounceSearch);
fixture.detectChanges();
expect(searchQueryBuilderService.userQuery).toEqual('(search-term*)'); expect(searchQueryBuilderService.userQuery).toEqual('(search-term*)');
})); }));
it('should NOT add the wildcard suffix to the user query when wildcards are disabled', fakeAsync(() => { it('should NOT add the wildcard suffix to the user query when wildcards are disabled', fakeAsync(() => {
spyOnProperty(searchQueryBuilderService, 'wildcardsEnabled', 'get').and.returnValue(false); spyOnProperty(searchQueryBuilderService, 'wildcardsEnabled', 'get').and.returnValue(false);
typeToSearchBox('search-term'); searchAndTriggerDebounce('search-term');
tick(debounceSearch);
fixture.detectChanges();
expect(searchQueryBuilderService.userQuery).toEqual('(search-term)'); expect(searchQueryBuilderService.userQuery).toEqual('(search-term)');
})); }));
it('should perform a search when the search request gets updated and it is defined', fakeAsync(() => { it('should perform a search when the search request gets updated and it is defined', fakeAsync(() => {
typeToSearchBox('search-term'); searchAndTriggerDebounce('search-term');
tick(debounceSearch);
fixture.detectChanges();
expect(searchSpy).toHaveBeenCalledWith(false); expect(searchSpy).toHaveBeenCalledWith(false);
})); }));
@@ -211,10 +201,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
it('should NOT perform a search and clear the results when the search input is empty', fakeAsync(() => { it('should NOT perform a search and clear the results when the search input is empty', fakeAsync(() => {
spyOn(component, 'clearSearch'); spyOn(component, 'clearSearch');
typeToSearchBox(''); searchAndTriggerDebounce('');
tick(debounceSearch);
fixture.detectChanges();
expect(searchSpy).not.toHaveBeenCalled(); expect(searchSpy).not.toHaveBeenCalled();
expect(component.clearSearch).toHaveBeenCalled(); expect(component.clearSearch).toHaveBeenCalled();
@@ -237,10 +224,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
}); });
it('should load the results by calling the search api on search change', fakeAsync(() => { it('should load the results by calling the search api on search change', fakeAsync(() => {
typeToSearchBox('search-term'); searchAndTriggerDebounce('search-term');
tick(debounceSearch);
fixture.detectChanges();
expect(searchSpy).toHaveBeenCalledWith(false); expect(searchSpy).toHaveBeenCalledWith(false);
})); }));
@@ -248,23 +232,17 @@ describe('ContentNodeSelectorPanelComponent', () => {
it('should the query include the show files filterQuery', fakeAsync(() => { it('should the query include the show files filterQuery', fakeAsync(() => {
spyOn(searchQueryBuilderService, 'addFilterQuery').and.callThrough(); spyOn(searchQueryBuilderService, 'addFilterQuery').and.callThrough();
component.showFilesInResult = true; component.showFilesInResult = true;
typeToSearchBox('search-term'); searchAndTriggerDebounce('search-term');
const expectedRequest = `TYPE:'cm:folder' OR TYPE:'cm:content'`; const expectedRequest = `TYPE:'cm:folder' OR TYPE:'cm:content'`;
tick(debounceSearch);
fixture.detectChanges();
expect(searchSpy).toHaveBeenCalledWith(false); expect(searchSpy).toHaveBeenCalledWith(false);
expect(searchQueryBuilderService.addFilterQuery).toHaveBeenCalledWith(expectedRequest); expect(searchQueryBuilderService.addFilterQuery).toHaveBeenCalledWith(expectedRequest);
})); }));
it('should reset the currently chosen node in case of starting a new search', fakeAsync(() => { it('should reset the currently chosen node in case of starting a new search', fakeAsync(() => {
component.chosenNode = [entry]; component.chosenNode = [entry];
typeToSearchBox('kakarot'); searchAndTriggerDebounce('kakarot');
tick(debounceSearch);
fixture.detectChanges();
expect(component.chosenNode).toBeNull(); expect(component.chosenNode).toBeNull();
})); }));
@@ -279,9 +257,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
it('should perform a search when selecting a site with the correct query', fakeAsync(() => { it('should perform a search when selecting a site with the correct query', fakeAsync(() => {
spyOn(searchQueryBuilderService, 'addFilterQuery').and.callThrough(); spyOn(searchQueryBuilderService, 'addFilterQuery').and.callThrough();
typeToSearchBox('search-term'); searchAndTriggerDebounce('search-term');
tick(debounceSearch);
expect(searchSpy.calls.count()).toBe(1); expect(searchSpy.calls.count()).toBe(1);
@@ -297,8 +273,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
it('should remove the previous site filter query when changing the selected site', fakeAsync(() => { it('should remove the previous site filter query when changing the selected site', fakeAsync(() => {
spyOn(searchQueryBuilderService, 'addFilterQuery').and.callThrough(); spyOn(searchQueryBuilderService, 'addFilterQuery').and.callThrough();
spyOn(searchQueryBuilderService, 'removeFilterQuery').and.callThrough(); spyOn(searchQueryBuilderService, 'removeFilterQuery').and.callThrough();
typeToSearchBox('search-term'); searchAndTriggerDebounce('search-term');
tick(debounceSearch);
component.siteChanged({ entry: { guid: 'namek' } } as SiteEntry); component.siteChanged({ entry: { guid: 'namek' } } as SiteEntry);
component.siteChanged({ entry: { guid: 'vegeta' } } as SiteEntry); component.siteChanged({ entry: { guid: 'vegeta' } } as SiteEntry);
@@ -326,9 +301,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
component.documentList.folderNode = { id: 'fakeNodeId', isFolder: true, path: {} } as Node; component.documentList.folderNode = { id: 'fakeNodeId', isFolder: true, path: {} } as Node;
fixture.detectChanges(); fixture.detectChanges();
typeToSearchBox('search-term'); searchAndTriggerDebounce('search-term');
tick(debounceSearch);
expect(searchSpy.calls.count()).toBe(1); expect(searchSpy.calls.count()).toBe(1);
@@ -345,9 +318,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
it('should get the corresponding node ids on search when a known alias is selected from dropdown', fakeAsync(() => { it('should get the corresponding node ids on search when a known alias is selected from dropdown', fakeAsync(() => {
component.documentList.folderNode = { id: 'fakeNodeId', isFolder: true, path: {} } as Node; component.documentList.folderNode = { id: 'fakeNodeId', isFolder: true, path: {} } as Node;
typeToSearchBox('vegeta'); searchAndTriggerDebounce('vegeta');
tick(debounceSearch);
component.siteChanged({ entry: { guid: '-sites-' } } as SiteEntry); component.siteChanged({ entry: { guid: '-sites-' } } as SiteEntry);
expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(1); expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(1);
@@ -360,9 +331,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
typeToSearchBox('vegeta'); searchAndTriggerDebounce('vegeta');
tick(debounceSearch);
component.siteChanged({ entry: { guid: '-sites-' } } as SiteEntry); component.siteChanged({ entry: { guid: '-sites-' } } as SiteEntry);
expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(1); expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(1);
@@ -375,8 +344,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
const nodeIds$ = new Subject<string[]>(); const nodeIds$ = new Subject<string[]>();
getCorrespondingNodeIdsSpy.and.returnValue(nodeIds$.asObservable()); getCorrespondingNodeIdsSpy.and.returnValue(nodeIds$.asObservable());
typeToSearchBox('vegeta'); searchAndTriggerDebounce('vegeta');
tick(debounceSearch);
searchSpy.calls.reset(); searchSpy.calls.reset();
@@ -396,9 +364,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
component.dropdownSiteList = { list: { entries: [{ entry: { guid: '-sites-' } }, { entry: { guid: 'namek' } }] } } as SitePaging; component.dropdownSiteList = { list: { entries: [{ entry: { guid: '-sites-' } }, { entry: { guid: 'namek' } }] } } as SitePaging;
fixture.detectChanges(); fixture.detectChanges();
typeToSearchBox('vegeta'); searchAndTriggerDebounce('vegeta');
tick(debounceSearch);
expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(0); expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(0);
})); }));
@@ -99,7 +99,6 @@ export class ContentNodeSelectorPanelComponent implements OnInit {
private readonly sitesService = inject(SitesService); private readonly sitesService = inject(SitesService);
private readonly contentNodeSelectorPanelService = inject(ContentNodeSelectorPanelService); private readonly contentNodeSelectorPanelService = inject(ContentNodeSelectorPanelService);
// eslint-disable-next-line @typescript-eslint/naming-convention
DEFAULT_PAGINATION: Pagination = new Pagination({ DEFAULT_PAGINATION: Pagination = new Pagination({
maxItems: 25, maxItems: 25,
skipCount: 0 skipCount: 0
@@ -25,9 +25,6 @@ import { SitesService } from '../../common/services/sites.service';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { MatFormFieldModule } from '@angular/material/form-field'; import { MatFormFieldModule } from '@angular/material/form-field';
/* eslint-disable no-shadow */
/* eslint-disable @typescript-eslint/naming-convention */
export const Relations = { export const Relations = {
Members: 'members', Members: 'members',
Containers: 'containers' Containers: 'containers'
@@ -196,7 +196,6 @@ export class ShareDialogComponent implements OnInit {
this.isDisabled = false; this.isDisabled = false;
this.isFileShared = true; this.isFileShared = true;
// eslint-disable-next-line
this.renditionService.getNodeRendition(this.data.node.entry.id); this.renditionService.getNodeRendition(this.data.node.entry.id);
this.updateForm(); this.updateForm();
@@ -37,7 +37,7 @@ export class NodeSharedDirective implements OnChanges {
isShared: boolean = false; isShared: boolean = false;
/** Node to share. */ /** Node to share. */
// eslint-disable-next-line @angular-eslint/no-input-rename
@Input('adf-share') @Input('adf-share')
node: NodeEntry; node: NodeEntry;
@@ -20,7 +20,6 @@ import { UntypedFormControl } from '@angular/forms';
const I18N_ERRORS_PATH = 'CORE.FOLDER_DIALOG.FOLDER_NAME.ERRORS'; const I18N_ERRORS_PATH = 'CORE.FOLDER_DIALOG.FOLDER_NAME.ERRORS';
export const forbidSpecialCharacters = ({ value }: UntypedFormControl) => { export const forbidSpecialCharacters = ({ value }: UntypedFormControl) => {
// eslint-disable-next-line no-useless-escape
const specialCharacters: RegExp = /([\*\"\<\>\\\/\?\:\|])/; const specialCharacters: RegExp = /([\*\"\<\>\\\/\?\:\|])/;
const isValid: boolean = !specialCharacters.test(value); const isValid: boolean = !specialCharacters.test(value);
@@ -34,7 +34,7 @@ export class LibraryFavoriteDirective implements OnChanges {
library: LibraryEntity = null; library: LibraryEntity = null;
@Output() toggle = new EventEmitter<any>(); @Output() toggle = new EventEmitter<any>();
// eslint-disable-next-line @angular-eslint/no-output-native
@Output() error = new EventEmitter<any>(); @Output() error = new EventEmitter<any>();
private targetLibrary = null; private targetLibrary = null;
@@ -52,7 +52,6 @@ export class LibraryMembershipDirective implements OnChanges {
@Output() @Output()
toggle = new EventEmitter<LibraryMembershipToggleEvent>(); toggle = new EventEmitter<LibraryMembershipToggleEvent>();
// eslint-disable-next-line @angular-eslint/no-output-native
@Output() @Output()
error = new EventEmitter<LibraryMembershipErrorEvent>(); error = new EventEmitter<LibraryMembershipErrorEvent>();
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output, inject } from '@angular/core'; import { Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output, inject } from '@angular/core';
import { NodeEntry, Node, DeletedNodeEntry, DeletedNode, TrashcanApi, NodesApi, LazyApi } from '@alfresco/js-api'; import { NodeEntry, Node, DeletedNodeEntry, DeletedNode, TrashcanApi, NodesApi, LazyApi } from '@alfresco/js-api';
import { Observable, forkJoin, from, of } from 'rxjs'; import { Observable, forkJoin, from, of } from 'rxjs';
@@ -176,7 +174,7 @@ export class NodeDeleteDirective implements OnChanges {
if (status.allFailed && !status.oneFailed) { if (status.allFailed && !status.oneFailed) {
return this.translation.instant( return this.translation.instant(
'CORE.DELETE_NODE.ERROR_PLURAL', 'CORE.DELETE_NODE.ERROR_PLURAL',
// eslint-disable-next-line id-blacklist
{ number: status.failed.length } { number: status.failed.length }
); );
} }
@@ -184,7 +182,7 @@ export class NodeDeleteDirective implements OnChanges {
if (status.allSucceeded && !status.oneSucceeded) { if (status.allSucceeded && !status.oneSucceeded) {
return this.translation.instant( return this.translation.instant(
'CORE.DELETE_NODE.PLURAL', 'CORE.DELETE_NODE.PLURAL',
// eslint-disable-next-line id-blacklist
{ number: status.success.length } { number: status.success.length }
); );
} }
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, EventEmitter, HostListener, Input, OnChanges, Output, SimpleChanges, inject } from '@angular/core'; import { Directive, EventEmitter, HostListener, Input, OnChanges, Output, SimpleChanges, inject } from '@angular/core';
import { FavoriteBodyCreate, NodeEntry, SharedLinkEntry, Node, SharedLink, FavoritesApi, LazyApi } from '@alfresco/js-api'; import { FavoriteBodyCreate, NodeEntry, SharedLinkEntry, Node, SharedLink, FavoritesApi, LazyApi } from '@alfresco/js-api';
import { Observable, from, forkJoin, of } from 'rxjs'; import { Observable, from, forkJoin, of } from 'rxjs';
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, ElementRef, Renderer2, HostListener, Input, AfterViewInit, inject } from '@angular/core'; import { Directive, ElementRef, Renderer2, HostListener, Input, AfterViewInit, inject } from '@angular/core';
import { Node } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
import { ContentService } from '../common/services/content.service'; import { ContentService } from '../common/services/content.service';
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */
import { Directive, EventEmitter, HostListener, Input, Output, inject } from '@angular/core'; import { Directive, EventEmitter, HostListener, Input, Output, inject } from '@angular/core';
import { TrashcanApi, DeletedNodeEntry, DeletedNodesPaging, LazyApi } from '@alfresco/js-api'; import { TrashcanApi, DeletedNodeEntry, DeletedNodesPaging, LazyApi } from '@alfresco/js-api';
import { Observable, forkJoin, from, of } from 'rxjs'; import { Observable, forkJoin, from, of } from 'rxjs';
@@ -184,7 +182,6 @@ export class NodeRestoreDirective {
if (status.someFailed && !status.oneFailed) { if (status.someFailed && !status.oneFailed) {
return this.translation.instant('CORE.RESTORE_NODE.PARTIAL_PLURAL', { return this.translation.instant('CORE.RESTORE_NODE.PARTIAL_PLURAL', {
// eslint-disable-next-line id-blacklist
number: status.fail.length number: status.fail.length
}); });
} }
@@ -15,9 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable rxjs/no-subject-value */
/* eslint-disable @typescript-eslint/naming-convention */
import { import {
AppConfigService, AppConfigService,
ColumnsSelectorComponent, ColumnsSelectorComponent,
@@ -23,8 +23,8 @@ import { SimpleChange } from '@angular/core';
import { SearchHeaderQueryBuilderService } from './../../../search/services/search-header-query-builder.service'; import { SearchHeaderQueryBuilderService } from './../../../search/services/search-header-query-builder.service';
import { FilterHeaderComponent } from './filter-header.component'; import { FilterHeaderComponent } from './filter-header.component';
import { provideRouter } from '@angular/router'; import { provideRouter } from '@angular/router';
import { SearchCategory } from '@alfresco/adf-content-services';
import { NodePaging } from '@alfresco/js-api'; import { NodePaging } from '@alfresco/js-api';
import { SearchCategory } from '../../../search/models/search-category.interface';
describe('FilterHeaderComponent', () => { describe('FilterHeaderComponent', () => {
let fixture: ComponentFixture<FilterHeaderComponent>; let fixture: ComponentFixture<FilterHeaderComponent>;
@@ -56,7 +56,6 @@ export class NameColumnComponent implements OnInit {
private readonly nodesApiService = inject(NodesApiService); private readonly nodesApiService = inject(NodesApiService);
@Input({ required: true }) @Input({ required: true })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
context: any; context: any;
@Input() @Input()
@@ -29,7 +29,6 @@ import { NodeTooltipUtils } from '../../utils/node-tooltip.utils';
}) })
export class TrashcanNameColumnComponent implements OnInit { export class TrashcanNameColumnComponent implements OnInit {
@Input({ required: true }) @Input({ required: true })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
context: any; context: any;
isLibrary = false; isLibrary = false;
@@ -15,9 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-shadow */
/* eslint-disable @typescript-eslint/naming-convention */
export class ContentActionModel { export class ContentActionModel {
icon: string; icon: string;
title: string; title: string;
@@ -15,9 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-shadow */
/* eslint-disable @typescript-eslint/naming-convention */
export const NodeAction = { export const NodeAction = {
ATTACH: 'ATTACH', ATTACH: 'ATTACH',
CHOOSE: 'CHOOSE', CHOOSE: 'CHOOSE',
@@ -30,7 +30,6 @@ import { NodeAction } from '../models/node-action.enum';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class NodeActionsService { export class NodeActionsService {
private readonly contentDialogService = inject(ContentNodeDialogService); private readonly contentDialogService = inject(ContentNodeDialogService);
dialogRef = inject(MatDialog); dialogRef = inject(MatDialog);
@@ -75,7 +75,6 @@ export class NodeTooltipUtils {
return ''; return '';
} }
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { properties, description, title } = node.entry as any; const { properties, description, title } = node.entry as any;
// Check both direct properties and cm: properties for compatibility // Check both direct properties and cm: properties for compatibility
@@ -93,7 +92,7 @@ export class NodeTooltipUtils {
* @param allEntries - Array of all entries to check for duplicates * @param allEntries - Array of all entries to check for duplicates
* @returns The display title, with ID/name appended if duplicate exists * @returns The display title, with ID/name appended if duplicate exists
*/ */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static getLibraryTitle(library: any, allEntries: any[]): string { static getLibraryTitle(library: any, allEntries: any[]): string {
if (!library) { if (!library) {
return ''; return '';
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, ElementRef, HostListener, Input, Output, EventEmitter, inject } from '@angular/core'; import { Directive, ElementRef, HostListener, Input, Output, EventEmitter, inject } from '@angular/core';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { Node } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
@@ -17,10 +17,8 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NodeCommentsComponent } from './node-comments.component'; import { NodeCommentsComponent } from './node-comments.component';
import { CommentsComponent } from '../../../../core/src/lib/comments/comments.component';
import { CommentModel } from '../../../../core/src/lib/models';
import { UnitTestingUtils } from '../../../../core/src/lib/testing/unit-testing-utils';
import { provideApiTesting } from '../testing/providers'; import { provideApiTesting } from '../testing/providers';
import { CommentModel, CommentsComponent, UnitTestingUtils } from '@alfresco/adf-core';
describe('NodeCommentsComponent', () => { describe('NodeCommentsComponent', () => {
let fixture: ComponentFixture<NodeCommentsComponent>; let fixture: ComponentFixture<NodeCommentsComponent>;
@@ -68,7 +68,6 @@ export class AddPermissionPanelComponent {
selectedItems: NodeEntry[] = []; selectedItems: NodeEntry[] = [];
// eslint-disable-next-line @typescript-eslint/naming-convention
EVERYONE: NodeEntry = new NodeEntry({ EVERYONE: NodeEntry = new NodeEntry({
entry: new Node({ nodeType: 'cm:authorityContainer', properties: { 'cm:authorityName': 'GROUP_EVERYONE' } }) entry: new Node({ nodeType: 'cm:authorityContainer', properties: { 'cm:authorityName': 'GROUP_EVERYONE' } })
}); });
@@ -38,10 +38,7 @@ export class SearchPermissionConfigurationService implements SearchConfiguration
maxItems: maxResults, maxItems: maxResults,
skipCount skipCount
}, },
filterQueries: [ filterQueries: [{ query: "TYPE:'cm:authority'" }]
/* eslint-disable-next-line */
{ query: "TYPE:'cm:authority'" }
]
}; };
} }
@@ -15,7 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, Input, Output, EventEmitter, inject } from '@angular/core'; import { Directive, Input, Output, EventEmitter, inject } from '@angular/core';
import { Node } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
import { ContentService } from '../../common/services/content.service'; import { ContentService } from '../../common/services/content.service';
@@ -79,7 +79,7 @@ export class SearchComponent implements SearchComponentInterface, AfterContentIn
searchTerm: string = ''; searchTerm: string = '';
/** CSS class for display. */ /** CSS class for display. */
// eslint-disable-next-line @angular-eslint/no-input-rename
@Input('class') @Input('class')
set classList(classList: string) { set classList(classList: string) {
if (classList?.length) { if (classList?.length) {
@@ -19,7 +19,6 @@ import { UntypedFormControl } from '@angular/forms';
import { SearchTermValidator } from './search-term-validator'; import { SearchTermValidator } from './search-term-validator';
describe('Search term validator', () => { describe('Search term validator', () => {
it('should pass validation for a value with the specified required number of alphanumeric characters', () => { it('should pass validation for a value with the specified required number of alphanumeric characters', () => {
const control = new UntypedFormControl('ab', SearchTermValidator.minAlphanumericChars(2)); const control = new UntypedFormControl('ab', SearchTermValidator.minAlphanumericChars(2));
expect(control.valid).toBe(true); expect(control.valid).toBe(true);
@@ -35,7 +34,6 @@ describe('Search term validator', () => {
expect(control.valid).toBe(false); expect(control.valid).toBe(false);
}); });
/* eslint-disable max-len */
it('should fail validation for a value with less than the specified required number of alphanumeric characters but with other non-alphanumeric characters', () => { it('should fail validation for a value with less than the specified required number of alphanumeric characters but with other non-alphanumeric characters', () => {
const control = new UntypedFormControl('a ._-?b', SearchTermValidator.minAlphanumericChars(3)); const control = new UntypedFormControl('a ._-?b', SearchTermValidator.minAlphanumericChars(3));
expect(control.valid).toBe(false); expect(control.valid).toBe(false);
@@ -15,7 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
import { TagsCreatorMode, TagService } from '@alfresco/adf-content-services';
import { NotificationService, UnitTestingUtils } from '@alfresco/adf-core'; import { NotificationService, UnitTestingUtils } from '@alfresco/adf-core';
import { HarnessLoader } from '@angular/cdk/testing'; import { HarnessLoader } from '@angular/cdk/testing';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
@@ -26,6 +25,8 @@ import { MatError } from '@angular/material/form-field';
import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing'; import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing';
import { EMPTY, of, throwError } from 'rxjs'; import { EMPTY, of, throwError } from 'rxjs';
import { TagsCreatorComponent } from './tags-creator.component'; import { TagsCreatorComponent } from './tags-creator.component';
import { TagService } from '../services/tag.service';
import { TagsCreatorMode } from './tags-creator-mode';
describe('TagsCreatorComponent', () => { describe('TagsCreatorComponent', () => {
let fixture: ComponentFixture<TagsCreatorComponent>; let fixture: ComponentFixture<TagsCreatorComponent>;
@@ -24,7 +24,6 @@ import { UploadFilesEvent } from '../upload-files.event';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Directive() @Directive()
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class UploadBase implements OnInit { export abstract class UploadBase implements OnInit {
protected uploadService = inject(UploadService); protected uploadService = inject(UploadService);
protected translationService: TranslationService = inject(TranslationService); protected translationService: TranslationService = inject(TranslationService);
@@ -87,9 +86,7 @@ export abstract class UploadBase implements OnInit {
private readonly destroyRef = inject(DestroyRef); private readonly destroyRef = inject(DestroyRef);
ngOnInit() { ngOnInit() {
this.uploadService.fileUploadError this.uploadService.fileUploadError.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((error) => this.error.emit(error));
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(error => this.error.emit(error));
} }
/** /**
@@ -99,7 +96,7 @@ export abstract class UploadBase implements OnInit {
*/ */
uploadFiles(files: File[]): void { uploadFiles(files: File[]): void {
const filteredFiles: FileModel[] = files.map<FileModel>((file: File) => const filteredFiles: FileModel[] = files.map<FileModel>((file: File) =>
this.createFileModel(file, this.rootFolderId, ((file).webkitRelativePath || '').replace(/\/[^/]*$/, '')) this.createFileModel(file, this.rootFolderId, (file.webkitRelativePath || '').replace(/\/[^/]*$/, ''))
); );
this.uploadQueue(filteredFiles); this.uploadQueue(filteredFiles);
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/no-input-rename */
import { FileUtils } from '@alfresco/adf-core'; import { FileUtils } from '@alfresco/adf-core';
import { Directive, ElementRef, EventEmitter, Input, NgZone, OnDestroy, OnInit, Output, inject } from '@angular/core'; import { Directive, ElementRef, EventEmitter, Input, NgZone, OnDestroy, OnInit, Output, inject } from '@angular/core';
@@ -68,7 +68,7 @@ class ViewerWithCustomToolbarComponent {}
@Component({ @Component({
selector: 'adf-viewer-container-toolbar-actions', selector: 'adf-viewer-container-toolbar-actions',
imports: [MatIconModule, MatButtonModule, ViewerToolbarActionsComponent, AlfrescoViewerComponent, IconModule], imports: [MatIconModule, MatButtonModule, ViewerToolbarActionsComponent, AlfrescoViewerComponent, IconModule],
// eslint-disable-next-line @alfresco/eslint-angular/no-angular-material-selectors
template: `<adf-alfresco-viewer> template: `<adf-alfresco-viewer>
<adf-viewer-toolbar-actions> <adf-viewer-toolbar-actions>
<button mat-icon-button id="custom-button"> <button mat-icon-button id="custom-button">
@@ -102,7 +102,7 @@ class DummyDialogComponent {}
@Component({ @Component({
selector: 'adf-viewer-container-open-with', selector: 'adf-viewer-container-open-with',
imports: [MatIconModule, MatMenuModule, ViewerOpenWithComponent, AlfrescoViewerComponent, IconModule], imports: [MatIconModule, MatMenuModule, ViewerOpenWithComponent, AlfrescoViewerComponent, IconModule],
// eslint-disable-next-line @alfresco/eslint-angular/no-angular-material-selectors
template: ` template: `
<adf-alfresco-viewer> <adf-alfresco-viewer>
<adf-viewer-open-with> <adf-viewer-open-with>
@@ -127,7 +127,7 @@ class ViewerWithCustomOpenWithComponent {}
@Component({ @Component({
selector: 'adf-viewer-container-more-actions', selector: 'adf-viewer-container-more-actions',
imports: [MatIconModule, MatMenuModule, ViewerMoreActionsComponent, AlfrescoViewerComponent, IconModule], imports: [MatIconModule, MatMenuModule, ViewerMoreActionsComponent, AlfrescoViewerComponent, IconModule],
// eslint-disable-next-line @alfresco/eslint-angular/no-angular-material-selectors
template: ` <adf-alfresco-viewer> template: ` <adf-alfresco-viewer>
<adf-viewer-more-actions> <adf-viewer-more-actions>
<button mat-menu-item> <button mat-menu-item>
-2
View File
@@ -1,2 +0,0 @@
.storybook
coverage
-97
View File
@@ -1,97 +0,0 @@
{
"extends": ["../../.eslintrc.js"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": ["plugin:@nx/angular"],
"parserOptions": {
"project": ["lib/core/tsconfig.lib.json", "lib/core/tsconfig.spec.json", "lib/core/.storybook/tsconfig.json"],
"createDefaultProgram": true
},
"rules": {
"jsdoc/tag-lines": [
"error",
"any",
{
"startLines": 1
}
],
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/consistent-type-assertions": "warn",
"@typescript-eslint/prefer-for-of": "off",
"@typescript-eslint/member-ordering": "off",
"no-underscore-dangle": [
"error",
{
"allowAfterThis": true
}
],
"no-shadow": "warn",
"quote-props": "off",
"object-shorthand": "warn",
"no-restricted-syntax": "warn",
"prefer-const": "warn",
"arrow-body-style": "warn",
"@angular-eslint/no-output-native": "off",
"space-before-function-paren": "off",
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": ["adf", "app"],
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": ["element", "attribute"],
"prefix": ["adf", "app"],
"style": "kebab-case"
}
],
"@angular-eslint/no-input-prefix": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-var-requires": "error",
"comma-dangle": "error",
"default-case": "error",
"import/order": "off",
"max-len": [
"error",
{
"code": 240
}
],
"no-bitwise": "off",
"no-duplicate-imports": "error",
"no-multiple-empty-lines": "error",
"no-return-await": "error",
"rxjs/no-create": "error",
"rxjs/no-subject-unsubscribe": "error",
"rxjs/no-subject-value": "error",
"rxjs/no-unsafe-takeuntil": "error",
"unicorn/filename-case": "error",
"@angular-eslint/prefer-standalone": "off"
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
"rules": {
"@angular-eslint/template/no-autofocus": "error",
"@angular-eslint/template/no-positive-tabindex": "error",
"@angular-eslint/template/no-negated-async": "off"
}
}
]
}
+24
View File
@@ -1,6 +1,24 @@
/*!
* @license
* Copyright © 2005-2026 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path'; import { dirname } from 'node:path';
import type { StorybookConfig } from '@storybook/angular'; import type { StorybookConfig } from '@storybook/angular';
// eslint-disable-next-line @nx/enforce-module-boundaries
import rootMain from '../../../.storybook/main'; import rootMain from '../../../.storybook/main';
const config: StorybookConfig = { const config: StorybookConfig = {
@@ -21,6 +39,12 @@ const config: StorybookConfig = {
export default config; export default config;
/**
* Resolve absolute path for a package.
*
* @param value package name
* @returns absolute path to the package
*/
function getAbsolutePath(value: string): any { function getAbsolutePath(value: string): any {
return dirname(fileURLToPath(import.meta.resolve(`${value}/package.json`))); return dirname(fileURLToPath(import.meta.resolve(`${value}/package.json`)));
} }
+17
View File
@@ -1,3 +1,20 @@
/*!
* @license
* Copyright © 2005-2026 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { Preview } from '@storybook/angular'; import type { Preview } from '@storybook/angular';
import rootPreview from '../../../.storybook/preview'; import rootPreview from '../../../.storybook/preview';
@@ -78,7 +78,7 @@ describe('AdfHttpClient', () => {
.request('http://example.com', options, securityOptions, emitters) .request('http://example.com', options, securityOptions, emitters)
.then((res: ResultListDataRepresentationTaskRepresentation) => { .then((res: ResultListDataRepresentationTaskRepresentation) => {
expect(res instanceof ResultListDataRepresentationTaskRepresentation).toBeTruthy(); expect(res instanceof ResultListDataRepresentationTaskRepresentation).toBeTruthy();
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
expect(res.data![0].created instanceof Date).toBeTruthy(); expect(res.data![0].created instanceof Date).toBeTruthy();
done(); done();
}) })
+71
View File
@@ -0,0 +1,71 @@
/*!
* @license
* Copyright © 2005-2026 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import rootConfig from '../../eslint.config.mjs';
export default [
...rootConfig,
{
files: ['**/*.ts'],
rules: {
'@nx/enforce-module-boundaries': [
'error',
{
enforceBuildableLibDependency: true,
allow: [],
depConstraints: [
{
sourceTag: 'scope:core',
onlyDependOnLibsWithTags: ['scope:js-api', 'scope:extensions']
}
]
}
],
'@typescript-eslint/consistent-type-assertions': 'warn',
'@typescript-eslint/prefer-for-of': 'off',
'no-underscore-dangle': [
'error',
{
allowAfterThis: true
}
],
'no-shadow': 'warn',
'quote-props': 'off',
'object-shorthand': 'warn',
'no-restricted-syntax': 'warn',
'prefer-const': 'warn',
'arrow-body-style': 'warn',
'space-before-function-paren': 'off',
'@angular-eslint/prefer-standalone': 'off'
}
},
{
files: ['**/*.html'],
rules: {
'@angular-eslint/template/no-autofocus': 'error',
'@angular-eslint/template/no-positive-tabindex': 'error',
'@angular-eslint/template/no-negated-async': 'off'
}
},
{
files: ['**/.storybook/**/*.ts'],
rules: {
'@nx/enforce-module-boundaries': 'off'
}
}
];
+1
View File
@@ -4,6 +4,7 @@
"projectType": "library", "projectType": "library",
"sourceRoot": "lib/core", "sourceRoot": "lib/core",
"prefix": "adf", "prefix": "adf",
"tags": ["scope:core", "type:library"],
"targets": { "targets": {
"build": { "build": {
"executor": "@angular/build:ng-packagr", "executor": "@angular/build:ng-packagr",
@@ -16,7 +16,8 @@
*/ */
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AboutLicenseListComponent, UnitTestingUtils } from '@alfresco/adf-core'; import { AboutLicenseListComponent } from './about-license-list.component';
import { UnitTestingUtils } from '../../testing/unit-testing-utils';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
describe('AboutLicenseListComponent', () => { describe('AboutLicenseListComponent', () => {
@@ -16,7 +16,9 @@
*/ */
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AboutRepositoryInfoComponent, RepositoryInfo, UnitTestingUtils } from '@alfresco/adf-core'; import { AboutRepositoryInfoComponent } from './about-repository-info.component';
import { RepositoryInfo } from './repository-info.interface';
import { UnitTestingUtils } from '../../testing/unit-testing-utils';
describe('AboutRepositoryInfoComponent', () => { describe('AboutRepositoryInfoComponent', () => {
let component: AboutRepositoryInfoComponent; let component: AboutRepositoryInfoComponent;
@@ -18,7 +18,7 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AboutServerSettingsComponent } from './about-server-settings.component'; import { AboutServerSettingsComponent } from './about-server-settings.component';
import { AppConfigService } from '../../app-config/app-config.service'; import { AppConfigService } from '../../app-config/app-config.service';
import { provideAppConfigTesting } from '@alfresco/adf-core'; import { provideAppConfigTesting } from '../../testing/app-config-testing';
const aboutGithubDetails = { const aboutGithubDetails = {
url: 'https://github.com/componany/repository/commits/', url: 'https://github.com/componany/repository/commits/',
@@ -26,7 +26,6 @@ import { OauthConfigModel } from '../auth/models/oauth-config.model';
/* spellchecker: disable */ /* spellchecker: disable */
// eslint-disable-next-line no-shadow
export const AppConfigValues = { export const AppConfigValues = {
APP_CONFIG_LANGUAGES_KEY: 'languages', APP_CONFIG_LANGUAGES_KEY: 'languages',
PROVIDERS: 'providers', PROVIDERS: 'providers',
@@ -210,7 +209,6 @@ export class AppConfigService {
this.onDataLoaded(); this.onDataLoaded();
}, },
() => { () => {
// eslint-disable-next-line no-console
console.error('app.config.json contains validation errors'); console.error('app.config.json contains validation errors');
resolve(this.config); resolve(this.config);
} }
@@ -238,7 +236,6 @@ export class AppConfigService {
resolve(res); resolve(res);
}, },
error: (err: any) => { error: (err: any) => {
// eslint-disable-next-line no-console
console.error('hostIdp not correctly configured or unreachable'); console.error('hostIdp not correctly configured or unreachable');
reject(err); reject(err);
} }
@@ -18,7 +18,8 @@
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { OidcAuthenticationService } from './oidc-authentication.service'; import { OidcAuthenticationService } from './oidc-authentication.service';
import { OAuthService, OAuthStorage } from 'angular-oauth2-oidc'; import { OAuthService, OAuthStorage } from 'angular-oauth2-oidc';
import { AppConfigService, AuthService } from '@alfresco/adf-core'; import { AppConfigService } from '../../app-config/app-config.service';
import { AuthService } from './auth.service';
import { AUTH_MODULE_CONFIG } from './auth-config'; import { AUTH_MODULE_CONFIG } from './auth-config';
import { firstValueFrom, of, take, throwError } from 'rxjs'; import { firstValueFrom, of, take, throwError } from 'rxjs';
@@ -21,7 +21,6 @@ import { CardViewItem } from '../interfaces/card-view.interfaces';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Directive() @Directive()
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class BaseCardView<T extends CardViewItem> { export abstract class BaseCardView<T extends CardViewItem> {
protected cardViewUpdateService = inject(CardViewUpdateService); protected cardViewUpdateService = inject(CardViewUpdateService);
@@ -106,7 +106,6 @@ export class CardViewItemDispatcherComponent implements OnChanges {
private proxy(methodName, ...args) { private proxy(methodName, ...args) {
if (this.componentReference.instance[methodName]) { if (this.componentReference.instance[methodName]) {
// eslint-disable-next-line prefer-spread
this.componentReference.instance[methodName].apply(this.componentReference.instance, args); this.componentReference.instance[methodName].apply(this.componentReference.instance, args);
} }
} }
@@ -18,7 +18,9 @@
import { Component, Input } from '@angular/core'; import { Component, Input } from '@angular/core';
import { CardViewPropertyValidatorDirective } from './card-view-property-validator.directive'; import { CardViewPropertyValidatorDirective } from './card-view-property-validator.directive';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CardViewBaseItemModel, CardViewTextItemModel, UnitTestingUtils } from '@alfresco/adf-core'; import { CardViewBaseItemModel } from '../models/card-view-baseitem.model';
import { CardViewTextItemModel } from '../models/card-view-textitem.model';
import { UnitTestingUtils } from '../../testing/unit-testing-utils';
import { FormControl, ReactiveFormsModule } from '@angular/forms'; import { FormControl, ReactiveFormsModule } from '@angular/forms';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
@@ -33,7 +33,7 @@ export class ClipboardDirective {
private readonly translate = inject(TranslateService, { optional: true }); private readonly translate = inject(TranslateService, { optional: true });
/** Translation key or message for the tooltip. */ /** Translation key or message for the tooltip. */
// eslint-disable-next-line @angular-eslint/no-input-rename
@Input('adf-clipboard') @Input('adf-clipboard')
placeholder: string; placeholder: string;
@@ -42,7 +42,7 @@ export class ClipboardDirective {
target: HTMLInputElement | HTMLTextAreaElement; target: HTMLInputElement | HTMLTextAreaElement;
/** Translation key or message for snackbar notification. */ /** Translation key or message for snackbar notification. */
// eslint-disable-next-line @angular-eslint/no-input-rename
@Input('clipboard-notification') message: string; @Input('clipboard-notification') message: string;
@HostListener('mouseenter') @HostListener('mouseenter')
@@ -39,7 +39,6 @@ export class HighlightTransformService {
let result = text; let result = text;
if (search && text) { if (search && text) {
// eslint-disable-next-line no-useless-escape
let pattern = search.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); let pattern = search.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
pattern = pattern pattern = pattern
.split(' ') .split(' ')
@@ -18,7 +18,7 @@
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { AppConfigService } from '../../app-config/app-config.service'; import { AppConfigService } from '../../app-config/app-config.service';
import { StorageService } from '../../common/services/storage.service'; import { StorageService } from '../../common/services/storage.service';
import { provideCoreAuthTesting } from '@alfresco/adf-core'; import { provideCoreAuthTesting } from '../../testing/noop-auth.module';
describe('StorageService', () => { describe('StorageService', () => {
let storage: StorageService; let storage: StorageService;
@@ -19,7 +19,7 @@ import { Component } from '@angular/core';
import { TestBed, ComponentFixture } from '@angular/core/testing'; import { TestBed, ComponentFixture } from '@angular/core/testing';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { UnitTestingUtils } from '../testing/unit-testing-utils'; import { UnitTestingUtils } from '../testing/unit-testing-utils';
import { ContextMenuDirective } from '@alfresco/adf-core'; import { ContextMenuDirective } from './context-menu.directive';
@Component({ @Component({
selector: 'adf-test-component', selector: 'adf-test-component',
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, HostListener, Input, inject } from '@angular/core'; import { Directive, HostListener, Input, inject } from '@angular/core';
import { ContextMenuOverlayService } from './context-menu-overlay.service'; import { ContextMenuOverlayService } from './context-menu-overlay.service';
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/no-conflicting-lifecycle */
import { import {
AfterContentInit, AfterContentInit,
AfterViewInit, AfterViewInit,
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */
import { AfterContentInit, Component, ContentChild, TemplateRef, inject } from '@angular/core'; import { AfterContentInit, Component, ContentChild, TemplateRef, inject } from '@angular/core';
import { DataColumnComponent } from './data-column.component'; import { DataColumnComponent } from './data-column.component';
@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */ /* eslint-disable @angular-eslint/component-selector */
import { Component, ContentChild, Input, OnInit, TemplateRef } from '@angular/core'; import { Component, ContentChild, Input, OnInit, TemplateRef } from '@angular/core';
import { DataColumnType } from '@alfresco/adf-extensions'; import { DataColumnType } from '@alfresco/adf-extensions';
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable id-blacklist */
import { TemplateRef } from '@angular/core'; import { TemplateRef } from '@angular/core';
import { DataColumnType } from '@alfresco/adf-extensions'; import { DataColumnType } from '@alfresco/adf-extensions';
@@ -23,7 +23,6 @@ import { DataColumn } from './data-column.model';
import { ObjectDataColumn } from './object-datacolumn.model'; import { ObjectDataColumn } from './object-datacolumn.model';
@Directive() @Directive()
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class DataTableSchema<T = unknown> { export abstract class DataTableSchema<T = unknown> {
@ContentChild(DataColumnListComponent) @ContentChild(DataColumnListComponent)
columnList: DataColumnListComponent; columnList: DataColumnListComponent;
@@ -16,7 +16,9 @@
*/ */
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AppConfigValues, UnsavedChangesDialogComponent, UserPreferencesService } from '@alfresco/adf-core'; import { AppConfigValues } from '../../app-config/app-config.service';
import { UnsavedChangesDialogComponent } from './unsaved-changes-dialog.component';
import { UserPreferencesService } from '../../common/services/user-preferences.service';
import { DebugElement } from '@angular/core'; import { DebugElement } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogClose } from '@angular/material/dialog'; import { MAT_DIALOG_DATA, MatDialogClose } from '@angular/material/dialog';
import { UnsavedChangesDialogData } from './unsaved-changes-dialog.model'; import { UnsavedChangesDialogData } from './unsaved-changes-dialog.model';
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, ElementRef, Input, Renderer2, AfterViewChecked, inject } from '@angular/core'; import { Directive, ElementRef, Input, Renderer2, AfterViewChecked, inject } from '@angular/core';
import { HighlightTransformService, HighlightTransformResult } from '../common/services/highlight-transform.service'; import { HighlightTransformService, HighlightTransformResult } from '../common/services/highlight-transform.service';
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, ElementRef, HostListener, Input, NgZone, OnDestroy, OnInit, Renderer2, inject } from '@angular/core'; import { Directive, ElementRef, HostListener, Input, NgZone, OnDestroy, OnInit, Renderer2, inject } from '@angular/core';
import { FileInfo, FileUtils } from '../common/utils/file-utils'; import { FileInfo, FileUtils } from '../common/utils/file-utils';
@@ -22,7 +22,6 @@ import { isOutcomeButtonVisible } from './helpers/buttons-visibility';
@Directive({ @Directive({
standalone: true standalone: true
}) })
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class FormBaseComponent { export abstract class FormBaseComponent {
protected _form: FormModel; protected _form: FormModel;
@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */ /* eslint-disable @angular-eslint/component-selector */
import { NgClass, NgIf } from '@angular/common'; import { NgClass, NgIf } from '@angular/common';
import { Component, ViewEncapsulation } from '@angular/core'; import { Component, ViewEncapsulation } from '@angular/core';
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/component-selector */
import { FormFieldModel } from './form-field.model'; import { FormFieldModel } from './form-field.model';
import { FormWidgetModel } from './form-widget.model'; import { FormWidgetModel } from './form-widget.model';
import { ContainerColumnModel } from './container-column.model'; import { ContainerColumnModel } from './container-column.model';
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/component-selector */
export class ContentLinkModel { export class ContentLinkModel {
contentAvailable: boolean; contentAvailable: boolean;
created: Date; created: Date;
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/component-selector */
export interface DisplayableCMProperties { export interface DisplayableCMProperties {
name?: string; name?: string;
prefixedName?: string; prefixedName?: string;
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/component-selector */
export class ErrorMessageModel { export class ErrorMessageModel {
message: string = ''; message: string = '';
attributes: Map<string, string> = null; attributes: Map<string, string> = null;
@@ -15,8 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable @angular-eslint/component-selector */
export interface ExternalContentLink { export interface ExternalContentLink {
contentAvailable: boolean; contentAvailable: boolean;
created: string; created: string;

Some files were not shown because too many files have changed in this diff Show More