Skip to content

Commit 84d4a28

Browse files
authored
chore(deps): upgrade oxlint to v.1.16.0, fix preserve-caught-error (#10685)
1 parent 6e091b1 commit 84d4a28

Some content is hidden

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

42 files changed

+109
-88
lines changed

.github/renovate.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@
111111
"groupName": "typescript-tooling",
112112
"matchPackageNames": ["@sanity/pkg-utils", "typescript"]
113113
},
114+
{
115+
"description": "Always upgrade oxlint together",
116+
"groupName": "oxlint",
117+
"matchPackageNames": ["oxlint", "eslint-plugin-oxlint"]
118+
},
114119
{
115120
"description": "Due to our usage of useEffectEvent we need to use the experimental version of the plugin. Otherwise the exhaustive-deps rule will have false negatives",
116121
"matchPackageNames": [

.oxlintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@
152152
"eslint/no-unsafe-optional-chaining": "warn",
153153
"promise/always-return": ["error", {"ignoreLastCallback": true}],
154154
// Temporarily disabled, will be re-enabled in the near term
155-
"unicorn/prefer-set-has": "off"
155+
"unicorn/prefer-set-has": "off",
156+
"no-array-reverse": "off" // Requires polyfills for older browsers
156157
},
157158
"overrides": [
158159
{"files": ["scripts/**/*", "examples/functions/**/*"], "rules": {"no-console": "off"}}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
"lodash-es": "^4.17.21",
152152
"minimist": "^1.2.8",
153153
"npm-run-all2": "^6.2.6",
154-
"oxlint": "1.14.0",
154+
"oxlint": "1.16.0",
155155
"pkg-pr-new": "^0.0.54",
156156
"prettier": "catalog:",
157157
"read-package-up": "^11.0.0",

packages/@repo/eslint-config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"eslint-config-turbo": "^2.5.6",
1818
"eslint-import-resolver-typescript": "^4.4.4",
1919
"eslint-plugin-import": "^2.32.0",
20-
"eslint-plugin-oxlint": "1.14.0",
20+
"eslint-plugin-oxlint": "1.16.0",
2121
"eslint-plugin-react": "^7.37.5",
2222
"eslint-plugin-react-hooks": "6.0.0-rc.2",
2323
"eslint-plugin-react-hooks-with-use-effect-event": "npm:eslint-plugin-react-hooks@0.0.0-experimental-8a8e9a7e-20250912",

packages/@sanity/cli/src/actions/init-project/initProject.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,12 @@ export default async function initSanity(
199199
if (useDefaultPlan) {
200200
print(`Using default plan.`)
201201
} else {
202-
throw new Error(`Coupon "${intendedCoupon}" does not exist`)
202+
throw new Error(`Coupon "${intendedCoupon}" does not exist`, {cause: err})
203203
}
204204
} else {
205-
throw new Error(`Unable to validate coupon, please try again later:\n\n${err.message}`)
205+
throw new Error(`Unable to validate coupon, please try again later:\n\n${err.message}`, {
206+
cause: err,
207+
})
206208
}
207209
}
208210
} else if (intendedPlan) {
@@ -228,10 +230,12 @@ export default async function initSanity(
228230
if (useDefaultPlan) {
229231
print(`Using default plan.`)
230232
} else {
231-
throw new Error(`Plan id "${intendedPlan}" does not exist`)
233+
throw new Error(`Plan id "${intendedPlan}" does not exist`, {cause: err})
232234
}
233235
} else {
234-
throw new Error(`Unable to validate plan, please try again later:\n\n${err.message}`)
236+
throw new Error(`Unable to validate plan, please try again later:\n\n${err.message}`, {
237+
cause: err,
238+
})
235239
}
236240
}
237241
}
@@ -855,7 +859,7 @@ export default async function initSanity(
855859
userAction: 'select',
856860
}
857861
}
858-
throw new Error(`Failed to communicate with the Sanity API:\n${err.message}`)
862+
throw new Error(`Failed to communicate with the Sanity API:\n${err.message}`, {cause: err})
859863
}
860864

861865
if (projects.length === 0 && unattended) {

packages/@sanity/cli/src/actions/telemetry/setTelemetryConsent.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export function createSetTelemetryConsentAction(status: SettableConsentStatus):
8686
const errorMessage = resultMessages[status].failure(err.response?.body?.message)
8787
if (err.statusCode === 403) {
8888
// throw without stack trace from original error
89+
// oxlint-disable-next-line preserve-caught-error is intentional
8990
throw new Error(errorMessage)
9091
} else {
9192
// if not 403, throw original error

packages/@sanity/cli/src/actions/typegen/generateAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default async function typegenGenerateAction(
5353
// If the user has not provided a specific schema path (eg we're using the default), give some help
5454
const hint =
5555
codegenConfig.schema === './schema.json' ? ` - did you run "sanity schema extract"?` : ''
56-
throw new Error(`Schema file not found: ${codegenConfig.schema}${hint}`)
56+
throw new Error(`Schema file not found: ${codegenConfig.schema}${hint}`, {cause: err})
5757
}
5858
throw err
5959
}

packages/@sanity/cli/src/util/getCliVersion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export async function getCliPkg(): Promise<PackageJson> {
1616
try {
1717
data = await fs.readFile(path.join(cliPath, 'package.json'), 'utf-8')
1818
} catch (err) {
19-
throw new Error(`Unable to read @sanity/cli/package.json: ${err.message}`)
19+
throw new Error(`Unable to read @sanity/cli/package.json: ${err.message}`, {cause: err})
2020
}
2121

2222
return JSON.parse(data)

packages/@sanity/cli/src/util/journeyConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export async function getAndWriteJourneySchema(data: JourneySchemaWorkerData): P
5858
const indexContent = await assembleJourneyIndexContent(documentTypes)
5959
await fs.writeFile(path.join(schemasPath, `index.${fileExtension}`), indexContent)
6060
} catch (error) {
61-
throw new Error(`Failed to fetch remote schema: ${error.message}`)
61+
throw new Error(`Failed to fetch remote schema: ${error.message}`, {cause: error})
6262
}
6363
}
6464

packages/@sanity/cli/src/util/loadEnv.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ export function loadEnv(
6363
// custom error handling until https://github.com/motdotla/dotenv-expand/issues/65 is fixed upstream
6464
// check for message "TypeError: Cannot read properties of undefined (reading 'split')"
6565
if (e.message.includes('split')) {
66-
throw new Error('dotenv-expand failed to expand env vars. Maybe you need to escape `$`?')
66+
throw new Error('dotenv-expand failed to expand env vars. Maybe you need to escape `$`?', {
67+
cause: e,
68+
})
6769
}
6870
throw e
6971
}

0 commit comments

Comments
 (0)