forked from cloudflare/cloudflare-os
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.oxlintrc.json
More file actions
138 lines (133 loc) · 4.63 KB
/
Copy path.oxlintrc.json
File metadata and controls
138 lines (133 loc) · 4.63 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
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"categories": {
"correctness": "error",
"suspicious": "error"
},
"plugins": ["typescript", "unicorn", "oxc", "import"],
// Note: type-aware linting is intentionally not enabled. The type-aware engine
// uses tsgo (TypeScript 7), which requires an explicit `rootDir` when emitting
// declarations and has dropped `baseUrl`. This monorepo emits declarations
// while importing sibling-package *source* files via `paths`, so a `rootDir`
// that satisfies tsgo would break the real `tsc` build (TS6059). Full type
// safety is still enforced by `tsc` via the `types:check` script.
"env": {
"es2024": true
},
"rules": {
// False positives: gatekeepers import `.txt` files as bundled text assets,
// which the import resolver reports as "no default export".
"import/default": "off",
// Side-effect imports are used deliberately: CSS (`./styles.css`) and the
// Workers runtime registration import (`cloudflare:workers`).
"import/no-unassigned-import": "off",
// Comment-only placeholder/reference modules are kept intentionally
// (e.g. App.tsx, gatekeeper-cloudflare/src/types.d.ts).
"unicorn/no-empty-file": "off",
// Conflicts with our convention of prefixing intentionally-unused bindings
// with `_` (see no-unused-vars below).
"no-underscore-dangle": "off",
// Do not require churny `_` prefixes on unused callback/interface parameters
// or catch bindings, but still flag unused imports and local variables.
"no-unused-vars": [
"error",
{
"args": "none",
"caughtErrors": "none",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
],
// Genuine improvements, but churny/judgmental for an initial rollout. Kept
// visible as warnings for incremental cleanup rather than blocking CI.
"no-shadow": "warn",
"typescript/no-this-alias": "warn",
"typescript/no-extraneous-class": "warn",
"unicorn/consistent-function-scoping": "warn"
},
"ignorePatterns": [
"**/dist/**",
"**/generated/**",
"**/*.gen.ts",
"**/node_modules/**",
"**/.wrangler/**",
"**/worker-configuration.d.ts"
],
"overrides": [
{
"files": ["packages/workshop-frontend/**/*.{ts,tsx}"],
"plugins": ["typescript", "unicorn", "oxc", "import", "react", "jsx-a11y"],
"env": {
"browser": true,
"es2024": true
}
},
{
// Gatekeeper configurator UIs use a classic JSX runtime with the `h`
// pragma rather than the automatic react-jsx runtime.
"files": ["packages/gatekeeper-*/**/*.tsx"],
"plugins": ["typescript", "unicorn", "oxc", "import", "react"],
"env": {
"browser": true,
"es2024": true
}
},
{
// Cloudflare Workers backends: worker/service-worker global scope.
"files": [
"packages/workshop-backend/**/*.ts",
"packages/router/**/*.ts",
"packages/gatekeeper-*/src/**/*.ts",
"packages/workshop-shared/**/*.ts",
"packages/typed-storage/**/*.ts"
],
"env": {
"serviceworker": true,
"es2024": true
}
},
{
"files": ["**/*.test.ts", "**/*.test.tsx", "**/vitest.config.ts"],
"plugins": ["typescript", "unicorn", "oxc", "import", "vitest"],
"env": {
"vitest": true,
"es2024": true
}
},
{
"files": ["scripts/**/*.mjs", "*.js", "*.mjs"],
"env": {
"node": true,
"es2024": true
}
},
{
// The integration-test toolkit owns the capnweb boundary. A repo that vendors this one as a
// submodule installs its own workspace and this repo's separately, so it ends up with two
// copies of capnweb, and a stub minted by one copy is unserialisable by the other's session --
// an error that only shows up once the installs are split, i.e. in CI. So value imports are
// restricted to rpc-client.ts, which wraps stub minting in stubFor().
"files": ["packages/integration-tests/**/*.ts"],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "capnweb",
"message": "Mint stubs via stubFor() from rpc-client: a consumer repo can hold two capnweb copies, and a stub from the wrong one fails to serialise. `import type` is fine.",
"allowTypeImports": true
}
]
}
]
}
},
{
"files": ["packages/integration-tests/src/rpc-client.ts"],
"rules": {
"no-restricted-imports": "off"
}
}
]
}