Skip to content

Commit 0738f30

Browse files
committed
feat: migrate examples from TSLint to ESLint
- Remove all tslint.json files and TSLint dependencies - Add modern ESLint 9 flat config (eslint.config.js) to all examples - Update angular.json to use @angular-eslint/builder - Clean up migration guide format and remove duplicate content - Remove obsolete tsconfig.base.json files from examples All 7 examples now build and lint cleanly with Angular 20 and modern ESLint.
1 parent c8d895e commit 0738f30

Some content is hidden

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

67 files changed

+980
-1158
lines changed

examples/custom-esbuild/sanity-esbuild-app-esm/angular.json

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,18 @@
2929
"outputPath": "dist/sanity-esbuild-app-esm",
3030
"index": "src/index.html",
3131
"browser": "src/main.ts",
32-
"polyfills": ["zone.js"],
32+
"polyfills": [
33+
"zone.js"
34+
],
3335
"tsConfig": "tsconfig.app.json",
3436
"inlineStyleLanguage": "scss",
35-
"assets": ["src/favicon.ico", "src/assets"],
36-
"styles": ["src/styles.scss"],
37+
"assets": [
38+
"src/favicon.ico",
39+
"src/assets"
40+
],
41+
"styles": [
42+
"src/styles.scss"
43+
],
3744
"scripts": []
3845
},
3946
"configurations": {
@@ -91,7 +98,6 @@
9198
"serve": {
9299
"builder": "@angular-builders/custom-esbuild:dev-server",
93100
"options": {
94-
"forceEsbuild": true,
95101
"port": 5007
96102
},
97103
"configurations": {
@@ -100,28 +106,42 @@
100106
},
101107
"esm": {
102108
"buildTarget": "sanity-esbuild-app-esm:build:esm",
103-
"middlewares": ["esbuild/send-hello-middleware.js"]
109+
"middlewares": [
110+
"esbuild/send-hello-middleware.js"
111+
]
104112
},
105113
"cjs": {
106114
"buildTarget": "sanity-esbuild-app-esm:build:cjs",
107-
"middlewares": ["esbuild/send-hello-middleware.cjs"]
115+
"middlewares": [
116+
"esbuild/send-hello-middleware.cjs"
117+
]
108118
},
109119
"tsEsm": {
110120
"buildTarget": "sanity-esbuild-app-esm:build:tsEsm",
111-
"middlewares": ["esbuild/send-hello-middleware.ts"]
121+
"middlewares": [
122+
"esbuild/send-hello-middleware.ts"
123+
]
112124
}
113125
},
114126
"defaultConfiguration": "cjs"
115127
},
116128
"test": {
117129
"builder": "@angular-devkit/build-angular:karma",
118130
"options": {
119-
"polyfills": ["zone.js", "zone.js/testing"],
131+
"polyfills": [
132+
"zone.js",
133+
"zone.js/testing"
134+
],
120135
"tsConfig": "tsconfig.spec.json",
121136
"karmaConfig": "karma.conf.cjs",
122137
"inlineStyleLanguage": "scss",
123-
"assets": ["src/favicon.ico", "src/assets"],
124-
"styles": ["src/styles.scss"],
138+
"assets": [
139+
"src/favicon.ico",
140+
"src/assets"
141+
],
142+
"styles": [
143+
"src/styles.scss"
144+
],
125145
"scripts": []
126146
}
127147
},
@@ -165,12 +185,50 @@
165185
"watch": true,
166186
"headless": false
167187
}
188+
},
189+
"lint": {
190+
"builder": "@angular-eslint/builder:lint",
191+
"options": {
192+
"lintFilePatterns": [
193+
"src/**/*.ts",
194+
"src/**/*.html"
195+
]
196+
}
168197
}
169198
}
170199
}
171200
},
172201
"cli": {
173202
"analytics": false,
174-
"packageManager": "yarn"
203+
"packageManager": "yarn",
204+
"schematicCollections": [
205+
"angular-eslint"
206+
]
207+
},
208+
"schematics": {
209+
"@schematics/angular:component": {
210+
"type": "component"
211+
},
212+
"@schematics/angular:directive": {
213+
"type": "directive"
214+
},
215+
"@schematics/angular:service": {
216+
"type": "service"
217+
},
218+
"@schematics/angular:guard": {
219+
"typeSeparator": "."
220+
},
221+
"@schematics/angular:interceptor": {
222+
"typeSeparator": "."
223+
},
224+
"@schematics/angular:module": {
225+
"typeSeparator": "."
226+
},
227+
"@schematics/angular:pipe": {
228+
"typeSeparator": "."
229+
},
230+
"@schematics/angular:resolver": {
231+
"typeSeparator": "."
232+
}
175233
}
176234
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// @ts-check
2+
import eslint from "@eslint/js";
3+
import tseslint from "typescript-eslint";
4+
import angular from "angular-eslint";
5+
6+
export default tseslint.config(
7+
{
8+
files: ["**/*.ts"],
9+
extends: [
10+
eslint.configs.recommended,
11+
...tseslint.configs.recommended,
12+
...tseslint.configs.stylistic,
13+
...angular.configs.tsRecommended,
14+
],
15+
processor: angular.processInlineTemplates,
16+
rules: {
17+
"@angular-eslint/directive-selector": [
18+
"error",
19+
{
20+
type: "attribute",
21+
prefix: "app",
22+
style: "camelCase",
23+
},
24+
],
25+
"@angular-eslint/component-selector": [
26+
"error",
27+
{
28+
type: "element",
29+
prefix: "app",
30+
style: "kebab-case",
31+
},
32+
],
33+
},
34+
},
35+
{
36+
files: ["**/*.html"],
37+
extends: [
38+
...angular.configs.templateRecommended,
39+
...angular.configs.templateAccessibility,
40+
],
41+
rules: {},
42+
}
43+
);

examples/custom-esbuild/sanity-esbuild-app-esm/tsconfig.app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* To learn more about this file see: https://angular.io/config/tsconfig. */
22
{
3-
"extends": "./tsconfig.base.json",
3+
"extends": "./tsconfig.json",
44
"compilerOptions": {
55
"outDir": "./out-tsc/app",
66
"types": []

examples/custom-esbuild/sanity-esbuild-app-esm/tsconfig.base.json

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
1-
/*
2-
This is a "Solution Style" tsconfig.json file, and is used by editors and TypeScript’s language server to improve development experience.
3-
It is not intended to be used to perform a compilation.
4-
5-
To learn more about this file see: https://angular.io/config/solution-tsconfig.
6-
*/
1+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
72
{
8-
"files": [],
9-
"references": [
10-
{
11-
"path": "./tsconfig.app.json"
12-
},
13-
{
14-
"path": "./tsconfig.spec.json"
15-
}
16-
]
3+
"compileOnSave": false,
4+
"compilerOptions": {
5+
"outDir": "./dist/out-tsc",
6+
"forceConsistentCasingInFileNames": true,
7+
"strict": true,
8+
"noImplicitOverride": true,
9+
"noPropertyAccessFromIndexSignature": true,
10+
"noImplicitReturns": true,
11+
"noFallthroughCasesInSwitch": true,
12+
"esModuleInterop": true,
13+
"sourceMap": true,
14+
"declaration": false,
15+
"downlevelIteration": true,
16+
"experimentalDecorators": true,
17+
"moduleResolution": "node",
18+
"importHelpers": true,
19+
"target": "ES2022",
20+
"module": "ES2022",
21+
"useDefineForClassFields": false,
22+
"lib": [
23+
"ES2022",
24+
"dom"
25+
]
26+
},
27+
"angularCompilerOptions": {
28+
"enableI18nLegacyMessageIdFormat": false,
29+
"strictInjectionParameters": true,
30+
"strictInputAccessModifiers": true,
31+
"strictTemplates": true
32+
}
1733
}

examples/custom-esbuild/sanity-esbuild-app-esm/tsconfig.spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* To learn more about this file see: https://angular.io/config/tsconfig. */
22
{
3-
"extends": "./tsconfig.base.json",
3+
"extends": "./tsconfig.json",
44
"compilerOptions": {
55
"outDir": "./out-tsc/spec",
66
"types": [

examples/custom-esbuild/sanity-esbuild-app/angular.json

Lines changed: 66 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,18 @@
2929
"outputPath": "dist/sanity-esbuild-app",
3030
"index": "src/index.html",
3131
"browser": "src/main.ts",
32-
"polyfills": ["zone.js"],
32+
"polyfills": [
33+
"zone.js"
34+
],
3335
"tsConfig": "tsconfig.app.json",
3436
"inlineStyleLanguage": "scss",
35-
"assets": ["src/favicon.ico", "src/assets"],
36-
"styles": ["src/styles.scss"],
37+
"assets": [
38+
"src/favicon.ico",
39+
"src/assets"
40+
],
41+
"styles": [
42+
"src/styles.scss"
43+
],
3744
"scripts": []
3845
},
3946
"configurations": {
@@ -80,7 +87,6 @@
8087
"serve": {
8188
"builder": "@angular-builders/custom-esbuild:dev-server",
8289
"options": {
83-
"forceEsbuild": true,
8490
"port": 5006
8591
},
8692
"configurations": {
@@ -89,24 +95,36 @@
8995
},
9096
"esm": {
9197
"buildTarget": "sanity-esbuild-app:build:esm",
92-
"middlewares": ["esbuild/send-hello-middleware.mjs"]
98+
"middlewares": [
99+
"esbuild/send-hello-middleware.mjs"
100+
]
93101
},
94102
"cjs": {
95103
"buildTarget": "sanity-esbuild-app:build:cjs",
96-
"middlewares": ["esbuild/send-hello-middleware.js"]
104+
"middlewares": [
105+
"esbuild/send-hello-middleware.js"
106+
]
97107
}
98108
},
99109
"defaultConfiguration": "cjs"
100110
},
101111
"test": {
102112
"builder": "@angular-devkit/build-angular:karma",
103113
"options": {
104-
"polyfills": ["zone.js", "zone.js/testing"],
114+
"polyfills": [
115+
"zone.js",
116+
"zone.js/testing"
117+
],
105118
"tsConfig": "tsconfig.spec.json",
106119
"karmaConfig": "karma.conf.js",
107120
"inlineStyleLanguage": "scss",
108-
"assets": ["src/favicon.ico", "src/assets"],
109-
"styles": ["src/styles.scss"],
121+
"assets": [
122+
"src/favicon.ico",
123+
"src/assets"
124+
],
125+
"styles": [
126+
"src/styles.scss"
127+
],
110128
"scripts": []
111129
}
112130
},
@@ -146,12 +164,50 @@
146164
"watch": true,
147165
"headless": false
148166
}
167+
},
168+
"lint": {
169+
"builder": "@angular-eslint/builder:lint",
170+
"options": {
171+
"lintFilePatterns": [
172+
"src/**/*.ts",
173+
"src/**/*.html"
174+
]
175+
}
149176
}
150177
}
151178
}
152179
},
153180
"cli": {
154181
"analytics": false,
155-
"packageManager": "yarn"
182+
"packageManager": "yarn",
183+
"schematicCollections": [
184+
"angular-eslint"
185+
]
186+
},
187+
"schematics": {
188+
"@schematics/angular:component": {
189+
"type": "component"
190+
},
191+
"@schematics/angular:directive": {
192+
"type": "directive"
193+
},
194+
"@schematics/angular:service": {
195+
"type": "service"
196+
},
197+
"@schematics/angular:guard": {
198+
"typeSeparator": "."
199+
},
200+
"@schematics/angular:interceptor": {
201+
"typeSeparator": "."
202+
},
203+
"@schematics/angular:module": {
204+
"typeSeparator": "."
205+
},
206+
"@schematics/angular:pipe": {
207+
"typeSeparator": "."
208+
},
209+
"@schematics/angular:resolver": {
210+
"typeSeparator": "."
211+
}
156212
}
157213
}

0 commit comments

Comments
 (0)