|
23 | 23 | { |
24 | 24 | "files": ["*.ts"], |
25 | 25 | "parserOptions": { |
26 | | - "project": [ |
27 | | - "tsconfig.*?.json" |
28 | | - // "e2e/tsconfig.json" |
29 | | - ], |
| 26 | + "project": ["tsconfig.*?.json"], |
30 | 27 | "createDefaultProgram": true |
31 | 28 | }, |
32 | | - "extends": ["plugin:@angular-eslint/recommended", "prettier/@typescript-eslint", "plugin:prettier/recommended"], |
| 29 | + "extends": [ |
| 30 | + "plugin:@angular-eslint/recommended", |
| 31 | + "plugin:@angular-eslint/template/process-inline-templates", |
| 32 | + "plugin:prettier/recommended" |
| 33 | + ], |
33 | 34 | "rules": { |
34 | 35 | /** |
35 | 36 | * Any TypeScript related rules you wish to use/reconfigure over and above the |
36 | 37 | * recommended set provided by the @angular-eslint project would go here. |
37 | 38 | * |
38 | 39 | * There are some examples below from the @angular-eslint plugin and ESLint core: |
39 | 40 | */ |
40 | | - "@angular-eslint/directive-selector": ["error", { "type": "attribute", "prefix": "app", "style": "camelCase" }], |
41 | | - "@angular-eslint/component-selector": ["error", { "type": "element", "prefix": "app", "style": "kebab-case" }], |
42 | | - "quotes": ["error", "single", { "allowTemplateLiterals": true }] |
| 41 | + "@angular-eslint/directive-selector": [ |
| 42 | + "error", |
| 43 | + { |
| 44 | + "type": "attribute", |
| 45 | + "prefix": "app", |
| 46 | + "style": "camelCase" |
| 47 | + } |
| 48 | + ], |
| 49 | + "@angular-eslint/component-selector": [ |
| 50 | + "error", |
| 51 | + { |
| 52 | + "type": "element", |
| 53 | + "prefix": "app", |
| 54 | + "style": "kebab-case" |
| 55 | + } |
| 56 | + ] |
43 | 57 | } |
44 | 58 | }, |
45 | 59 |
|
|
48 | 62 | * COMPONENT TEMPLATES |
49 | 63 | * ----------------------------------------------------- |
50 | 64 | * |
51 | | - * If you use inline templates, make sure you read the notes on the configuration |
52 | | - * object after this one to understand how they relate to this configuration directly |
53 | | - * below. |
| 65 | + * If you use inline templates, make sure you you have read the notes on the extends |
| 66 | + * in the "*.ts" overrides above to understand how they relate to this configuration |
| 67 | + * directly below. |
54 | 68 | */ |
| 69 | + |
| 70 | + // NOTE: WE ARE NOT APPLYING PRETTIER IN THIS OVERRIDE, ONLY @ANGULAR-ESLINT/TEMPLATE |
55 | 71 | { |
56 | | - "files": ["*.component.html"], |
| 72 | + "files": ["*.html"], |
57 | 73 | "extends": ["plugin:@angular-eslint/template/recommended"], |
58 | 74 | "rules": { |
59 | 75 | /** |
|
62 | 78 | */ |
63 | 79 | } |
64 | 80 | }, |
65 | | - |
66 | | - /** |
67 | | - * ----------------------------------------------------- |
68 | | - * EXTRACT INLINE TEMPLATES (from within .component.ts) |
69 | | - * ----------------------------------------------------- |
70 | | - * |
71 | | - * This extra piece of configuration is necessary to extract inline |
72 | | - * templates from within Component metadata, e.g.: |
73 | | - * |
74 | | - * @Component({ |
75 | | - * template: `<h1>Hello, World!</h1>` |
76 | | - * }) |
77 | | - * ... |
78 | | - * |
79 | | - * It works by extracting the template part of the file and treating it as |
80 | | - * if it were a full .html file, and it will therefore match the configuration |
81 | | - * specific for *.component.html above when it comes to actual rules etc. |
82 | | - * |
83 | | - * NOTE: This processor will skip a lot of work when it runs if you don't use |
84 | | - * inline templates in your projects currently, so there is no great benefit |
85 | | - * in removing it, but you can if you want to. |
86 | | - * |
87 | | - * You won't specify any rules here. As noted above, the rules that are relevant |
88 | | - * to inline templates are the same as the ones defined for *.component.html. |
89 | | - */ |
| 81 | + // NOTE: WE ARE NOT APPLYING @ANGULAR-ESLINT/TEMPLATE IN THIS OVERRIDE, ONLY PRETTIER |
90 | 82 | { |
91 | | - "files": ["*.component.ts"], |
92 | | - "extends": ["plugin:@angular-eslint/template/process-inline-templates"] |
| 83 | + "files": ["*.html"], |
| 84 | + "excludedFiles": ["*inline-template-*.component.html"], |
| 85 | + "extends": ["plugin:prettier/recommended"], |
| 86 | + "rules": { |
| 87 | + // NOTE: WE ARE OVERRIDING THE DEFAULT CONFIG TO ALWAYS SET THE PARSER TO ANGULAR (SEE BELOW) |
| 88 | + "prettier/prettier": ["error", { "parser": "angular" }] |
| 89 | + } |
93 | 90 | } |
94 | 91 | ] |
95 | 92 | } |
0 commit comments