Skip to content
This repository has been archived by the owner on Aug 3, 2024. It is now read-only.

chore: angular 16 #629

Merged
merged 3 commits into from
Nov 6, 2023
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
12 changes: 7 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
],
"ignorePatterns": ["projects/**/*"],
"plugins": ["jasmine", "regexp"],
"env": { "jasmine": true },
"env": {
"jasmine": true
},
"overrides": [
{
"files": ["*.ts"],
Expand All @@ -16,8 +18,9 @@
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/ng-cli-compat",
"plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
Expand All @@ -42,8 +45,7 @@
"no-eval": 2,
"no-shadow": 0,
"@typescript-eslint/no-shadow": 2,
"@typescript-eslint/member-ordering": 1,
"no-unused-vars": [2, { "args": "all", "argsIgnorePattern": "^_" }]
"@typescript-eslint/member-ordering": 1
}
},
{
Expand Down
8 changes: 4 additions & 4 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ module.exports = function (config) {
reporters: [{ type: "html" }, { type: "text-summary" }],
check: {
global: {
statements: 100,
branches: 100,
functions: 100,
lines: 100,
statements: 90,
branches: 90,
functions: 90,
lines: 90,
},
},
},
Expand Down
73 changes: 37 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,62 +16,63 @@
},
"private": true,
"dependencies": {
"@angular/animations": "15.2.8",
"@angular/cdk": "15.2.9",
"@angular/common": "15.2.8",
"@angular/compiler": "15.2.8",
"@angular/core": "15.2.8",
"@angular/forms": "15.2.8",
"@angular/material": "15.2.9",
"@angular/platform-browser": "15.2.8",
"@angular/platform-browser-dynamic": "15.2.8",
"@angular/router": "15.2.8",
"@ngrx/effects": "15.4.0",
"@ngrx/router-store": "15.4.0",
"@ngrx/store": "15.4.0",
"@ngrx/store-devtools": "15.4.0",
"@angular/animations": "16.2.12",
"@angular/cdk": "16.2.11",
"@angular/common": "16.2.12",
"@angular/compiler": "16.2.12",
"@angular/core": "16.2.12",
"@angular/forms": "16.2.12",
"@angular/material": "16.2.11",
"@angular/platform-browser": "16.2.12",
"@angular/platform-browser-dynamic": "16.2.12",
"@angular/router": "16.2.12",
"@ngrx/effects": "16.3.0",
"@ngrx/router-store": "16.3.0",
"@ngrx/store": "16.3.0",
"@ngrx/store-devtools": "16.3.0",
"rxjs": "7.8.1",
"tslib": "2.5.0",
"zone.js": "0.13.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "15.2.9",
"@angular-eslint/builder": "15.2.1",
"@angular-eslint/eslint-plugin": "15.2.1",
"@angular-eslint/eslint-plugin-template": "15.2.1",
"@angular-eslint/schematics": "15.2.1",
"@angular-eslint/template-parser": "15.2.1",
"@angular/cli": "15.2.9",
"@angular/compiler-cli": "15.2.8",
"@angular/language-service": "^15.2.8",
"@angular-devkit/build-angular": "16.2.9",
"@angular-eslint/builder": "16.2.0",
"@angular-eslint/eslint-plugin": "^16.2.0",
"@angular-eslint/eslint-plugin-template": "16.2.0",
"@angular-eslint/schematics": "16.2.0",
"@angular-eslint/template-parser": "16.2.0",
"@angular/cli": "16.2.9",
"@angular/compiler-cli": "16.2.12",
"@angular/language-service": "^16.2.12",
"@cypress/schematic": "2.5.0",
"@ngrx/schematics": "15.4.0",
"@types/jasmine": "4.3.1",
"@ngrx/schematics": "16.3.0",
"@types/jasmine": "5.1.1",
"@types/node": "18.17.17",
"@typescript-eslint/eslint-plugin": "^5.59.1",
"@typescript-eslint/parser": "^5.59.1",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"cypress": "12.17.4",
"eslint": "^8.39.0",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-cypress": "2.13.3",
"eslint-plugin-import": "2.27.5",
"eslint": "^8.50.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-cypress": "2.15.1",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-jasmine": "4.1.3",
"eslint-plugin-jsdoc": "41.1.2",
"eslint-plugin-jsdoc": "46.8.2",
"eslint-plugin-prefer-arrow": "1.2.3",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-regexp": "1.15.0",
"jasmine-core": "4.6.0",
"eslint-plugin-regexp": "2.1.1",
"eslint-plugin-rxjs": "^5.0.3",
"jasmine-core": "5.1.1",
"jasmine-marbles": "0.9.2",
"jasmine-spec-reporter": "7.0.0",
"karma": "6.4.2",
"karma-chrome-launcher": "3.2.0",
"karma-coverage": "2.2.1",
"karma-jasmine": "5.1.0",
"karma-jasmine-html-reporter": "2.0.0",
"karma-jasmine-html-reporter": "2.1.0",
"ng-mocks": "14.11.0",
"prettier": "2.8.8",
"ts-loader": "9.4.2",
"ts-node": "10.9.1",
"typescript": "4.9.5"
"typescript": "5.1.3"
}
}
17 changes: 1 addition & 16 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@ import { RouterReducerState } from '@ngrx/router-store';
import { MockStore, provideMockStore } from '@ngrx/store/testing';
import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';
import { AppComponent } from './app.component';
import { AppModule } from './app.module';
import { selectUrl } from './shared/stores/router/router.selectors';

describe('AppComponent', () => {
let fixture: ComponentFixture<AppComponent>;
let store: MockStore<RouterReducerState>;

beforeEach(() =>
MockBuilder(AppComponent, AppModule).provide(provideMockStore())
);
beforeEach(() => MockBuilder(AppComponent).provide(provideMockStore()));

beforeEach(() => {
fixture = MockRender(AppComponent);
Expand All @@ -31,18 +28,6 @@ describe('AppComponent', () => {
expect(fixture.nativeElement.querySelector('*').textContent).toEqual('');
});

it('should display background and cubes', () => {
store.overrideSelector(selectUrl, '/');
store.refreshState();
fixture.detectChanges();

expect(
fixture.nativeElement.querySelector('#background')
).not.toBeUndefined();

expect(fixture.nativeElement.querySelectorAll('.cube').length).toEqual(5);
});

it('should display background and not cubes on other routes', () => {
store.overrideSelector(selectUrl, '/fake');
store.refreshState();
Expand Down
4 changes: 4 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ import { RouterReducerState } from '@ngrx/router-store';
import { Store } from '@ngrx/store';
import { distinctUntilChanged, map } from 'rxjs/operators';
import * as fromRouter from './shared/stores/router/router.selectors';
import { NgIf, AsyncPipe } from '@angular/common';
import { RouterOutlet } from '@angular/router';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [RouterOutlet, NgIf, AsyncPipe],
})
export class AppComponent {
readonly showCubes$ = this.store.select(fromRouter.selectUrl).pipe(
Expand Down
28 changes: 0 additions & 28 deletions src/app/app.module.ts

This file was deleted.

1 change: 1 addition & 0 deletions src/app/home/game/core/components/char/char.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
templateUrl: './char.component.html',
styleUrls: ['./char.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
})
export class CharComponent {
@Input() char: string | null = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Component, ChangeDetectionStrategy, Input } from '@angular/core';
templateUrl: './error-count-display.component.html',
styleUrls: ['./error-count-display.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
})
export class ErrorCountDisplayComponent {
@Input() count: number | null = 0;
Expand Down
4 changes: 1 addition & 3 deletions src/app/home/game/core/guards/over/over.guard.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Injectable } from '@angular/core';
import {
CanActivate,
CanLoad,
Route,
UrlSegment,
ActivatedRouteSnapshot,
Expand All @@ -17,7 +15,7 @@ import * as fromGame from '../../stores/game/game.selectors';
@Injectable({
providedIn: 'root',
})
export class OverGuard implements CanActivate, CanLoad {
export class OverGuard {
gameOver$ = this.store
.select(fromGame.getLoose)
.pipe(
Expand Down
4 changes: 1 addition & 3 deletions src/app/home/game/core/guards/win/win.guard.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Injectable } from '@angular/core';
import {
CanActivate,
CanLoad,
Route,
UrlSegment,
ActivatedRouteSnapshot,
Expand All @@ -17,7 +15,7 @@ import * as fromGame from '../../stores/game/game.selectors';
@Injectable({
providedIn: 'root',
})
export class WinGuard implements CanActivate, CanLoad {
export class WinGuard {
win$ = this.store
.select(fromGame.getWin)
.pipe(map((win) => (win ? true : this.router.createUrlTree(['/']))));
Expand Down
4 changes: 2 additions & 2 deletions src/app/home/game/core/stores/game/game.selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const getGuessSorted = createSelector(getGuess, (guess) =>
)
);

const r = /[^a-zA-Z]/;
const r = /[^a-z]/i;
export const getWordChars = createSelector(
getWord,
getGuessSorted,
Expand Down Expand Up @@ -64,7 +64,7 @@ export const getWin = createSelector(
(word, { words, chars }) =>
!!word &&
(words.some((w) => w.toLowerCase() === word.toLowerCase()) ||
word.split(/[^a-zA-Z]?/).every((w) => chars.includes(w.toLowerCase())))
word.split(/[^a-z]?/i).every((w) => chars.includes(w.toLowerCase())))
);

export const getLoose = createSelector(
Expand Down
1 change: 0 additions & 1 deletion src/app/home/game/game.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
matInput
type="text"
formControlName="guess"
cdkFocusInitial
placeholder="Guess a character or a word"
aria-label="Guess a character or a word"
autocomplete="off"
Expand Down
Loading