Skip to content

Commit

Permalink
[AAE-7100] migrate ADF projects to eslint (#7483)
Browse files Browse the repository at this point in the history
* migrate content services to eslint

* migrate insights to eslint

* migrate extensions to eslint

* migrate testing lib to eslint

* migrate CLI to eslint

* migrate process-services to eslint

* migrate process-services-cloud to eslint

* remove cli analytics [ci:force]
  • Loading branch information
DenysVuika committed Feb 3, 2022
1 parent b8bb234 commit 8dc736e
Show file tree
Hide file tree
Showing 233 changed files with 1,496 additions and 725 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"parserOptions": {
"project": [
"tsconfig.json",
"e2e/tsconfig.json"
"e2e/tsconfig.e2e.json"
],
"createDefaultProgram": true
},
Expand Down
110 changes: 34 additions & 76 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -507,19 +507,11 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": [
"lib/content-services/tsconfig.lib.json",
"lib/content-services/tsconfig.spec.json"
],
"exclude": [
"**/lib/extensions/**/*",
"**/lib/core/**/*",
"**/lib/insights/**/*",
"**/lib/process-services-cloud/**/*",
"**/lib/process-services/**/*",
"**/node_modules/**"
"lintFilePatterns": [
"lib/content-services/**/*.ts",
"lib/content-services/**/*.html"
]
}
},
Expand Down Expand Up @@ -588,19 +580,11 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": [
"lib/process-services/tsconfig.lib.json",
"lib/process-services/tsconfig.spec.json"
],
"exclude": [
"**/lib/extensions/**/*",
"**/lib/core/**/*",
"**/lib/insights/**/*",
"**/lib/process-services-cloud/**/*",
"**/lib/content-services/**/*",
"**/node_modules/**"
"lintFilePatterns": [
"lib/process-services/**/*.ts",
"lib/process-services/**/*.html"
]
}
}
Expand Down Expand Up @@ -636,19 +620,11 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": [
"lib/process-services-cloud/tsconfig.lib.json",
"lib/process-services-cloud/tsconfig.spec.json"
],
"exclude": [
"**/lib/extensions/**/*",
"**/lib/core/**/*",
"**/lib/insights/**/*",
"**/lib/process-services/**/*",
"**/lib/content-services/**/*",
"**/node_modules/**"
"lintFilePatterns": [
"lib/process-services-cloud/**/*.ts",
"lib/process-services-cloud/**/*.html"
]
}
},
Expand Down Expand Up @@ -717,19 +693,11 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": [
"lib/insights/tsconfig.lib.json",
"lib/insights/tsconfig.spec.json"
],
"exclude": [
"**/lib/extensions/**/*",
"**/lib/core/**/*",
"**/lib/process-services-cloud/**/*",
"**/lib/process-services/**/*",
"**/lib/content-services/**/*",
"**/node_modules/**"
"lintFilePatterns": [
"lib/insights/**/*.ts",
"lib/insights/**/*.html"
]
}
}
Expand Down Expand Up @@ -764,19 +732,11 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": [
"lib/extensions/tsconfig.lib.json",
"lib/extensions/tsconfig.spec.json"
],
"exclude": [
"**/lib/core/**/*",
"**/lib/content-services/**/*",
"**/lib/process-services/**/*",
"**/lib/process-services-cloud/**/*",
"**/lib/insights/**/*",
"**/node_modules/**"
"lintFilePatterns": [
"lib/extensions/**/*.ts",
"lib/extensions/**/*.html"
]
}
}
Expand All @@ -801,19 +761,11 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": [
"lib/testing/tsconfig.lib.json",
"lib/testing/tsconfig.spec.json"
],
"exclude": [
"**/lib/core/**/*",
"**/lib/content-services/**/*",
"**/lib/process-services/**/*",
"**/lib/process-services-cloud/**/*",
"**/lib/insight/**/*",
"**/node_modules/**"
"lintFilePatterns": [
"lib/testing/**/*.ts",
"lib/testing/**/*.html"
]
}
}
Expand All @@ -835,6 +787,15 @@
"tsConfig": "lib/cli/tsconfig.lib.prod.json"
}
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"lib/cli/**/*.ts",
"lib/cli/**/*.html"
]
}
}
}
},
Expand Down Expand Up @@ -879,8 +840,5 @@
}
}
},
"defaultProject": "demoshell",
"cli": {
"analytics": "0ce5075f-0835-439a-bebe-7c41750179a6"
}
"defaultProject": "demoshell"
}
104 changes: 104 additions & 0 deletions lib/cli/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"extends": "../../.eslintrc.json",
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"lib/cli/tsconfig.json"
],
"createDefaultProgram": true
},
"plugins": [
"eslint-plugin-unicorn",
"eslint-plugin-rxjs"
],
"rules": {
"prefer-arrow/prefer-arrow-functions": "warn",
"@typescript-eslint/no-var-requires": "warn",
"@typescript-eslint/naming-convention": "warn",
"quote-props": "warn",
"no-shadow": "warn",
"@typescript-eslint/consistent-type-assertions": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"no-underscore-dangle": "warn",

"@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",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-require-imports": "off",
"brace-style": [
"error",
"1tbs"
],
"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-redeclare": "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"
}
},
{
"files": [
"*.html"
],
"rules": {
"@angular-eslint/template/no-autofocus": "error",
"@angular-eslint/template/no-positive-tabindex": "error"
}
}
]
}
2 changes: 1 addition & 1 deletion lib/cli/scripts/artifact-from-s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function zipArtifact(output: string) {
logger.info(response);
}

export default function () {
export default function() {
main();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/cli/scripts/artifact-to-s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function awsCp(output: string) {
logger.info(response);
}

export default function () {
export default function() {
main();
}

Expand Down
4 changes: 2 additions & 2 deletions lib/cli/scripts/audit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function main(_args: string[], workingDir: string) {
}

return new Promise((resolve, reject) => {
// tslint:disable-next-line: no-console
// eslint-disable-next-line no-console
console.log(`Running audit on ${packagePath}`);

const packageJson = JSON.parse(fs.readFileSync(packagePath).toString());
Expand All @@ -75,7 +75,7 @@ export default function main(_args: string[], workingDir: string) {

fs.writeFileSync(outputFile, mdText);

// tslint:disable-next-line: no-console
// eslint-disable-next-line no-console
console.log(`Report saved as ${outputFile}`);
resolve(0);
}
Expand Down
4 changes: 3 additions & 1 deletion lib/cli/scripts/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ interface DiffOptions {

/**
* Get the remote URL for the cloned git repository
*
* @param workingDir Repository directory
* @returns URL pointing to the git remote
*/
Expand All @@ -68,6 +69,7 @@ function getRemote(workingDir: string): string {

/**
* Get the list of commits based on the configuration options
*
* @param options Logging options
* @returns Collection of Commit objects
*/
Expand All @@ -78,7 +80,7 @@ function getCommits(options: DiffOptions): Array<Commit> {
.join('\|');

if (!authorFilter) {
authorFilter = "bot\|Alfresco Build User";
authorFilter = `bot\|Alfresco Build User`;
}


Expand Down
4 changes: 2 additions & 2 deletions lib/cli/scripts/check-cs-env.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* tslint:disable */
/* eslint-disable */
const alfrescoApi = require('@alfresco/js-api');
const program = require('commander');
const path = require('path');
const fs = require('fs');
/* tslint:enable */
/* eslint-enable */
import { logger } from './logger';
const MAX_RETRY = 3;
const TIMEOUT = 20000;
Expand Down
4 changes: 2 additions & 2 deletions lib/cli/scripts/check-ps-env.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* tslint:disable */
/* eslint-disable */
const alfrescoApi = require('@alfresco/js-api');
const program = require('commander');
/* tslint:enable */
/* eslint-enable */
import { logger } from './logger';
const MAX_RETRY = 10;
const TIMEOUT = 60000;
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/scripts/docker-publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@

import * as docker from './docker';

export default function (args: any) {
export default function(args: any) {
docker.default(args);
}
6 changes: 3 additions & 3 deletions lib/cli/scripts/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ function loginPerform(args: PublishArgs) {
function buildImagePerform(args: PublishArgs, tag: string) {
logger.info(`Perform docker build...${args.dockerRepo}:${tag}`);

let buildArgs = [];
const buildArgs = [];

if (typeof args.buildArgs === "string") {
if (typeof args.buildArgs === 'string') {
buildArgs.push(`--build-arg=${args.buildArgs}`);
} else {
args.buildArgs.forEach((envVar) => {
Expand Down Expand Up @@ -88,7 +88,7 @@ function cleanImagePerform(args: PublishArgs, tag: string) {
logger.info(response);
}

export default function (args: PublishArgs) {
export default function(args: PublishArgs) {
main(args);
}

Expand Down

0 comments on commit 8dc736e

Please sign in to comment.