Skip to content

Commit a8ce8d6

Browse files
authored
Bump to Angular 18 (#121)
* update * schematics * first update * update material * updates * Lint * ignore * Fix * standalone * standalone end * remove ng module * fix test * Fix app test * README
1 parent db54f87 commit a8ce8d6

File tree

71 files changed

+608
-1394
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+608
-1394
lines changed

.eslintrc.json

Lines changed: 0 additions & 51 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ target
44
*.iml
55
node_modules
66
package-lock.json
7+
.eslintcache

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm run lint-staged

.huskyrc

Lines changed: 0 additions & 5 deletions
This file was deleted.

.prettierrc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,19 @@
22
"arrowParens": "always",
33
"bracketSpacing": true,
44
"endOfLine": "auto",
5-
"printWidth": 140,
5+
"printWidth": 120,
66
"quoteProps": "consistent",
77
"semi": true,
88
"singleQuote": true,
99
"tabWidth": 2,
1010
"trailingComma": "none",
11-
"useTabs": false
12-
}
11+
"useTabs": false,
12+
"overrides": [
13+
{
14+
"files": "*.html",
15+
"options": {
16+
"parser": "angular"
17+
}
18+
}
19+
]
20+
}

.readme/dashboard.png

11.9 KB
Loading

CONTRIBUTING.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ In general, we follow the ["fork-and-pull" Git workflow](https://github.com/susa
3737

3838
## Style Guide
3939

40-
### Code Style
40+
### Back-End
4141

4242
We maintain a consistent code style using [Checkstyle](https://checkstyle.sourceforge.io/).
4343

@@ -53,4 +53,10 @@ Before you start contributing new code, it is recommended to:
5353
- Install the IntelliJ [CheckStyle-IDEA](https://plugins.jetbrains.com/plugin/1065-checkstyle-idea) plugin.
5454
- Configure the plugin to use Suricate Widget Tester's Checkstyle configuration file.
5555

56-
Adhering to this code style ensures consistency and helps maintain code quality throughout the project.
56+
### Front-End
57+
58+
We maintain a consistent code style using [ESLint](https://eslint.org) and [Prettier](https://prettier.io).
59+
60+
We use [Husky](https://typicode.github.io/husky/) and [Lint-Staged](https://github.com/lint-staged/lint-staged) to perform linting and formatting checks before committing.
61+
62+
After the first `npm install`, everything should be set up automatically.

angular.json

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,26 @@
99
"sourceRoot": "src/main/webapp",
1010
"architect": {
1111
"build": {
12-
"builder": "@angular-devkit/build-angular:browser",
12+
"builder": "@angular-devkit/build-angular:application",
1313
"options": {
14-
"outputPath": "target/dist/public",
14+
"outputPath": {
15+
"base": "target/dist/public"
16+
},
1517
"index": "src/main/webapp/index.html",
16-
"main": "src/main/webapp/main.ts",
1718
"tsConfig": "src/main/webapp/tsconfig.app.json",
1819
"polyfills": [
19-
"zone.js",
20-
"src/main/webapp/polyfills.ts"
20+
"zone.js"
2121
],
2222
"assets": [
2323
"src/main/webapp/assets"
2424
],
2525
"stylePreprocessorOptions": {
2626
"includePaths": [
27-
"node_modules/normalize-scss/sass",
2827
"node_modules/@fortawesome/fontawesome-free/scss"
2928
]
3029
},
3130
"styles": [
32-
"src/main/webapp/sass/styles.scss"
31+
"src/main/webapp/styles.scss"
3332
],
3433
"scripts": [
3534
"node_modules/jquery/dist/jquery.min.js",
@@ -40,8 +39,7 @@
4039
"namedChunks": false,
4140
"aot": true,
4241
"extractLicenses": false,
43-
"vendorChunk": true,
44-
"buildOptimizer": true
42+
"browser": "src/main/webapp/main.ts"
4543
},
4644
"configurations": {
4745
"production": {
@@ -68,9 +66,7 @@
6866
"sourceMap": true,
6967
"namedChunks": false,
7068
"aot": true,
71-
"extractLicenses": true,
72-
"vendorChunk": true,
73-
"buildOptimizer": true
69+
"extractLicenses": true
7470
}
7571
},
7672
"defaultConfiguration": ""
@@ -97,21 +93,19 @@
9793
"options": {
9894
"polyfills": [
9995
"zone.js",
100-
"zone.js/testing",
101-
"src/main/webapp/polyfills.ts"
96+
"zone.js/testing"
10297
],
10398
"tsConfig": "src/main/webapp/tsconfig.spec.json",
10499
"assets": [
105100
"src/main/webapp/assets"
106101
],
107102
"stylePreprocessorOptions": {
108103
"includePaths": [
109-
"node_modules/normalize-scss/sass",
110104
"node_modules/@fortawesome/fontawesome-free/scss"
111105
]
112106
},
113107
"styles": [
114-
"src/main/webapp/sass/styles.scss"
108+
"src/main/webapp/styles.scss"
115109
],
116110
"scripts": [
117111
"node_modules/jquery/dist/jquery.min.js",

eslint.config.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// @ts-check
2+
const eslint = require("@eslint/js");
3+
const tseslint = require("typescript-eslint");
4+
const angular = require("angular-eslint");
5+
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
6+
const simpleImportSort = require('eslint-plugin-simple-import-sort');
7+
const unusedImports = require('eslint-plugin-unused-imports');
8+
9+
module.exports = tseslint.config(
10+
{
11+
files: ["**/*.ts"],
12+
plugins: {
13+
"simple-import-sort": simpleImportSort,
14+
"unused-imports": unusedImports,
15+
},
16+
extends: [
17+
eslint.configs.recommended,
18+
...tseslint.configs.recommended,
19+
...tseslint.configs.stylistic,
20+
...angular.configs.tsRecommended,
21+
eslintPluginPrettierRecommended,
22+
],
23+
processor: angular.processInlineTemplates,
24+
rules: {
25+
"unused-imports/no-unused-imports": 'error',
26+
"simple-import-sort/imports": "error",
27+
"simple-import-sort/exports": "error",
28+
"@angular-eslint/directive-selector": [
29+
"error",
30+
{
31+
type: "attribute",
32+
style: "camelCase",
33+
},
34+
],
35+
"@angular-eslint/component-selector": [
36+
"error",
37+
{
38+
type: "element",
39+
prefix: "suricate",
40+
style: "kebab-case",
41+
},
42+
],
43+
"@typescript-eslint/no-unused-vars": [
44+
"error",
45+
{
46+
args: "after-used",
47+
argsIgnorePattern: "^ignored",
48+
caughtErrors: "all",
49+
caughtErrorsIgnorePattern: "^ignored"
50+
}
51+
]
52+
},
53+
},
54+
{
55+
files: ["**/*.html"],
56+
extends: [
57+
...angular.configs.templateRecommended,
58+
...angular.configs.templateAccessibility,
59+
],
60+
rules: {},
61+
}
62+
);

package.json

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,55 +10,64 @@
1010
"test": "ng test",
1111
"test-ci": "ng test --no-watch --no-progress --code-coverage --browsers=ChromeHeadlessNoSandbox",
1212
"lint": "ng lint",
13-
"prettyformat": "pretty-quick --staged"
13+
"prepare": "husky",
14+
"lint-staged": "lint-staged"
1415
},
1516
"private": true,
1617
"dependencies": {
17-
"@angular/animations": "^17.0.8",
18-
"@angular/cdk": "^17.0.4",
19-
"@angular/common": "^17.0.8",
20-
"@angular/compiler": "^17.0.8",
21-
"@angular/core": "^17.0.8",
22-
"@angular/forms": "^17.0.8",
23-
"@angular/material": "^17.0.4",
24-
"@angular/platform-browser": "^17.0.8",
25-
"@angular/platform-browser-dynamic": "^17.0.8",
26-
"@angular/router": "^17.0.8",
27-
"@fortawesome/fontawesome-free": "^6.5.1",
28-
"@katoid/angular-grid-layout": "^2.2.0",
18+
"@angular/animations": "^18.2.13",
19+
"@angular/cdk": "^18.2.14",
20+
"@angular/common": "^18.2.13",
21+
"@angular/compiler": "^18.2.13",
22+
"@angular/core": "^18.2.13",
23+
"@angular/forms": "^18.2.13",
24+
"@angular/material": "^18.2.14",
25+
"@angular/platform-browser": "^18.2.13",
26+
"@angular/platform-browser-dynamic": "^18.2.13",
27+
"@angular/router": "^18.2.13",
28+
"@fortawesome/fontawesome-free": "^6.7.2",
29+
"@katoid/angular-grid-layout": "^3.0.0",
2930
"jquery": "^3.7.1",
30-
"moment": "^2.22.1",
31-
"normalize-scss": "^7.0.1",
32-
"rxjs": "6.5.3",
31+
"moment": "^2.30.1",
32+
"rxjs": "7.4.0",
3333
"zone.js": "~0.14.2"
3434
},
3535
"devDependencies": {
36-
"@angular-devkit/build-angular": "^17.0.9",
37-
"@angular-eslint/builder": "^17.2.0",
38-
"@angular-eslint/eslint-plugin": "^17.2.0",
39-
"@angular-eslint/eslint-plugin-template": "^17.2.0",
40-
"@angular-eslint/schematics": "^17.2.0",
41-
"@angular-eslint/template-parser": "^17.2.0",
42-
"@angular/cli": "^17.0.9",
43-
"@angular/compiler-cli": "^17.0.8",
36+
"@angular-devkit/build-angular": "^18.2.12",
37+
"@angular-eslint/builder": "^18.4.3",
38+
"@angular-eslint/eslint-plugin": "^18.4.3",
39+
"@angular-eslint/eslint-plugin-template": "^18.4.3",
40+
"@angular-eslint/schematics": "^18.4.3",
41+
"@angular-eslint/template-parser": "^18.4.3",
42+
"@angular/cli": "^18.2.12",
43+
"@angular/compiler-cli": "^18.2.13",
44+
"@eslint/js": "^9.17.0",
4445
"@types/jasmine": "~5.1.4",
4546
"@types/node": "^20.10.2",
46-
"@typescript-eslint/eslint-plugin": "^6.10.0",
47-
"@typescript-eslint/parser": "^6.10.0",
48-
"eslint": "^8.53.0",
49-
"eslint-plugin-deprecation": "^2.0.0",
50-
"husky": "^8.0.3",
47+
"@typescript-eslint/eslint-plugin": "^8.19.1",
48+
"@typescript-eslint/parser": "^8.19.1",
49+
"angular-eslint": "^19.0.2",
50+
"eslint": "^9.8.0",
51+
"eslint-config-prettier": "^9.1.0",
52+
"eslint-plugin-prettier": "^5.2.1",
53+
"eslint-plugin-simple-import-sort": "^12.1.1",
54+
"eslint-plugin-unused-imports": "^4.1.4",
55+
"husky": "^9.1.7",
5156
"jasmine-core": "~5.1.1",
5257
"jasmine-spec-reporter": "~7.0.0",
5358
"karma": "~6.4.1",
5459
"karma-chrome-launcher": "~3.1.0",
5560
"karma-coverage": "^2.0.3",
5661
"karma-jasmine": "~4.0.0",
5762
"karma-jasmine-html-reporter": "^1.7.0",
63+
"lint-staged": "^15.3.0",
5864
"prettier": "^3.2.4",
59-
"pretty-quick": "^4.0.0",
60-
"protractor": "~7.0.0",
65+
"prettier-eslint": "^16.3.0",
6166
"ts-node": "~10.9.1",
62-
"typescript": "~5.2.2"
67+
"typescript": "~5.5.4",
68+
"typescript-eslint": "^8.0.0"
69+
},
70+
"lint-staged": {
71+
"**/*.{js,mjs,cjs,ts}": "eslint --cache --fix --max-warnings 0 src/main/webapp"
6372
}
6473
}

src/main/webapp/app/app-routing.module.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1-
import { TestBed } from '@angular/core/testing';
1+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
2+
import { provideHttpClientTesting } from '@angular/common/http/testing';
3+
import { ComponentFixture, TestBed } from '@angular/core/testing';
4+
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
5+
26
import { AppComponent } from './app.component';
3-
import { MockModule } from './mock/mock.module';
47

58
describe('AppComponent', () => {
9+
let component: AppComponent;
10+
let fixture: ComponentFixture<AppComponent>;
11+
612
beforeEach(async () => {
713
await TestBed.configureTestingModule({
8-
imports: [MockModule],
9-
declarations: [AppComponent]
14+
imports: [AppComponent],
15+
providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting(), provideAnimationsAsync()]
1016
}).compileComponents();
17+
18+
fixture = TestBed.createComponent(AppComponent);
19+
component = fixture.componentInstance;
20+
fixture.detectChanges();
1121
});
1222

13-
it('should create the app', () => {
14-
const fixture = TestBed.createComponent(AppComponent);
15-
const app = fixture.componentInstance;
16-
expect(app).toBeTruthy();
23+
it('should create', () => {
24+
expect(component).toBeTruthy();
1725
});
1826
});

0 commit comments

Comments
 (0)