Skip to content

Commit 13678a3

Browse files
authored
Merge pull request #1007 from akunzai/chore/clientapp-oxlint-oxfmt
chore(samples): replace ESLint with oxlint and add oxfmt
2 parents 83a118c + 5587626 commit 13678a3

19 files changed

Lines changed: 509 additions & 793 deletions

.github/dependabot.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ updates:
2222
typescript:
2323
patterns:
2424
- typescript
25-
- typescript-eslint
2625
frontend:
2726
patterns:
2827
- '*'

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"recommendations": [
33
"mhutchie.git-graph",
4-
"ms-dotnettools.csdevkit"
4+
"ms-dotnettools.csdevkit",
5+
"oxc.oxc-vscode"
56
]
67
}

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dotnet test --collect:"XPlat Code Coverage" --filter "FullyQualifiedName!~E2E"
1313
dotnet tool restore && dotnet tool run reportgenerator
1414
dotnet test --filter "FullyQualifiedName~Cas20ServiceTicketValidatorTests.ValidateAsync"
1515
cd owin && msbuild -noLogo -verbosity:minimal -restore # Windows + MSBuild only
16-
# samples/AspNetCoreReactSample/ClientApp
16+
# samples/AspNetCoreReactSample/ClientApp (oxlint + oxfmt)
1717
aube lint && aube build
1818
```
1919

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"singleQuote": true,
4+
"printWidth": 100,
5+
"sortPackageJson": false,
6+
"ignorePatterns": ["dist"]
7+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["typescript", "react", "import", "jsx-a11y", "unicorn", "oxc"],
4+
"categories": {
5+
"correctness": "error",
6+
"suspicious": "warn"
7+
},
8+
"env": {
9+
"browser": true
10+
},
11+
"ignorePatterns": ["dist"],
12+
"rules": {
13+
"react/react-in-jsx-scope": "off",
14+
"import/no-unassigned-import": [
15+
"warn",
16+
{
17+
"allow": ["**/*.css"]
18+
}
19+
]
20+
}
21+
}

samples/AspNetCoreReactSample/ClientApp/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,10 @@ aube start
1616

1717
# build the project in production mode. The build artifacts will be stored in the `dist/` directory
1818
aube build
19+
20+
# lint (oxlint) and check formatting (oxfmt)
21+
aube lint
22+
23+
# write oxfmt changes
24+
aube format
1925
```

samples/AspNetCoreReactSample/ClientApp/aspnetcore-https.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const certificateName = certificateArg
1717

1818
if (!certificateName) {
1919
console.error(
20-
'Invalid certificate name. Run this script in the context of an npm/yarn script or pass --name=<<app>> explicitly.'
20+
'Invalid certificate name. Run this script in the context of an npm/yarn script or pass --name=<<app>> explicitly.',
2121
);
2222
process.exit(-1);
2323
}
@@ -32,15 +32,7 @@ if (!existsSync(baseFolder)) {
3232
if (!existsSync(certFilePath) || !existsSync(keyFilePath)) {
3333
spawn(
3434
'dotnet',
35-
[
36-
'dev-certs',
37-
'https',
38-
'--export-path',
39-
certFilePath,
40-
'--format',
41-
'Pem',
42-
'--no-password',
43-
],
44-
{ stdio: 'inherit' }
35+
['dev-certs', 'https', '--export-path', certFilePath, '--format', 'Pem', '--no-password'],
36+
{ stdio: 'inherit' },
4537
).on('exit', (code) => process.exit(code));
4638
}

samples/AspNetCoreReactSample/ClientApp/aspnetcore-react.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ const baseFolder =
1212
const certificateArg = process.argv
1313
.map((arg) => arg.match(/--name=(?<value>.+)/i))
1414
.filter(Boolean)[0];
15-
const certificateName = certificateArg
16-
? certificateArg.groups.value
17-
: process.env.npm_package_name;
15+
const certificateName = certificateArg ? certificateArg.groups.value : process.env.npm_package_name;
1816

1917
if (!certificateName) {
2018
console.error(
21-
'Invalid certificate name. Run this script in the context of an npm/yarn script or pass --name=<<app>> explicitly.'
19+
'Invalid certificate name. Run this script in the context of an npm/yarn script or pass --name=<<app>> explicitly.',
2220
);
2321
process.exit(-1);
2422
}
@@ -30,7 +28,7 @@ if (!existsSync('.env.development.local')) {
3028
writeFileSync(
3129
'.env.development.local',
3230
`SSL_CRT_FILE=${certFilePath}
33-
SSL_KEY_FILE=${keyFilePath}`
31+
SSL_KEY_FILE=${keyFilePath}`,
3432
);
3533
} else {
3634
let lines = readFileSync('.env.development.local').toString().split('\n');
@@ -46,15 +44,9 @@ SSL_KEY_FILE=${keyFilePath}`
4644
}
4745
}
4846
if (!hasCert) {
49-
appendFileSync(
50-
'.env.development.local',
51-
`\nSSL_CRT_FILE=${certFilePath}`
52-
);
47+
appendFileSync('.env.development.local', `\nSSL_CRT_FILE=${certFilePath}`);
5348
}
5449
if (!hasCertKey) {
55-
appendFileSync(
56-
'.env.development.local',
57-
`\nSSL_KEY_FILE=${keyFilePath}`
58-
);
50+
appendFileSync('.env.development.local', `\nSSL_KEY_FILE=${keyFilePath}`);
5951
}
6052
}

samples/AspNetCoreReactSample/ClientApp/eslint.config.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

samples/AspNetCoreReactSample/ClientApp/index.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5-
<meta
6-
name="viewport"
7-
content="width=device-width, initial-scale=1, shrink-to-fit=no"
8-
/>
5+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
96
<meta name="theme-color" content="#000000" />
107
<base href="/" />
118
<!--

0 commit comments

Comments
 (0)