Skip to content

Commit 3c55832

Browse files
authored
chore(oxlint): Add typeawareness into oxlintrc (#20075)
This option solves the issue that my Cursor/VSCode is not showing type errors. @logaretm could you check if you still have type errors, as you mentioned that you didn't had issues - wondering if it stays the same
1 parent cc327ae commit 3c55832

File tree

46 files changed

+266
-174
lines changed

Some content is hidden

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

46 files changed

+266
-174
lines changed

.oxlintrc.base.json

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["typescript", "import", "jsdoc", "vitest"],
4+
"rules": {
5+
"no-unused-vars": [
6+
"warn",
7+
{ "argsIgnorePattern": "^_", "varsIgnorePattern": "^_", "caughtErrorsIgnorePattern": "^_" }
8+
],
9+
10+
// === Base rules from eslint-config-sdk/base.js ===
11+
"no-console": "error",
12+
"no-alert": "error",
13+
"no-param-reassign": "error",
14+
"prefer-template": "error",
15+
"no-bitwise": "error",
16+
"complexity": ["error", { "max": 33 }],
17+
"no-unused-expressions": ["error", { "allowShortCircuit": true }],
18+
"guard-for-in": "error",
19+
"array-callback-return": ["error", { "allowImplicit": true }],
20+
"quotes": ["error", "single", { "avoidEscape": true }],
21+
"no-return-await": "error",
22+
"max-lines": ["error", { "max": 300, "skipComments": true, "skipBlankLines": true }],
23+
24+
// === Import rules ===
25+
"import/namespace": "off",
26+
"import/no-unresolved": "off",
27+
28+
// === Rules turned off (not enforced in ESLint or causing false positives) ===
29+
"no-control-regex": "off",
30+
"jsdoc/check-tag-names": "off",
31+
"jsdoc/require-yields": "off",
32+
"no-useless-rename": "off",
33+
"no-constant-binary-expression": "off",
34+
"vitest/hoisted-apis-on-top": "off",
35+
"vitest/no-conditional-tests": "off",
36+
"no-unsafe-optional-chaining": "off",
37+
"no-eval": "off",
38+
"no-import-assign": "off",
39+
"typescript/no-duplicate-type-constituents": "off"
40+
},
41+
"overrides": [
42+
{
43+
"files": ["**/*.ts", "**/*.tsx", "**/*.d.ts"],
44+
"rules": {
45+
"typescript/ban-ts-comment": "error",
46+
"typescript/consistent-type-imports": "error",
47+
"typescript/no-unnecessary-type-assertion": "error",
48+
"typescript/prefer-for-of": "error",
49+
"typescript/no-floating-promises": ["error", { "ignoreVoid": true }],
50+
"typescript/no-dynamic-delete": "error",
51+
"typescript/no-unsafe-member-access": "error",
52+
"typescript/unbound-method": "error",
53+
"typescript/no-explicit-any": "error",
54+
"typescript/no-empty-function": "off",
55+
"typescript/prefer-optional-chain": ["error"],
56+
"typescript/no-redundant-type-constituents": "off",
57+
"typescript/restrict-template-expressions": "off",
58+
"typescript/await-thenable": "warn",
59+
"typescript/no-base-to-string": "off"
60+
}
61+
},
62+
{
63+
"files": ["**/*.js", "**/*.mjs", "**/*.cjs"],
64+
"rules": {
65+
"typescript/ban-ts-comment": "off",
66+
"typescript/consistent-type-imports": "off",
67+
"typescript/prefer-optional-chain": "off",
68+
"typescript/no-unnecessary-type-assertion": "off",
69+
"typescript/prefer-for-of": "off",
70+
"typescript/no-floating-promises": "off",
71+
"typescript/no-dynamic-delete": "off",
72+
"typescript/no-unsafe-member-access": "off",
73+
"typescript/unbound-method": "off",
74+
"typescript/no-explicit-any": "off"
75+
}
76+
},
77+
{
78+
"files": [
79+
"**/*.test.ts",
80+
"**/*.test.tsx",
81+
"**/*.test.js",
82+
"**/*.test.jsx",
83+
"**/test/**",
84+
"**/tests/**",
85+
"**/suites/**",
86+
"**/loader-suites/**"
87+
],
88+
"rules": {
89+
"typescript/explicit-function-return-type": "off",
90+
"no-unused-expressions": "off",
91+
"typescript/no-unused-expressions": "off",
92+
"typescript/no-unnecessary-type-assertion": "off",
93+
"typescript/no-unsafe-member-access": "off",
94+
"typescript/no-explicit-any": "off",
95+
"typescript/no-non-null-assertion": "off",
96+
"typescript/no-floating-promises": "off",
97+
"typescript/unbound-method": "off",
98+
"max-lines": "off",
99+
"complexity": "off",
100+
"typescript/prefer-optional-chain": "off",
101+
"typescript/no-misused-spread": "off",
102+
"typescript/require-array-sort-compare": "off",
103+
"typescript/no-base-to-string": "off",
104+
"typescript/await-thenable": "off"
105+
}
106+
},
107+
{
108+
"files": ["*.tsx"],
109+
"rules": {
110+
"jsdoc/require-jsdoc": "off"
111+
}
112+
},
113+
{
114+
"files": ["*.config.js", "*.config.mjs", "*.config.ts", "vite.config.ts", ".size-limit.js"],
115+
"rules": {
116+
"no-console": "off",
117+
"max-lines": "off"
118+
}
119+
},
120+
{
121+
"files": [
122+
"**/scenarios/**",
123+
"**/rollup-utils/**",
124+
"**/bundle-analyzer-scenarios/**",
125+
"**/bundle-analyzer-scenarios/*.cjs",
126+
"**/bundle-analyzer-scenarios/*.js"
127+
],
128+
"rules": {
129+
"no-console": "off"
130+
}
131+
},
132+
{
133+
"files": ["**/src/**"],
134+
"rules": {
135+
"no-restricted-globals": ["error", "window", "document", "location", "navigator"]
136+
}
137+
}
138+
]
139+
}

.oxlintrc.json

Lines changed: 4 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"$schema": "./node_modules/oxlint/configuration_schema.json",
3-
"plugins": ["typescript", "import", "jsdoc", "vitest"],
3+
"extends": ["./.oxlintrc.base.json"],
4+
"options": {
5+
"typeAware": true
6+
},
47
"jsPlugins": [
58
{
69
"name": "sdk",
@@ -9,140 +12,12 @@
912
],
1013
"categories": {},
1114
"rules": {
12-
"no-unused-vars": [
13-
"warn",
14-
{ "argsIgnorePattern": "^_", "varsIgnorePattern": "^_", "caughtErrorsIgnorePattern": "^_" }
15-
],
16-
17-
// === Base rules from eslint-config-sdk/base.js ===
18-
"no-console": "error",
19-
"no-alert": "error",
20-
"no-param-reassign": "error",
21-
"prefer-template": "error",
22-
"no-bitwise": "error",
23-
"complexity": ["error", { "max": 33 }],
24-
"no-unused-expressions": ["error", { "allowShortCircuit": true }],
25-
"guard-for-in": "error",
26-
"array-callback-return": ["error", { "allowImplicit": true }],
27-
"quotes": ["error", "single", { "avoidEscape": true }],
28-
"no-return-await": "error",
29-
"max-lines": ["error", { "max": 300, "skipComments": true, "skipBlankLines": true }],
30-
31-
// === Import rules ===
32-
"import/namespace": "off",
33-
"import/no-unresolved": "off",
34-
35-
// === Rules turned off (not enforced in ESLint or causing false positives) ===
36-
"no-control-regex": "off",
37-
"jsdoc/check-tag-names": "off",
38-
"jsdoc/require-yields": "off",
39-
"no-useless-rename": "off",
40-
"no-constant-binary-expression": "off",
41-
"vitest/hoisted-apis-on-top": "off",
42-
"vitest/no-conditional-tests": "off",
43-
"no-unsafe-optional-chaining": "off",
44-
"no-eval": "off",
45-
"no-import-assign": "off",
46-
"typescript/no-duplicate-type-constituents": "off",
47-
48-
// === Custom SDK rules (via JS plugin) ===
4915
"sdk/no-eq-empty": "error"
5016
},
5117
"overrides": [
52-
{
53-
"files": ["**/*.ts", "**/*.tsx", "**/*.d.ts"],
54-
"rules": {
55-
"typescript/ban-ts-comment": "error",
56-
"typescript/consistent-type-imports": "error",
57-
"typescript/no-unnecessary-type-assertion": "error",
58-
"typescript/prefer-for-of": "error",
59-
"typescript/no-floating-promises": ["error", { "ignoreVoid": true }],
60-
"typescript/no-dynamic-delete": "error",
61-
"typescript/no-unsafe-member-access": "error",
62-
"typescript/unbound-method": "error",
63-
"typescript/no-explicit-any": "error",
64-
"typescript/no-empty-function": "off",
65-
"typescript/prefer-optional-chain": ["error"],
66-
"typescript/no-redundant-type-constituents": "off",
67-
"typescript/restrict-template-expressions": "off",
68-
"typescript/await-thenable": "warn",
69-
"typescript/no-base-to-string": "off"
70-
}
71-
},
72-
{
73-
"files": ["**/*.js", "**/*.mjs", "**/*.cjs"],
74-
"rules": {
75-
"typescript/ban-ts-comment": "off",
76-
"typescript/consistent-type-imports": "off",
77-
"typescript/prefer-optional-chain": "off",
78-
"typescript/no-unnecessary-type-assertion": "off",
79-
"typescript/prefer-for-of": "off",
80-
"typescript/no-floating-promises": "off",
81-
"typescript/no-dynamic-delete": "off",
82-
"typescript/no-unsafe-member-access": "off",
83-
"typescript/unbound-method": "off",
84-
"typescript/no-explicit-any": "off"
85-
}
86-
},
87-
{
88-
"files": [
89-
"**/*.test.ts",
90-
"**/*.test.tsx",
91-
"**/*.test.js",
92-
"**/*.test.jsx",
93-
"**/test/**",
94-
"**/tests/**",
95-
"**/suites/**",
96-
"**/loader-suites/**"
97-
],
98-
"rules": {
99-
"typescript/explicit-function-return-type": "off",
100-
"no-unused-expressions": "off",
101-
"typescript/no-unused-expressions": "off",
102-
"typescript/no-unnecessary-type-assertion": "off",
103-
"typescript/no-unsafe-member-access": "off",
104-
"typescript/no-explicit-any": "off",
105-
"typescript/no-non-null-assertion": "off",
106-
"typescript/no-floating-promises": "off",
107-
"typescript/unbound-method": "off",
108-
"max-lines": "off",
109-
"complexity": "off",
110-
"typescript/prefer-optional-chain": "off",
111-
"typescript/no-misused-spread": "off",
112-
"typescript/require-array-sort-compare": "off",
113-
"typescript/no-base-to-string": "off",
114-
"typescript/await-thenable": "off"
115-
}
116-
},
117-
{
118-
"files": ["*.tsx"],
119-
"rules": {
120-
"jsdoc/require-jsdoc": "off"
121-
}
122-
},
123-
{
124-
"files": ["*.config.js", "*.config.mjs", "*.config.ts", "vite.config.ts", ".size-limit.js"],
125-
"rules": {
126-
"no-console": "off",
127-
"max-lines": "off"
128-
}
129-
},
130-
{
131-
"files": [
132-
"**/scenarios/**",
133-
"**/rollup-utils/**",
134-
"**/bundle-analyzer-scenarios/**",
135-
"**/bundle-analyzer-scenarios/*.cjs",
136-
"**/bundle-analyzer-scenarios/*.js"
137-
],
138-
"rules": {
139-
"no-console": "off"
140-
}
141-
},
14218
{
14319
"files": ["**/src/**"],
14420
"rules": {
145-
"no-restricted-globals": ["error", "window", "document", "location", "navigator"],
14621
"sdk/no-class-field-initializers": "error",
14722
"sdk/no-regexp-constructor": "error"
14823
}

dev-packages/.oxlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "../node_modules/oxlint/configuration_schema.json",
3-
"extends": ["../.oxlintrc.json"],
3+
"extends": ["../.oxlintrc.base.json"],
44
"rules": {
55
"typescript/no-explicit-any": "off",
66
"max-lines": "off",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"format:check": "oxfmt . --check",
2626
"verify": "run-s format:check lint",
2727
"fix": "run-s format lint:fix",
28-
"lint": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint . --type-aware",
29-
"lint:fix": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint . --fix --type-aware",
28+
"lint": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint .",
29+
"lint:fix": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint . --fix",
3030
"lint:es-compatibility": "nx run-many -t lint:es-compatibility",
3131
"dedupe-deps:check": "yarn-deduplicate yarn.lock --list --fail",
3232
"dedupe-deps:fix": "yarn-deduplicate yarn.lock",

packages/angular/.oxlintrc.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
{
22
"$schema": "../../node_modules/oxlint/configuration_schema.json",
3-
"extends": ["../../.oxlintrc.json"],
3+
"extends": ["../../.oxlintrc.base.json"],
4+
"jsPlugins": [
5+
{
6+
"name": "sdk",
7+
"specifier": "@sentry-internal/eslint-plugin-sdk"
8+
}
9+
],
410
"env": {
511
"browser": true
612
},

packages/astro/.oxlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "../../node_modules/oxlint/configuration_schema.json",
3-
"extends": ["../../.oxlintrc.json"],
3+
"extends": ["../../.oxlintrc.base.json"],
44
"env": {
55
"browser": true,
66
"node": true

packages/aws-serverless/.oxlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "../../node_modules/oxlint/configuration_schema.json",
3-
"extends": ["../../.oxlintrc.json"],
3+
"extends": ["../../.oxlintrc.base.json"],
44
"env": {
55
"node": true
66
}

packages/browser-utils/.oxlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "../../node_modules/oxlint/configuration_schema.json",
3-
"extends": ["../../.oxlintrc.json"],
3+
"extends": ["../../.oxlintrc.base.json"],
44
"env": {
55
"browser": true
66
},

packages/browser/.oxlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "../../node_modules/oxlint/configuration_schema.json",
3-
"extends": ["../../.oxlintrc.json"],
3+
"extends": ["../../.oxlintrc.base.json"],
44
"env": {
55
"browser": true
66
},

packages/bun/.oxlintrc.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
{
22
"$schema": "../../node_modules/oxlint/configuration_schema.json",
3-
"extends": ["../../.oxlintrc.json"],
3+
"extends": ["../../.oxlintrc.base.json"],
4+
"jsPlugins": [
5+
{
6+
"name": "sdk",
7+
"specifier": "@sentry-internal/eslint-plugin-sdk"
8+
}
9+
],
410
"env": {
511
"node": true
612
},

0 commit comments

Comments
 (0)