Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(linter): fix eslint configuration #864

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 6 additions & 19 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
plugins: [
'prettier',
'@nx/eslint-plugin',
'@stylistic',
'unicorn', // https://www.npmjs.com/package/eslint-plugin-unicorn
],

Expand Down Expand Up @@ -239,9 +240,13 @@ module.exports = {
],
rules: {
'@nx/enforce-module-boundaries': ['error', nxModuleBoundaryRules],
'@stylistic/brace-style': 'error',
'@stylistic/comma-spacing': ['error', { before: false, after: true }],
'@stylistic/lines-between-class-members': ['error', 'always', { exceptAfterOverload: true }],
'@stylistic/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-comment': 'error',
'@typescript-eslint/ban-types': [
'@typescript-eslint/no-restricted-types': [
'error',
{
types: {
Expand All @@ -253,8 +258,6 @@ module.exports = {
},
},
],
'@typescript-eslint/brace-style': ['error'],
'@typescript-eslint/comma-spacing': ['error'],
'@typescript-eslint/consistent-type-definitions': 'error',
'@typescript-eslint/default-param-last': ['error'],
'@typescript-eslint/explicit-function-return-type': 'off', // keep off
Expand All @@ -265,13 +268,6 @@ module.exports = {
ignoredMethodNames: ['constructor'],
},
],
'@typescript-eslint/lines-between-class-members': [
'error',
'always',
{
exceptAfterOverload: true,
},
],
'@typescript-eslint/member-ordering': [
'error',
{
Expand Down Expand Up @@ -325,7 +321,6 @@ module.exports = {
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-throw-literal': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': [
'error',
Expand Down Expand Up @@ -394,14 +389,6 @@ module.exports = {
ignoreStatic: true,
},
],
'@typescript-eslint/quotes': [
'error',
'single',
{
avoidEscape: true,
allowTemplateLiterals: true,
},
],
'rxjs/ban-observables': 'off', // keep off
'rxjs/ban-operators': 'off', // keep off
'rxjs/no-async-subscribe': 'error',
Expand Down
34 changes: 23 additions & 11 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
projects-build: ${{ steps.check-projects-build.outputs.projects }}
projects-build-storybook: ${{ steps.check-projects-build-storybook.outputs.projects }}
changes: ${{ steps.check-changes.outputs.changes }}
success: ${{ steps.check.outputs.success || 'true' }}

steps:
- name: Checkout sources
Expand Down Expand Up @@ -74,6 +75,11 @@ jobs:
premerge: 'true'
trunk: 'main'

- name: Set failure
id: check
if: failure()
run: echo "success=$(echo 'false')" >> $GITHUB_OUTPUT

lint:
needs: checks
runs-on: ubuntu-latest
Expand All @@ -100,14 +106,16 @@ jobs:
- name: Set failure
id: check
if: failure()
run: echo "success='false'" >> $GITHUB_OUTPUT
run: echo "success=$(echo 'false')" >> $GITHUB_OUTPUT

lint-affected:
needs: checks
if: needs.checks.outputs.projects != '[]'
runs-on: ubuntu-latest

strategy:
fail-fast: false
max-parallel: 40
matrix:
projects: ${{ fromJSON(needs.checks.outputs.projects) }}

Expand Down Expand Up @@ -136,7 +144,7 @@ jobs:
- name: Set failure
id: check
if: failure()
run: echo "success='false'" >> $GITHUB_OUTPUT
run: echo "success=$(echo 'false')" >> $GITHUB_OUTPUT

test:
needs: checks
Expand All @@ -163,14 +171,16 @@ jobs:
- name: Set failure
id: check
if: failure()
run: echo "success='false'" >> $GITHUB_OUTPUT
run: echo "success=(echo 'false')" >> $GITHUB_OUTPUT

test-affected:
needs: checks
if: needs.checks.outputs.projects != '[]'
runs-on: ubuntu-latest

strategy:
fail-fast: false
max-parallel: 40
matrix:
projects: ${{ fromJSON(needs.checks.outputs.projects) }}

Expand All @@ -196,7 +206,7 @@ jobs:
- name: Set failure
id: check
if: failure()
run: echo "success='false'" >> $GITHUB_OUTPUT
run: echo "success=(echo 'false')" >> $GITHUB_OUTPUT

build:
needs: checks
Expand All @@ -222,14 +232,16 @@ jobs:
- name: Set failure
id: check
if: failure()
run: echo "success='false'" >> $GITHUB_OUTPUT
run: echo "success=(echo 'false')" >> $GITHUB_OUTPUT

build-affected:
needs: checks
if: needs.checks.outputs.projects-build != '[]'
runs-on: ubuntu-latest

strategy:
fail-fast: false
max-parallel: 40
matrix:
projects: ${{ fromJSON(needs.checks.outputs.projects-build) }}

Expand All @@ -252,14 +264,16 @@ jobs:
- name: Set failure
id: check
if: failure()
run: echo "success='false'" >> $GITHUB_OUTPUT
run: echo "success=(echo 'false')" >> $GITHUB_OUTPUT

build-affected-storybook:
needs: checks
if: needs.checks.outputs.projects-build-storybook != '[]'
runs-on: ubuntu-latest

strategy:
fail-fast: false
max-parallel: 40
matrix:
projects: ${{ fromJSON(needs.checks.outputs.projects-build-storybook) }}

Expand All @@ -276,16 +290,13 @@ jobs:
- name: Setup environment
uses: ./.github/actions/setup-environment

- name: Build affected
run: npx nx run-many --target build --projects origin/main

- name: Build storybook affected
run: npx nx run-many --target build-storybook --projects ${{ matrix.projects }}

- name: Set failure
id: check
if: failure()
run: echo "success='false'" >> $GITHUB_OUTPUT
run: echo "success=(echo 'false')" >> $GITHUB_OUTPUT

premerge:
needs: [checks, lint, lint-affected, test, test-affected, build, build-affected, build-affected-storybook]
Expand All @@ -295,9 +306,10 @@ jobs:
steps:
- name: Check result
run: |
if [[ "$LINT_RESULT" != "true" || "$LINT_AFFECTED_RESULT" != "true" || "$TEST_RESULT" != "true" || "$TEST_AFFECTED_RESULT" != "true" || "$BUILD_RESULT" != "true" || "$BUILD_AFFECTED_RESULT" != "true" || "$BUILD_AFFECTED_STORYBOOK_RESULT" != "true" ]]; then exit 1; fi
if [[ "$CHECKS_RESULT" != "true" || "$LINT_RESULT" != "true" || "$LINT_AFFECTED_RESULT" != "true" || "$TEST_RESULT" != "true" || "$TEST_AFFECTED_RESULT" != "true" || "$BUILD_RESULT" != "true" || "$BUILD_AFFECTED_RESULT" != "true" || "$BUILD_AFFECTED_STORYBOOK_RESULT" != "true" ]]; then exit 1; fi
echo "### :rocket: Premerge checks succeeded" >> $GITHUB_STEP_SUMMARY
env:
CHECKS_RESULT: ${{ needs.checks.outputs.success }}
LINT_RESULT: ${{ needs.lint.outputs.success }}
LINT_AFFECTED_RESULT: ${{ needs.lint-affected.outputs.success || 'true' }}
TEST_RESULT: ${{ needs.test.outputs.success }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { HttpTestingController } from '@angular/common/http/testing';
import { TestBed, TestModuleMetadata, waitForAsync } from '@angular/core/testing';
import { Router } from '@angular/router';
import { ApolloLink, Operation, ServerError, ServerParseError } from '@apollo/client/core';
import { GraphQLErrors, NetworkError } from '@apollo/client/errors';
import { NetworkError } from '@apollo/client/errors';
import { ErrorResponse } from '@apollo/client/link/error';
import { flushHttpRequests, getTestBedConfig, newTestBedMetadata } from '@app/client-testing-unit';
import { AppTranslateModule } from '@app/client-translate';
import { HTTP_STATUS, IWebClientAppEnvironment, WEB_CLIENT_APP_ENV } from '@app/client-util';
import { Store } from '@ngrx/store';
import { Apollo, ApolloModule, gql } from 'apollo-angular';
import { GraphQLError } from 'graphql';
import { GraphQLError, GraphQLFormattedError } from 'graphql';
import { Observable, of, throwError } from 'rxjs';
import { catchError, finalize, tap } from 'rxjs/operators';

Expand Down Expand Up @@ -200,7 +200,7 @@ describe('AppHttpHandlersService', () => {
},
};
const errorRes = <ErrorResponse>{
graphQLErrors: <GraphQLErrors>[testErrorNoCode, testError],
graphQLErrors: <ReadonlyArray<GraphQLFormattedError>>[testErrorNoCode, testError],
networkError: void 0,
};
service.gqlErrorLinkHandler(errorRes);
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@app/nx-ng-starter",
"version": "8.0.6",
"version": "8.0.7",
"private": true,
"description": "Monorepo starter: Nx, Angular, Angular Elements, Electron, NodeJS, NestJS, Firebase.",
"license": "MIT",
Expand Down Expand Up @@ -225,6 +225,7 @@
"@storybook/manager-api": "8.2.9",
"@storybook/preview-api": "8.2.9",
"@storybook/theming": "8.2.9",
"@stylistic/eslint-plugin": "2.6.4",
"@swc-node/register": "1.10.9",
"@swc/cli": "0.4.0",
"@swc/core": "1.7.11",
Expand Down
Loading
Loading