Skip to content

Commit ce70aba

Browse files
committed
chore: more lint work
1 parent 515dac7 commit ce70aba

23 files changed

Lines changed: 57 additions & 74 deletions

File tree

.oxlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145

146146
"overrides": [
147147
{
148-
"files": ["**/*.ts"],
148+
"files": ["**/*.d.ts"],
149149
"rules": {
150150
"no-unassigned-import": "off"
151151
}

app-vite/exports/bex/content.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ if (
4242
port.onMessage.removeListener(onMessage)
4343

4444
console.log(
45-
chrome.runtime.lastError?.message?.indexOf(
45+
chrome.runtime.lastError?.message?.includes(
4646
'Could not establish connection'
47-
) !== -1
47+
)
4848
? `${banner} Could not connect to background`
4949
: `${banner} Lost connection to background`
5050
)

app-vite/exports/bex/private/bex-bridge.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ export class BexBridge {
144144

145145
const onDisconnect = () => {
146146
if (
147-
runtime.lastError?.message?.indexOf(
148-
'Could not establish connection'
149-
) !== -1
147+
runtime.lastError?.message?.includes('Could not establish connection')
150148
) {
151149
this.isConnected = false
152150
portToBackground.onMessage.removeListener(onPacket)
@@ -441,7 +439,8 @@ export class BexBridge {
441439
listener: { type, callback }
442440
}
443441
)
444-
return Promise.reject(err)
442+
443+
throw err
445444
}
446445
}
447446

app-vite/lib/app-extension/AppExtensionInstance.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ export class AppExtensionInstance {
276276

277277
#stripVersion(packageFullName) {
278278
const index = packageFullName.indexOf('@')
279-
280279
return index !== -1 ? packageFullName.substring(0, index) : packageFullName
281280
}
282281

app-vite/lib/app-extension/create-app-ext.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function getAppExtJson({ file, json, onListUpdate }) {
6060

6161
getPrompts(extId) {
6262
const { __internal, ...prompts } = json[extId] || {}
63-
return JSON.parse(JSON.stringify(prompts))
63+
return structuredClone(prompts)
6464
},
6565

6666
getInternal(extId) {

app-vite/lib/cmd/describe.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ function printProperties({ props }) {
218218

219219
if (argv.filter) {
220220
keys.forEach(key => {
221-
if (key.indexOf(argv.filter) === -1) {
221+
if (key.includes(argv.filter) === false) {
222222
delete props[key]
223223
}
224224
})
@@ -246,7 +246,7 @@ function printSlots({ slots }) {
246246

247247
if (argv.filter !== void 0) {
248248
keys.forEach(key => {
249-
if (key.indexOf(argv.filter) === -1) {
249+
if (key.includes(argv.filter) === false) {
250250
delete slots[key]
251251
}
252252
})
@@ -274,7 +274,7 @@ function printEvents({ events }) {
274274

275275
if (argv.filter !== void 0) {
276276
keys.forEach(key => {
277-
if (key.indexOf(argv.filter) === -1) {
277+
if (key.includes(argv.filter) === false) {
278278
delete events[key]
279279
}
280280
})
@@ -312,7 +312,7 @@ function printMethods({ methods }) {
312312

313313
if (argv.filter !== void 0) {
314314
keys.forEach(key => {
315-
if (key.indexOf(argv.filter) === -1) {
315+
if (key.includes(argv.filter) === false) {
316316
delete methods[key]
317317
}
318318
})
@@ -357,7 +357,7 @@ function printComputedProps({ computedProps }) {
357357

358358
if (argv.filter) {
359359
keys.forEach(key => {
360-
if (key.indexOf(argv.filter) === -1) {
360+
if (key.includes(argv.filter) === false) {
361361
delete computedProps[key]
362362
}
363363
})
@@ -407,7 +407,7 @@ function printModifiers({ modifiers }) {
407407

408408
if (argv.filter !== void 0) {
409409
keys.forEach(key => {
410-
if (key.indexOf(argv.filter) === -1) {
410+
if (key.includes(argv.filter) === false) {
411411
delete modifiers[key]
412412
}
413413
})
@@ -448,7 +448,7 @@ function printQuasarConfOptions({ quasarConfOptions }) {
448448

449449
if (argv.filter !== void 0) {
450450
keys.forEach(key => {
451-
if (key.indexOf(argv.filter) === -1) {
451+
if (key.includes(argv.filter) === false) {
452452
delete conf[key]
453453
}
454454
})
@@ -553,7 +553,7 @@ async function listElements() {
553553
if (filter) {
554554
const needle = filter.toLowerCase()
555555
const filterBanner = green(filter)
556-
api = api.filter(entry => entry.toLowerCase().indexOf(needle) !== -1)
556+
api = api.filter(entry => entry.toLowerCase().includes(needle))
557557

558558
if (api.length === 0) {
559559
console.log(

app-vite/lib/config-tools.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ export function createBrowserRolldownConfig(quasarConf, { shippedToClient }) {
351351
const target =
352352
browser === BASELINE_WIDELY_AVAILABLE_TARGET_STRING
353353
? [...BASELINE_WIDELY_AVAILABLE]
354-
: JSON.parse(JSON.stringify(browser))
354+
: structuredClone(browser)
355355

356356
return {
357357
platform: 'browser',

app-vite/lib/modes/capacitor/config-file.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ export class CapacitorConfigFile {
265265

266266
const originalContent = fs.readFileSync(file, 'utf8')
267267

268-
if (originalContent.indexOf(content) > -1) {
268+
if (originalContent.includes(content)) {
269269
// it's already there
270270
return
271271
}
@@ -290,9 +290,7 @@ export class CapacitorConfigFile {
290290
if (!file) return
291291

292292
const originalContent = fs.readFileSync(file, 'utf8')
293-
const index = originalContent.indexOf(content)
294-
295-
if (index !== -1) {
293+
if (originalContent.includes(content)) {
296294
const newContent = originalContent.replace(content, '')
297295
fs.writeFileSync(file, newContent, 'utf8')
298296
}

app-vite/lib/modes/cordova/android-cleartext.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ export function fixAndroidCleartext(appPaths, action) {
1212
if (fs.existsSync(androidManifestPath) === false) return
1313

1414
let androidManifest = fs.readFileSync(androidManifestPath, 'utf8')
15-
const hasCleartext =
16-
androidManifest.indexOf('android:usesCleartextTraffic="true"') !== -1
15+
const hasCleartext = androidManifest.includes(
16+
'android:usesCleartextTraffic="true"'
17+
)
1718

1819
if (action === 'add') {
1920
if (hasCleartext === false) {

app-vite/lib/modes/cordova/config-file.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ export class CordovaConfigFile {
151151

152152
// required for allowing devserver's SSL certificate on iOS
153153
if (
154-
tamperedFile.originalContent.indexOf(
154+
tamperedFile.originalContent.includes(
155155
'allowsAnyHTTPSCertificateForHost'
156-
) === -1
156+
) === false
157157
) {
158158
tamperedFile.content =
159159
tamperedFile.originalContent +
@@ -194,9 +194,9 @@ return YES;
194194
// Credit: https://gist.github.com/PeterStegnar/63cb8c9a39a13265c3a855e24a33ca37#file-cdvwkwebviewengine-m-L68-L74
195195
// Enables untrusted SSL connection
196196
if (
197-
tamperedFile.originalContent.indexOf(
197+
tamperedFile.originalContent.includes(
198198
'SecTrustRef serverTrust = challenge.protectionSpace.serverTrust'
199-
) === -1
199+
) === false
200200
) {
201201
const lookupString = '@implementation CDVWKWebViewEngine'
202202
const insertIndex =

0 commit comments

Comments
 (0)