Repository navigation
Expand file tree
/
Copy patheslint.config.mjs
More file actions
174 lines (167 loc) · 4.71 KB
/
Copy patheslint.config.mjs
File metadata and controls
174 lines (167 loc) · 4.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
import * as path from "node:path";
import { defineConfig } from "eslint/config";
import angular from "angular-eslint";
import prettier from "eslint-plugin-prettier/recommended";
import storybook from "eslint-plugin-storybook";
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import jsonc from "eslint-plugin-jsonc";
export default defineConfig([
// ".claude" holds git worktrees (stale copies of the repo) and agent config - never lint them
{
ignores: [".angular", ".claude", "dist", "doc/compodoc", "test-results/**"],
},
prettier,
{
files: ["src/**/*.ts"],
extends: [...angular.configs.tsRecommended],
processor: angular.processInlineTemplates,
rules: {
"@angular-eslint/prefer-standalone": ["warn"],
"@angular-eslint/component-selector": [
"error",
{
prefix: "app",
style: "kebab-case",
type: "element",
},
],
"@angular-eslint/directive-selector": [
"error",
{
prefix: "app",
style: "camelCase",
type: "attribute",
},
],
"@angular-eslint/no-output-native": "off",
},
},
{
// failures of our backend may arrive as typed errors (see typedHttpErrorInterceptor)
files: ["src/**/*.ts"],
ignores: [
"src/**/*.spec.ts",
"src/app/utils/typed-http-error.interceptor.ts",
"src/app/utils/failed-http-response.ts",
],
rules: {
"no-restricted-syntax": [
"error",
{
selector:
"BinaryExpression[operator='instanceof'][right.name='HttpErrorResponse']",
message:
"A failed request to our backend may arrive as a typed error: read the response with failedHttpResponse(err) (src/app/utils/failed-http-response.ts).",
},
],
},
},
{
files: ["e2e/**/*.ts"],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: path.join(import.meta.dirname, "e2e"),
},
},
rules: {
"no-restricted-imports": [
"error",
"@playwright/test",
"@argos-ci/playwright",
],
},
},
{
// index.html is the static app shell, not an Angular template
files: ["src/**/*.html"],
ignores: ["src/index.html"],
extends: [...angular.configs.templateRecommended],
rules: {
// flags user-facing text that is not marked for translation
"@angular-eslint/template/i18n": [
"error",
{
checkId: false,
checkText: true,
checkAttributes: true,
// structural / behavioural attributes that never hold user-facing text
ignoreAttributes: [
"align",
"angulartics2On",
"angularticsAction",
"angularticsCategory",
"appearance",
"aria-describedby",
"aria-live",
"buttonType",
"cdkDragBoundary",
"cdkDragLockAxis",
"cdkDropListOrientation",
"clickMode",
"containerId",
"content",
"data-testid",
"display",
"entityType",
"floatLabel",
"icon",
"imgProperty",
"matBadgeColor",
"matColumnDef",
"matTooltipPosition",
"media",
"mode",
"panelClass",
"property",
"queryParamsHandling",
"rel",
"scope",
"showLabel",
"size",
"startView",
"tabIndexKey",
"templateType",
"theme",
"uniqueAreaId",
],
},
],
},
},
{
// Inline templates in tests, stories and story helpers are fixtures, not user-facing UI.
// angular-eslint's processor matches config against a virtual "<file>.ts/<block>.html"
// path, so the patterns need the trailing "/**".
files: [
"**/*.spec.ts/**",
"**/*.stories.ts/**",
"**/*stories-helper*.ts/**",
],
rules: { "@angular-eslint/template/i18n": "off" },
},
...storybook.configs["flat/recommended"],
{
files: ["**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)"],
rules: {
"storybook/story-exports": "off",
},
},
// JSON files linting
...jsonc.configs["flat/recommended-with-json"],
// JSONC files (JSON with comments - tsconfig, VS Code config, etc.)
...jsonc.configs["flat/recommended-with-jsonc"],
// VS Code config files allow comments and trailing commas
{
files: [".vscode/*.json"],
rules: {
"jsonc/no-comments": "off",
"jsonc/comma-dangle": "off",
},
},
]);