You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/CONFIGURING_FLAT_CONFIG.md
+28-4Lines changed: 28 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,27 @@ Fortunately, however, ESLint has clearly defined points of extensibility that we
29
29
30
30
Therefore, our flat config will contain two entries, one for TS, one for HTML. We could provide these two entries directly in an exported array, but `typescript-eslint` provides an awesome typed utility function which makes writing our flat configs a lot nicer, so we will instead require the function and pass in multiple objects for our configuration.
31
31
32
+
## Configuring ESLint for Inline Templates
33
+
34
+
One of the features of angular-eslint is its ability to lint **inline templates** within your Angular components. This is made possible through ESLint's processor API, which allows us to extract inline template content from your TypeScript component files and apply HTML template rules to them.
35
+
36
+
### How it works
37
+
38
+
When you use inline templates in your Angular components (using the `template` property instead of `templateUrl`), angular-eslint can automatically extract these templates and treat them as if they were separate HTML files. This means all your Angular template rules will work seamlessly on both external template files AND inline templates.
39
+
40
+
The magic happens through the `angular.processInlineTemplates` processor, which:
41
+
42
+
1. Scans your TypeScript component files for inline templates
43
+
2. Extracts the template content
44
+
3. Applies your HTML configuration rules to the extracted templates
45
+
4. Reports any linting issues with proper line and column mapping back to your original TypeScript file
46
+
47
+
For more details on how ESLint processors work behind the scenes, see the [ESLint Custom Processors documentation](https://eslint.org/docs/latest/extend/custom-processors).
48
+
49
+
### Configuration example
50
+
51
+
The key is to add the `processor: angular.processInlineTemplates` to your TypeScript configuration block:
0 commit comments