Skip to content

Commit 32dd5bc

Browse files
committed
Replace ESLint formatting rules with Oxfmt
ESLint formatting rules are deprecated [1] and angular-eslint recommends against using ESLint for formatting [2], so we should remove these formatting rules from our ESLint config. However, we still want to enforce these formatting rules, so it makes sense to replace them with something else. Oxfmt provides more than enough configuration for our needs and far outperforms Prettier, so we think it makes the most sense for our codebase. [1]: https://eslint.org/blog/2023/10/deprecating-formatting-rules/ [2]: https://github.com/angular-eslint/angular-eslint/blob/v21.3.0/docs/FORMATTING_RULES.md
1 parent 1eaddea commit 32dd5bc

File tree

73 files changed

+949
-557
lines changed

Some content is hidden

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

73 files changed

+949
-557
lines changed

.github/workflows/deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ jobs:
3333
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
3434
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
3535
environment: ${{ matrix.env }}
36-
wranglerVersion: "latest"
36+
wranglerVersion: 'latest'

.oxfmtrc.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"bracketSameLine": true,
4+
"overrides": [
5+
{
6+
"files": ["*.json", "*.yaml"],
7+
"options": {
8+
"tabWidth": 2
9+
}
10+
},
11+
{
12+
"files": ["*.ts", "*.yaml"],
13+
"options": {
14+
"singleQuote": true
15+
}
16+
}
17+
],
18+
"tabWidth": 4
19+
}

angular.json

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,10 @@
2121
"base": "dist/console"
2222
},
2323
"index": "src/index.html",
24-
"polyfills": [
25-
"zone.js"
26-
],
24+
"polyfills": ["zone.js"],
2725
"tsConfig": "tsconfig.app.json",
2826
"inlineStyleLanguage": "scss",
29-
"assets": [
30-
"src/favicon.ico",
31-
"src/assets"
32-
],
27+
"assets": ["src/favicon.ico", "src/assets"],
3328
"styles": [
3429
"node_modules/@fontsource-variable/roboto/index.css",
3530
"node_modules/@fontsource/material-icons/index.css",
@@ -123,38 +118,25 @@
123118
"test": {
124119
"builder": "@angular/build:karma",
125120
"options": {
126-
"polyfills": [
127-
"zone.js",
128-
"zone.js/testing"
129-
],
121+
"polyfills": ["zone.js", "zone.js/testing"],
130122
"tsConfig": "tsconfig.spec.json",
131123
"inlineStyleLanguage": "scss",
132-
"assets": [
133-
"src/favicon.ico",
134-
"src/assets"
135-
],
136-
"styles": [
137-
"src/styles.scss"
138-
],
124+
"assets": ["src/favicon.ico", "src/assets"],
125+
"styles": ["src/styles.scss"],
139126
"scripts": []
140127
}
141128
},
142129
"lint": {
143130
"builder": "@angular-eslint/builder:lint",
144131
"options": {
145-
"lintFilePatterns": [
146-
"src/**/*.ts",
147-
"src/**/*.html"
148-
]
132+
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
149133
}
150134
}
151135
}
152136
}
153137
},
154138
"cli": {
155-
"schematicCollections": [
156-
"@angular-eslint/schematics"
157-
],
139+
"schematicCollections": ["@angular-eslint/schematics"],
158140
"analytics": false
159141
}
160142
}

eslint.config.mjs

Lines changed: 52 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,52 +12,61 @@ const __dirname = path.dirname(__filename);
1212
const compat = new FlatCompat({
1313
baseDirectory: __dirname,
1414
recommendedConfig: js.configs.recommended,
15-
allConfig: js.configs.all
15+
allConfig: js.configs.all,
1616
});
1717

18-
export default [{
19-
ignores: ["projects/**/*"],
20-
}, ...compat.extends(
21-
"eslint:recommended",
22-
"plugin:@typescript-eslint/recommended",
23-
"plugin:@angular-eslint/recommended",
24-
"plugin:@angular-eslint/template/process-inline-templates",
25-
).map(config => ({
26-
...config,
27-
files: ["**/*.ts"],
28-
})), {
29-
files: ["**/*.ts"],
30-
31-
rules: {
32-
"@angular-eslint/directive-selector": ["error", {
33-
type: "attribute",
34-
prefix: "acc",
35-
style: "camelCase",
36-
}],
37-
38-
"@angular-eslint/component-selector": ["error", {
39-
type: "element",
40-
prefix: "acc",
41-
style: "kebab-case",
42-
}],
18+
export default [
19+
{
20+
ignores: ["projects/**/*"],
21+
},
22+
...compat
23+
.extends(
24+
"eslint:recommended",
25+
"plugin:@typescript-eslint/recommended",
26+
"plugin:@angular-eslint/recommended",
27+
"plugin:@angular-eslint/template/process-inline-templates",
28+
)
29+
.map((config) => ({
30+
...config,
31+
files: ["**/*.ts"],
32+
})),
33+
{
34+
files: ["**/*.ts"],
4335

44-
"@typescript-eslint/explicit-function-return-type": "error",
45-
eqeqeq: ["error", "always"],
46-
indent: ["error", 4],
36+
rules: {
37+
"@angular-eslint/directive-selector": [
38+
"error",
39+
{
40+
type: "attribute",
41+
prefix: "acc",
42+
style: "camelCase",
43+
},
44+
],
4745

48-
quotes: ["error", "single", {
49-
allowTemplateLiterals: true,
50-
}],
46+
"@angular-eslint/component-selector": [
47+
"error",
48+
{
49+
type: "element",
50+
prefix: "acc",
51+
style: "kebab-case",
52+
},
53+
],
5154

52-
semi: ["error", "always"],
55+
"@typescript-eslint/explicit-function-return-type": "error",
56+
eqeqeq: ["error", "always"],
57+
},
58+
},
59+
...compat
60+
.extends(
61+
"plugin:@angular-eslint/template/recommended",
62+
"plugin:@angular-eslint/template/accessibility",
63+
)
64+
.map((config) => ({
65+
...config,
66+
files: ["**/*.html"],
67+
})),
68+
{
69+
files: ["**/*.html"],
70+
rules: {},
5371
},
54-
}, ...compat.extends(
55-
"plugin:@angular-eslint/template/recommended",
56-
"plugin:@angular-eslint/template/accessibility",
57-
).map(config => ({
58-
...config,
59-
files: ["**/*.html"],
60-
})), {
61-
files: ["**/*.html"],
62-
rules: {},
63-
}];
72+
];

0 commit comments

Comments
 (0)