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

Update Angular to eslint@9 #26504

Merged
merged 6 commits into from
Jul 18, 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
3 changes: 0 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ updates:
- 'ngx-infinite-scroll'
- 'typescript'
- 'zone.js'
angular-eslint:
patterns:
- '@angular-eslint/*'
fortawesome:
patterns:
- '@fortawesome/fontawesome-svg-core'
Expand Down
57 changes: 18 additions & 39 deletions generators/angular/__snapshots__/generator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ exports[`generator - angular gateway-jwt-skipUserManagement(true)-withAdminUi(fa
".yo-rc.json": {
"stateCleared": "modified",
},
"clientRoot/.eslintignore": {
"clientRoot/angular.json": {
"stateCleared": "modified",
},
"clientRoot/.eslintrc.json": {
"stateCleared": "modified",
},
"clientRoot/angular.json": {
"clientRoot/eslint.config.mjs": {
"stateCleared": "modified",
},
"clientRoot/jest.conf.js": {
Expand Down Expand Up @@ -700,13 +697,10 @@ exports[`generator - angular gateway-oauth2-withAdminUi(true)-skipJhipsterDepend
".yo-rc.json": {
"stateCleared": "modified",
},
"clientRoot/.eslintignore": {
"stateCleared": "modified",
},
"clientRoot/.eslintrc.json": {
"clientRoot/angular.json": {
"stateCleared": "modified",
},
"clientRoot/angular.json": {
"clientRoot/eslint.config.mjs": {
"stateCleared": "modified",
},
"clientRoot/jest.conf.js": {
Expand Down Expand Up @@ -1605,13 +1599,10 @@ exports[`generator - angular microservice-jwt-skipUserManagement(false)-withAdmi
".yo-rc.json": {
"stateCleared": "modified",
},
"clientRoot/.eslintignore": {
"stateCleared": "modified",
},
"clientRoot/.eslintrc.json": {
"clientRoot/angular.json": {
"stateCleared": "modified",
},
"clientRoot/angular.json": {
"clientRoot/eslint.config.mjs": {
"stateCleared": "modified",
},
"clientRoot/jest.conf.js": {
Expand Down Expand Up @@ -2252,12 +2243,6 @@ exports[`generator - angular microservice-jwt-skipUserManagement(false)-withAdmi

exports[`generator - angular microservice-oauth2-withAdminUi(true)-skipJhipsterDependencies(true)-enableTranslation(true)--websocket(false) should match generated files snapshot 1`] = `
{
".eslintignore": {
"stateCleared": "modified",
},
".eslintrc.json": {
"stateCleared": "modified",
},
".jhipster/EntityWithCustomId.json": {
"stateCleared": "modified",
},
Expand All @@ -2276,6 +2261,9 @@ exports[`generator - angular microservice-oauth2-withAdminUi(true)-skipJhipsterD
"angular.json": {
"stateCleared": "modified",
},
"eslint.config.mjs": {
"stateCleared": "modified",
},
"jest.conf.js": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -2923,12 +2911,6 @@ exports[`generator - angular microservice-oauth2-withAdminUi(true)-skipJhipsterD

exports[`generator - angular monolith-jwt-skipUserManagement(false)-withAdminUi(true)-skipJhipsterDependencies(true)-enableTranslation(true)--websocket(true) should match generated files snapshot 1`] = `
{
".eslintignore": {
"stateCleared": "modified",
},
".eslintrc.json": {
"stateCleared": "modified",
},
".jhipster/EntityWithCustomId.json": {
"stateCleared": "modified",
},
Expand All @@ -2947,6 +2929,9 @@ exports[`generator - angular monolith-jwt-skipUserManagement(false)-withAdminUi(
"angular.json": {
"stateCleared": "modified",
},
"eslint.config.mjs": {
"stateCleared": "modified",
},
"jest.conf.js": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -3999,12 +3984,6 @@ exports[`generator - angular monolith-jwt-skipUserManagement(false)-withAdminUi(

exports[`generator - angular monolith-oauth2-withAdminUi(false)-skipJhipsterDependencies(false)-enableTranslation(false)-websocket(false) should match generated files snapshot 1`] = `
{
".eslintignore": {
"stateCleared": "modified",
},
".eslintrc.json": {
"stateCleared": "modified",
},
".jhipster/EntityWithCustomId.json": {
"stateCleared": "modified",
},
Expand All @@ -4023,6 +4002,9 @@ exports[`generator - angular monolith-oauth2-withAdminUi(false)-skipJhipsterDepe
"angular.json": {
"stateCleared": "modified",
},
"eslint.config.mjs": {
"stateCleared": "modified",
},
"jest.conf.js": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -4655,12 +4637,6 @@ exports[`generator - angular monolith-oauth2-withAdminUi(false)-skipJhipsterDepe

exports[`generator - angular monolith-session-skipUserManagement(true)-withAdminUi(false)-skipJhipsterDependencies(false)-enableTranslation(false)-websocket(true) should match generated files snapshot 1`] = `
{
".eslintignore": {
"stateCleared": "modified",
},
".eslintrc.json": {
"stateCleared": "modified",
},
".jhipster/EntityWithCustomId.json": {
"stateCleared": "modified",
},
Expand All @@ -4679,6 +4655,9 @@ exports[`generator - angular monolith-session-skipUserManagement(true)-withAdmin
"angular.json": {
"stateCleared": "modified",
},
"eslint.config.mjs": {
"stateCleared": "modified",
},
"jest.conf.js": {
"stateCleared": "modified",
},
Expand Down
2 changes: 1 addition & 1 deletion generators/angular/files-angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const files = {
common: [
clientRootTemplatesBlock({
templates: [
'.eslintrc.json',
'angular.json',
{ sourceFile: 'eslint.config.js.jhi.angular', destinationFile: ctx => `${ctx.eslintConfigFile}.jhi.angular` },
'ngsw-config.json',
'package.json',
'tsconfig.json',
Expand Down
23 changes: 20 additions & 3 deletions generators/angular/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
} from '../client/support/index.js';
import type { CommonClientServerApplication } from '../base-application/types.js';
import { createNeedleCallback, mutateData } from '../base/support/index.js';
import { writeEslintClientRootConfigFile } from '../javascript/generators/eslint/support/tasks.js';
import { writeEntitiesFiles, postWriteEntitiesFiles, cleanupEntitiesFiles } from './entity-files-angular.js';
import { writeFiles } from './files-angular.js';
import cleanupOldFilesTask from './cleanup.js';
Expand Down Expand Up @@ -72,6 +73,12 @@ export default class AngularGenerator extends BaseApplicationGenerator {
this.fetchFromInstalledJHipster(GENERATOR_ANGULAR, 'resources', 'package.json'),
);
},
applicationDefauts({ applicationDefaults }) {
applicationDefaults({
__override__: true,
typescriptEslint: true,
});
},
});
}

Expand All @@ -81,9 +88,13 @@ export default class AngularGenerator extends BaseApplicationGenerator {

get preparing() {
return this.asPreparingTaskGroup({
prepareForTemplates({ application }) {
application.webappEnumerationsDir = `${application.clientSrcDir}app/entities/enumerations/`;
application.angularLocaleId = application.nativeLanguageDefinition.angularLocale ?? defaultLanguage.angularLocale!;
applicationDefauts({ applicationDefaults }) {
applicationDefaults({
__override__: true,
eslintConfigFile: app => `eslint.config.${app.packageJsonType === 'module' ? 'js' : 'mjs'}`,
webappEnumerationsDir: app => `${app.clientSrcDir}app/entities/enumerations/`,
angularLocaleId: app => app.nativeLanguageDefinition.angularLocale ?? defaultLanguage.angularLocale,
});
},
addNeedles({ source, application }) {
source.addEntitiesToClient = param => {
Expand Down Expand Up @@ -222,7 +233,13 @@ export default class AngularGenerator extends BaseApplicationGenerator {

get writing() {
return this.asWritingTaskGroup({
cleanup({ control }) {
control.cleanupFiles({
'8.6.1': ['.eslintrc.json', '.eslintignore'],
});
},
cleanupOldFilesTask,
writeEslintClientRootConfigFile,
writeFiles,
});
}
Expand Down
8 changes: 5 additions & 3 deletions generators/angular/resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,21 @@
"@angular-architects/module-federation-runtime": "18.0.4",
"@angular-builders/custom-webpack": "18.0.0",
"@angular-builders/jest": "18.0.0",
"@angular-eslint/eslint-plugin": "18.1.0",
"@angular/cli": "18.1.1",
"@types/jest": "29.5.12",
"@types/node": "20.11.25",
"@types/sockjs-client": "1.5.4",
"@typescript-eslint/eslint-plugin": "7.16.1",
"angular-eslint": "18.1.0",
"browser-sync": "3.0.2",
"browser-sync-webpack-plugin": "2.3.0",
"buffer": "6.0.3",
"copy-webpack-plugin": "12.0.2",
"eslint": "8.57.0",
"eslint": "9.7.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.2.1",
"eslint-webpack-plugin": "4.2.0",
"folder-hash": "4.0.4",
"globals": "15.8.0",
"jest": "29.7.0",
"jest-date-mock": "1.0.10",
"jest-junit": "16.0.0",
Expand All @@ -47,6 +48,7 @@
"rimraf": "5.0.8",
"ts-jest": "29.2.2",
"typescript": "5.4.5",
"typescript-eslint": "8.0.0-alpha.44",
"webpack": "5.93.0",
"webpack-bundle-analyzer": "4.10.2",
"webpack-merge": "6.0.1",
Expand Down
123 changes: 0 additions & 123 deletions generators/angular/templates/.eslintrc.json.ejs

This file was deleted.

Loading
Loading