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

migrate to eslint v9 #1262

Merged
merged 33 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f623c35
migrate to eslint v9
mshima Oct 31, 2024
5893d2b
add pretest script
mshima Oct 31, 2024
ede8801
fix eslint.config file name
mshima Oct 31, 2024
ba15fa7
Update package.json
mshima Oct 31, 2024
a740ab2
Update generator.mjs
mshima Oct 31, 2024
c0c053d
Update package.json
mshima Oct 31, 2024
82c2951
Update tsconfig.json
mshima Oct 31, 2024
2aa9ac1
Update tsconfig.json
mshima Oct 31, 2024
0e34e11
replace deprecated HttpClientTestingModule with provideHttpClientTesting
mshima Oct 31, 2024
4acb813
ignore some eslint rules
mshima Oct 31, 2024
6cac982
replace Boolean with boolean
mshima Oct 31, 2024
0660782
ignore eslint rules
mshima Oct 31, 2024
7d6d202
ignore eslint rule
mshima Oct 31, 2024
93bda28
adjusts
mshima Oct 31, 2024
a8e3c13
ignore eslint rules
mshima Oct 31, 2024
53eeb07
ignore eslint issues
mshima Oct 31, 2024
fd5477f
fix eslint issues
mshima Oct 31, 2024
e3002be
fix eslint issue
mshima Oct 31, 2024
185fd78
adjust prettier config
mshima Oct 31, 2024
c7908a9
fix eslint rule
mshima Oct 31, 2024
8a6abf8
fix eslint issues
mshima Oct 31, 2024
ae3f35c
fix eslint issue
mshima Oct 31, 2024
21bc3ba
Update entities.page.ts
mshima Oct 31, 2024
0b4cf5d
Update auth.interceptor.ts
mshima Oct 31, 2024
601661d
Update tsconfig.json
mshima Oct 31, 2024
161a895
Update account.service.ts
mshima Oct 31, 2024
1bdb4dd
Update account.service.ts
mshima Oct 31, 2024
e05c9b3
Update eslint.config.js.jhi.ionic.ejs
mshima Oct 31, 2024
342dbdb
Update eslint.config.js.jhi.ionic.ejs
mshima Oct 31, 2024
2afc73c
add eslint cypress plugin
mshima Nov 1, 2024
3a62abc
Update eslint.config.js.jhi.ionic.ejs
mshima Nov 1, 2024
df992a0
Merge branch 'main' into eslint9
mshima Nov 4, 2024
2d56e26
Update package.json
mshima Nov 4, 2024
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
18 changes: 6 additions & 12 deletions generators/app/__snapshots__/generator.spec.mjs.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ exports[`SubGenerator app of ionic JHipster blueprint > run > should succeed 1`]
"../ionic4j/.editorconfig": {
"stateCleared": "modified",
},
"../ionic4j/.eslintrc.json": {
"stateCleared": "modified",
},
"../ionic4j/.gitattributes": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -77,6 +74,9 @@ exports[`SubGenerator app of ionic JHipster blueprint > run > should succeed 1`]
"../ionic4j/cypress/tsconfig.json": {
"stateCleared": "modified",
},
"../ionic4j/eslint.config.mjs": {
"stateCleared": "modified",
},
"../ionic4j/ionic.config.json": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -473,9 +473,6 @@ exports[`SubGenerator app of ionic JHipster blueprint > run > should succeed 1`]
"../ionic4j/tsconfig.spec.json": {
"stateCleared": "modified",
},
"../ionic4j/tslint.json": {
"stateCleared": "modified",
},
".editorconfig": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -520,9 +517,6 @@ exports[`SubGenerator app of ionic JHipster blueprint > with custom ionic path >
"../ionic-app/.editorconfig": {
"stateCleared": "modified",
},
"../ionic-app/.eslintrc.json": {
"stateCleared": "modified",
},
"../ionic-app/.gitattributes": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -589,6 +583,9 @@ exports[`SubGenerator app of ionic JHipster blueprint > with custom ionic path >
"../ionic-app/cypress/tsconfig.json": {
"stateCleared": "modified",
},
"../ionic-app/eslint.config.mjs": {
"stateCleared": "modified",
},
"../ionic-app/ionic.config.json": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -985,9 +982,6 @@ exports[`SubGenerator app of ionic JHipster blueprint > with custom ionic path >
"../ionic-app/tsconfig.spec.json": {
"stateCleared": "modified",
},
"../ionic-app/tslint.json": {
"stateCleared": "modified",
},
".editorconfig": {
"stateCleared": "modified",
},
Expand Down
18 changes: 6 additions & 12 deletions generators/ionic/__snapshots__/generator.spec.mjs.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ exports[`SubGenerator ionic of ionic JHipster blueprint > with jwt authenticatio
".editorconfig": {
"stateCleared": "modified",
},
".eslintrc.json": {
"stateCleared": "modified",
},
".gitattributes": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -77,6 +74,9 @@ exports[`SubGenerator ionic of ionic JHipster blueprint > with jwt authenticatio
"cypress/tsconfig.json": {
"stateCleared": "modified",
},
"eslint.config.mjs": {
"stateCleared": "modified",
},
"ionic.config.json": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -473,9 +473,6 @@ exports[`SubGenerator ionic of ionic JHipster blueprint > with jwt authenticatio
"tsconfig.spec.json": {
"stateCleared": "modified",
},
"tslint.json": {
"stateCleared": "modified",
},
}
`;

Expand All @@ -487,9 +484,6 @@ exports[`SubGenerator ionic of ionic JHipster blueprint > with oauth2 authentica
".editorconfig": {
"stateCleared": "modified",
},
".eslintrc.json": {
"stateCleared": "modified",
},
".gitattributes": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -559,6 +553,9 @@ exports[`SubGenerator ionic of ionic JHipster blueprint > with oauth2 authentica
"cypress/tsconfig.json": {
"stateCleared": "modified",
},
"eslint.config.mjs": {
"stateCleared": "modified",
},
"ionic.config.json": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -979,8 +976,5 @@ exports[`SubGenerator ionic of ionic JHipster blueprint > with oauth2 authentica
"tsconfig.spec.json": {
"stateCleared": "modified",
},
"tslint.json": {
"stateCleared": "modified",
},
}
`;
6 changes: 6 additions & 0 deletions generators/ionic/files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ const PAGES_DIR = 'src/app/pages/';
const E2E_ENTITY_DIR = 'cypress/support/pages/';
const E2E_TEST_DIR = 'cypress/e2e/';

const eslintConfigTemplate = sourceFile => ({
sourceFile,
destinationFile: ctx => sourceFile.replace('eslint.config.js', ctx.eslintConfigFile),
});

export const files = {
client: [
{
templates: [
'capacitor.config.ts',
eslintConfigTemplate('eslint.config.js.jhi.ionic'),
'ionic.config.json',
'src/app/interceptors/auth.interceptor.ts',
'src/app/pages/home/home.page.scss',
Expand Down
17 changes: 12 additions & 5 deletions generators/ionic/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ export default class extends BaseApplicationGenerator {
});
}

get [BaseApplicationGenerator.LOADING]() {
return this.asLoadingTaskGroup({
loading({ application }) {
application.typescriptEslint = true;
},
});
}

get [BaseApplicationGenerator.WRITING]() {
return this.asWritingTaskGroup({
async writingTemplateTask({ application }) {
Expand Down Expand Up @@ -196,11 +204,10 @@ export default class extends BaseApplicationGenerator {

get [BaseApplicationGenerator.POST_WRITING]() {
return this.asPostWritingTaskGroup({
ignoreEslint9ConfigFile({ application }) {
const eslintConfigFile = this.env.sharedFs.get(this.destinationPath(application.eslintConfigFile));
if (eslintConfigFile) {
delete eslintConfigFile.state;
}
addPrettierConfig({ source }) {
source.mergePrettierConfig({
overrides: [{ files: '*.html', options: { parser: 'angular' } }],
});
},
customizePackageJson({ application }) {
const { baseName } = this.jhipsterConfig;
Expand Down
43 changes: 0 additions & 43 deletions generators/ionic/resources/base/.eslintrc.json

This file was deleted.

13 changes: 6 additions & 7 deletions generators/ionic/resources/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"ng": "ng",
"prettier": "prettier --write \"{,e2e/**/,src/**/}*.{js,json,html,md,ts,css,scss,yml}\" --loglevel silent",
"start": "ionic serve",
"pretest": "npm run lint",
"test": "ng test --coverage",
"test:watch": "ng test --watch"
},
Expand Down Expand Up @@ -54,10 +55,6 @@
"devDependencies": {
"@angular-builders/jest": "~18.0.0-beta.3",
"@angular-devkit/build-angular": "~18.2.0",
"@angular-eslint/builder": "~18.4.0",
"@angular-eslint/eslint-plugin": "~18.4.0",
"@angular-eslint/eslint-plugin-template": "~18.4.0",
"@angular-eslint/template-parser": "~18.4.0",
"@angular/cli": "~18.2.0",
"@angular/compiler": "~18.2.0",
"@angular/compiler-cli": "~18.2.0",
Expand All @@ -68,18 +65,20 @@
"@ionic/cli": "^7.2.0",
"@types/jest": "29.5.14",
"@types/node": "^22.1.0",
"@typescript-eslint/eslint-plugin": "8.12.2",
"@typescript-eslint/parser": "8.12.2",
"angular-eslint": "18.4.0",
"cypress": "13.15.1",
"eslint": "^9.12.0",
"eslint-plugin-cypress": "4.0.0",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-jsdoc": "50.4.3",
"eslint-plugin-prefer-arrow": "1.2.3",
"globals": "15.11.0",
"ionic-mocks-jest": "1.3.3",
"jest": "29.7.0",
"jest-localstorage-mock": "2.4.26",
"jest-preset-angular": "14.2.4",
"prettier": "3.3.3",
"typescript": "~5.5.3"
"typescript": "~5.5.3",
"typescript-eslint": "8.12.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { NavController } from '@ionic/angular';
styleUrls: ['entities.page.scss'],
})
export class EntitiesPage {
entities: Array<any> = [
entities: any[] = [
/* jhipster-needle-add-entity-page - JHipster will add entity pages here */
];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule, TranslateStore } from '@ngx-translate/core';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { provideHttpClient } from '@angular/common/http';

import { TabsPage } from './tabs.page';
import { TranslateModule, TranslateStore } from '@ngx-translate/core';
import { HttpClientTestingModule } from '@angular/common/http/testing';

describe('TabsPage', () => {
let component: TabsPage;
Expand All @@ -13,8 +14,8 @@ describe('TabsPage', () => {
TestBed.configureTestingModule({
declarations: [TabsPage],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [HttpClientTestingModule, TranslateModule.forChild()],
providers: [TranslateStore],
imports: [TranslateModule.forChild()],
providers: [TranslateStore, provideHttpClient(), provideHttpClientTesting()],
}).compileComponents();
}));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { TestBed } from '@angular/core/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { provideHttpClient } from '@angular/common/http';

import { ApiService } from './api.service';
import { HttpClientTestingModule } from '@angular/common/http/testing';

describe('ApiService', () => {
beforeEach(() =>
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [provideHttpClient(), provideHttpClientTesting()],
}),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class ApiService {
// Support easy query params for GET requests
if (params) {
reqOpts.params = new HttpParams();
for (let k in params) {
for (const k in params) {
reqOpts.params.set(k, params[k]);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { TestBed } from '@angular/core/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { provideHttpClient } from '@angular/common/http';

import { AccountService } from './account.service';
import { HttpClientTestingModule } from '@angular/common/http/testing';

describe('AccountService', () => {
beforeEach(() =>
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [provideHttpClient(), provideHttpClientTesting()],
}),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class AccountService {
}

identity(force?: boolean): Promise<any> {
if (force === true) {
if (force) {
this.userIdentity = undefined;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { TestBed } from '@angular/core/testing';
import { UserRouteAccessService } from './user-route-access.service';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { provideHttpClient } from '@angular/common/http';

import { UserRouteAccessService } from './user-route-access.service';

describe('UserRouteAccessService', () => {
beforeEach(() =>
TestBed.configureTestingModule({
imports: [HttpClientTestingModule, RouterTestingModule],
imports: [RouterTestingModule],
providers: [provideHttpClient(), provideHttpClientTesting()],
}),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export interface JhiFileLoadError {
providedIn: 'root',
})
export class JhiDataUtils {
constructor() {}

/**
* Method to abbreviate the text given
*/
Expand Down Expand Up @@ -85,7 +83,7 @@ export class JhiDataUtils {
/**
* Method to convert the file to base64
*/
toBase64(file: File, cb: Function): void {
toBase64(file: File, cb: (data: string) => void): void {
const fileReader: FileReader = new FileReader();
fileReader.onload = function (e: any) {
const base64Data: string = e.target.result.substr(e.target.result.indexOf('base64,') + 'base64,'.length);
Expand Down
1 change: 0 additions & 1 deletion generators/ionic/resources/base/src/zone-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
* Prevents Angular change detection from
* running with certain Web Component callbacks
*/
// eslint-disable-next-line no-underscore-dangle
(window as any).__Zone_disable_customElements = true;
1 change: 1 addition & 0 deletions generators/ionic/resources/base/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
// "strict": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2022",
Expand Down
Loading