Skip to content

Commit

Permalink
[ACA-4695] Fix saving screenshots for E2Es, add nx eslint plugin (#3148)
Browse files Browse the repository at this point in the history
* [ACA-4695] Fix saving screenshots for E2Es, add nx eslint plugin

* [ACA-4695] Improve eslint rules
  • Loading branch information
MichalKinas committed Apr 26, 2023
1 parent 42479d9 commit 5fa5ac4
Show file tree
Hide file tree
Showing 17 changed files with 277 additions and 33 deletions.
197 changes: 173 additions & 24 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"ignorePatterns": [
"projects/**/*"
],
"plugins": ["@nrwl/nx"],
"overrides": [
{
"files": [
Expand All @@ -12,8 +13,8 @@
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/ng-cli-compat",
"plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
"plugin:@nrwl/nx/typescript",
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates",
"plugin:@cspell/recommended"
],
Expand All @@ -23,7 +24,12 @@
"prettier",
"ban",
"@cspell",
"license-header"
"license-header",
"eslint-plugin-import",
"@angular-eslint/eslint-plugin",
"eslint-plugin-unicorn",
"eslint-plugin-rxjs",
"@typescript-eslint"
],
"rules": {
"ban/ban": [
Expand Down Expand Up @@ -67,14 +73,6 @@
"prettier/prettier": "error",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"prefer-arrow/prefer-arrow-functions": [
"warn",
{
"disallowPrototype": true,
"singleReturnOnly": true,
"classPropertiesAllowed": false
}
],
"@angular-eslint/component-selector": [
"error",
{
Expand All @@ -95,10 +93,33 @@
"style": "camelCase"
}
],
"@angular-eslint/component-class-suffix": "error",
"@angular-eslint/directive-class-suffix": "error",
"@angular-eslint/no-conflicting-lifecycle": "error",
"@typescript-eslint/no-floating-promises": "off",
"@angular-eslint/no-input-rename": "error",
"@angular-eslint/no-output-native": "error",
"@angular-eslint/no-output-on-prefix": "error",
"@angular-eslint/no-output-rename": "error",
"@angular-eslint/no-host-metadata-property": "off",
"@angular-eslint/no-outputs-metadata-property": "error",
"@angular-eslint/use-lifecycle-interface": "error",
"@angular-eslint/use-pipe-transform-interface": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/unified-signatures": "error",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/member-ordering": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
Expand All @@ -118,10 +139,7 @@
}
}
],
"@typescript-eslint/semi": [
"off",
null
],
"@typescript-eslint/semi": ["error", "always"],
"@typescript-eslint/naming-convention": [
"error",
{
Expand All @@ -131,32 +149,153 @@
]
}
],
"@typescript-eslint/type-annotation-spacing": "off",
"@typescript-eslint/no-inferrable-types": [
"error",
{
"ignoreParameters": true
}
],
"@typescript-eslint/quotes": [
"error",
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"@typescript-eslint/type-annotation-spacing": "error",
"arrow-parents": [
"off",
"always"
],
"brace-style": [
"off",
"off"
"error",
"1tbs",
{
"allowSingleLine": true
}
],
"eol-last": "off",
"constructor-super": "error",
"curly": "error",
"dot-notation": "off",
"eol-last": "error",
"eqeqeq": ["error", "smart"],
"guard-for-in": "error",
"id-blacklist": "off",
"id-match": "off",
"id-denylist": "off",
"import/no-deprecated": "error",
"linebreak-style": "off",
"max-len": "off",
"new-parens": "off",
"newline-per-chained-call": "off",
"prefer-rest-params": "error",
"prefer-spread": "error",
"import/order": "off",
"max-len": [
"error",
{
"code": 180
}
],
"no-duplicate-imports": "error",
"no-extra-semi": "off",
"no-irregular-whitespace": "off",
"no-empty": "off",
"no-empty-function": "off",
"no-irregular-whitespace": "error",
"no-return-await": "error",
"no-underscore-dangle": "off",
"no-useless-escape": "off",
"no-prototype-builtins": "error",
"no-async-promise-executor": "warn",
"no-unsafe-optional-chaining": "warn",
"no-bitwise": "error",
"no-caller": "error",
"no-global-assign": "error",
"no-cond-assign": "error",
"no-console": [
"error",
{
"allow": [
"warn",
"dir",
"timeLog",
"assert",
"clear",
"count",
"countReset",
"group",
"groupEnd",
"table",
"dirxml",
"error",
"groupCollapsed",
"Console",
"profile",
"profileEnd",
"timeStamp",
"context"
]
}
],
"no-case-declarations": "error",
"no-debugger": "error",
"no-constant-condition": "error",
"no-eval": "error",
"no-regex-spaces": "error",
"no-extra-boolean-cast": "error",
"no-fallthrough": "error",
"no-multiple-empty-lines": "error",
"no-new-wrappers": "error",
"no-restricted-imports": ["error", "rxjs/Rx"],
"no-self-assign": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-unused-labels": "error",
"no-var": "error",
"prefer-const": "error",
"quote-props": "off",
"quotes": "off",
"radix": "error",
"rxjs/no-create": "error",
"rxjs/no-subject-unsubscribe": "error",
"rxjs/no-subject-value": "error",
"rxjs/no-unsafe-takeuntil": "error",
"rxjs/ban-operators": "error",
"rxjs/no-ignored-subscribe": "error",
"rxjs/no-unsafe-catch": [
"error",
{
"observable": "action(s|\\$)?"
}
],
"rxjs/no-unsafe-switchmap": [
"error",
{
"disallow": [
"add",
"create",
"delete",
"post",
"put",
"remove",
"set",
"update"
],
"observable": "action(s|\\$)?"
}
],
"semi": "error",
"use-isnan": "error",

"spaced-comment": [
"error",
"always",
{
"markers": ["/"],
"exceptions": ["!", "*"]
}
],
"space-before-function-paren": "off",
"space-in-parens": [
"off",
Expand All @@ -165,13 +304,16 @@
"unicorn/filename-case": "error"
}
},
{
"files": ["*.js"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"extends": ["plugin:@nrwl/nx/angular-template"],
"rules": {
"@angular-eslint/template/no-autofocus": "error",
"@angular-eslint/template/no-negated-async": "off",
Expand All @@ -186,6 +328,13 @@
"@angular-eslint/template/accessibility-label-has-associated-control": "error",
"@angular-eslint/template/eqeqeq": "error"
}
},
{
"files": ["*.spec.ts", "*.test.ts"],
"rules": {
"@typescript-eslint/no-floating-promises": "off",
"max-lines": "off"
}
}
]
}
7 changes: 7 additions & 0 deletions .github/actions/run-e2e/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,10 @@ runs:
echo "./node_modules/.bin/protractor \"./protractor.conf.js\" ${{ inputs.options }} || exit 1"
./node_modules/.bin/protractor "./protractor.conf.js" ${{ inputs.options }} $E2E_PROTRACTOR_OPTS || exit 1
fi
- name: Upload E2Es results
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.options }}
path: test-results/
3 changes: 3 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ env:
APP_CONFIG_ECM_HOST: ${{ secrets.PIPELINE_ENV_URL }}
ADMIN_EMAIL: ${{ secrets.PIPELINE_ADMIN_USERNAME }}
ADMIN_PASSWORD: ${{ secrets.PIPELINE_ADMIN_PASSWORD }}
SCREENSHOT_USERNAME: ${{ secrets.SCREENSHOT_USERNAME }}
SCREENSHOT_PASSWORD: ${{ secrets.SCREENSHOT_PASSWORD}}
AWS_REGION: "eu-west-2"
CONTENT_CE_DIST_PATH: "./dist/content-ce"
APP_CONFIG_PROVIDER: ECM
Expand All @@ -36,6 +38,7 @@ env:
APP_CONFIG_DOWNLOAD_PROMPT_REMINDER_DELAY: 30
APP_CONFIG_ENABLE_FILE_AUTO_DOWNLOAD: true
APP_CONFIG_FILE_AUTO_DOWNLOAD_SIZE_THRESHOLD_IN_MB: 15
GH_BUILD_NUMBER: ${{ github.run_id }}

jobs:
lint:
Expand Down
2 changes: 1 addition & 1 deletion app/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ if (environment.production) {
enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule);
void platformBrowserDynamic().bootstrapModule(AppModule);
1 change: 1 addition & 0 deletions e2e/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"unicorn"
],
"rules": {
"@typescript-eslint/no-floating-promises": "off"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion e2e/e2e-config/utils/upload-output.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const buildNumber = require('./build-number');
const outputDir = path.resolve(__dirname, '../../../e2e-output/');

async function saveScreenshots(retryCount) {
const folderName = process.env.TRAVIS_JOB_NAME.replace(/[^a-z0-9]/gi, '_').toLowerCase();
const folderName = process.env.GITHUB_JOB;
console.log(`Start uploading report in ${folderName}`);

let alfrescoJsApi = new AlfrescoApi({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const test = base.extend<Pages & Api>({
nodesPage: async ({ page }, use) => {
await use(new NodesPage(page));
},
// eslint-disable-next-line no-empty-pattern
apiClient: async ({}, use) => {
const apiClient = new ApiClientFactory();
await apiClient.setUpAcaBackend('admin');
Expand Down

0 comments on commit 5fa5ac4

Please sign in to comment.