Skip to content

Commit ee52f38

Browse files
committed
feat: further modernize codebase (ui/app-vite/cli/...everything)
1 parent 0b92ef4 commit ee52f38

457 files changed

Lines changed: 2776 additions & 2582 deletions

File tree

Some content is hidden

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

.oxlintrc.json

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020
"extras/themify/",
2121

2222
"ui/icon-set/svg-*.js",
23-
"ui/lang/index.json"
23+
"ui/lang/index.json",
24+
25+
"utils/render-ssr-error/compiled-assets/"
2426
],
2527

26-
"plugins": ["vue", "import", "eslint"],
28+
"plugins": ["vue", "import", "eslint", "promise", "vue", "unicorn"],
2729

2830
"categories": {
2931
"style": "error",
@@ -82,6 +84,14 @@
8284
"eslint/arrow-body-style": ["error", "as-needed"],
8385
"vue/define-props-destructuring": "off",
8486
"vue/define-props-declaration": "off",
87+
"promise/avoid-new": "off",
88+
"promise/param-names": "off",
89+
"promise/prefer-await-to-callbacks": "off",
90+
"promise/prefer-await-to-then": "off",
91+
"unicorn/no-nested-ternary": "off",
92+
"unicorn/no-null": "off",
93+
"unicorn/filename-case": "off",
94+
"unicorn/prefer-global-this": "off",
8595

8696
/** Performance rule overrides */
8797
"no-await-in-loop": "off",
@@ -95,6 +105,8 @@
95105
"no-useless-concat": "off",
96106
"require-post-message-target-origin": "off",
97107
"no-this-in-exported-function": "off",
108+
"promise/always-return": "off",
109+
"promise/no-promise-in-callback": "off",
98110

99111
/** Correctness rule overrides */
100112
"no-unused-vars": [
@@ -103,6 +115,7 @@
103115
"ignoreRestSiblings": true
104116
}
105117
],
118+
"promise/no-callback-in-promise": "off",
106119

107120
/** Restriction rule overrides */
108121
"no-void": "off",
@@ -122,6 +135,11 @@
122135
"import/no-default-export": "off",
123136
"import/no-dynamic-require": "off",
124137
"import/unambiguous": "off",
138+
"promise/catch-or-return": "off",
139+
"unicorn/no-process-exit": "off",
140+
"unicorn/no-array-for-each": "off",
141+
"unicorn/no-array-reduce": "off",
142+
"unicorn/no-abusive-eslint-disable": "off",
125143

126144
/** Pedantic rule overrides */
127145
"unicorn/explicit-length-check": [
@@ -138,7 +156,9 @@
138156
"max-lines-per-function": "off",
139157
"max-classes-per-file": "off",
140158
"sort-vars": "off",
141-
"import/max-dependencies": "off"
159+
"import/max-dependencies": "off",
160+
"unicorn/no-array-callback-reference": "off",
161+
"unicorn/prefer-query-selector": "off"
142162
},
143163

144164
"overrides": [
@@ -151,17 +171,34 @@
151171
},
152172

153173
{
154-
"files": ["{app-vite,cli,create-quasar,extras,icongenie,app-webpack}/**"],
174+
"files": ["{app-vite,cli,create-quasar,icongenie}/**"],
175+
"env": {
176+
"node": true
177+
},
178+
"plugins": ["node"],
179+
"rules": {
180+
"import/first": "off",
181+
"node/no-process-env": "off"
182+
}
183+
},
184+
185+
{
186+
"files": ["{extras,app-webpack}/**"],
155187
"env": {
156188
"node": true
157189
},
190+
"plugins": ["node"],
158191
"rules": {
159-
"import/first": "off"
192+
"import/first": "off",
193+
"node/global-require": "off",
194+
"node/no-process-env": "off",
195+
"unicorn/prefer-module": "off",
196+
"unicorn/prefer-top-level-await": "off"
160197
}
161198
},
162199

163200
{
164-
"files": ["ui/src/**/*.js"],
201+
"files": ["ui/src/**"],
165202
"globals": {
166203
"__QUASAR_VERSION__": "readonly",
167204
"__QUASAR_SSR__": "readonly",
@@ -184,7 +221,8 @@
184221
"**/*.cjs"
185222
],
186223
"rules": {
187-
"no-commonjs": "off"
224+
"no-commonjs": "off",
225+
"unicorn/prefer-module": "off"
188226
}
189227
},
190228

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ export class BexBridge {
350350
log(...args) {
351351
if (this.#debug !== true || args.length === 0) return
352352

353-
const lastArg = args[args.length - 1]
353+
const lastArg = args.at(-1)
354354

355355
if (lastArg !== void 0 && Object(lastArg) === lastArg) {
356356
const log = `${this.#banner} ${args.slice(0, -1).join(' ')} (click to expand)`
@@ -365,7 +365,7 @@ export class BexBridge {
365365
warn(...args) {
366366
if (args.length === 0) return
367367

368-
const lastArg = args[args.length - 1]
368+
const lastArg = args.at(-1)
369369

370370
if (lastArg !== void 0 && Object(lastArg) === lastArg) {
371371
console.warn(this.#banner, ...args.slice(0, -1))
@@ -418,7 +418,8 @@ export class BexBridge {
418418
)
419419

420420
let responsePayload
421-
for (const { type, callback } of list.slice(0)) {
421+
// oxlint-disable-next-line unicorn/no-useless-spread
422+
for (const { type, callback } of [...list]) {
422423
if (type === 'once') {
423424
this.off(message.event, callback)
424425
}
@@ -669,6 +670,7 @@ export class BexBridge {
669670
}
670671

671672
return promise.catch(err => {
673+
// oxlint-disable-next-line promise/no-nesting
672674
this.#sendPacket({
673675
id,
674676
from: this.portName,

app-vite/lib/cache/module.animations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export async function createInstance({ appPaths }) {
66
appPaths.appDir
77
)
88

9-
return generalAnimations.concat(inAnimations).concat(outAnimations)
9+
return [...generalAnimations, ...inAnimations, ...outAnimations]
1010
}

app-vite/lib/cache/module.nodePackager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function getMajorVersion(name) {
1919
const child = crossSpawnSync(name, ['--version'])
2020
if (child.status === 0) {
2121
const version = String(child.output[1]).trim()
22-
return parseInt(version.split('.')[0], 10)
22+
return Number.parseInt(version.split('.')[0], 10)
2323
}
2424
} catch {
2525
/* do nothing; we return null below */
@@ -206,7 +206,7 @@ class Bun extends PackageManager {
206206
function getProjectPackageManager(packageManagersList, dir) {
207207
// Recursively checks for presence of the lock file by traversing
208208
// the dir tree up to the root
209-
while (dir.length !== 0 && dir[dir.length - 1] !== sep) {
209+
while (dir.length !== 0 && dir.at(-1) !== sep) {
210210
for (const pm of packageManagersList) {
211211
if (pm.lockFiles.some(lockFile => fs.existsSync(join(dir, lockFile)))) {
212212
return pm

app-vite/lib/cmd/build.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ await ctx.appExt.runAppExtensionHook('beforeBuild', async hook => {
162162
})
163163

164164
log()
165+
166+
// oxlint-disable-next-line unicorn/prefer-top-level-await
165167
appBuilder
166168
.build()
167169
.catch(err => {

app-vite/lib/cmd/describe.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,28 +468,31 @@ function printQuasarConfOptions({ quasarConfOptions }) {
468468

469469
function describe(api) {
470470
switch (api.type) {
471-
case 'component':
471+
case 'component': {
472472
if (apiParts.quasar === true) printQuasarConfOptions(api)
473473
if (apiParts.props === true) printProperties(api)
474474
if (apiParts.slots === true) printSlots(api)
475475
if (apiParts.events === true) printEvents(api)
476476
if (apiParts.methods === true) printMethods(api)
477477
if (apiParts.computedProps === true) printComputedProps(api)
478478
break
479+
}
479480

480-
case 'directive':
481+
case 'directive': {
481482
if (apiParts.quasar === true) printQuasarConfOptions(api)
482483
if (apiParts.value === true) printValue(api)
483484
if (apiParts.arg === true) printArg(api)
484485
if (apiParts.modifiers === true) printModifiers(api)
485486
break
487+
}
486488

487-
case 'plugin':
489+
case 'plugin': {
488490
if (apiParts.injection === true) printInjection(api)
489491
if (apiParts.quasar === true) printQuasarConfOptions(api)
490492
if (apiParts.props === true) printProperties(api)
491493
if (apiParts.methods === true) printMethods(api)
492494
break
495+
}
493496
}
494497

495498
if (api.meta && api.meta.docsUrl) {
@@ -576,7 +579,9 @@ async function listElements() {
576579
}
577580

578581
if (item === 'list') {
582+
// oxlint-disable-next-line unicorn/prefer-top-level-await
579583
listElements()
580584
} else {
585+
// oxlint-disable-next-line unicorn/prefer-top-level-await
581586
run()
582587
}

app-vite/lib/cmd/dev.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,16 @@ const onQuasarConfChange = qConf => {
178178
devServer.run(qConf)
179179
}
180180

181-
devServer.run(quasarConf).then(async () => {
182-
if (typeof quasarConf.build.afterDev === 'function') {
183-
await quasarConf.build.afterDev({ quasarConf })
184-
}
181+
await devServer.run(quasarConf)
185182

186-
// run possible afterDev hooks
187-
await ctx.appExt.runAppExtensionHook('afterDev', async hook => {
188-
log(`Extension(${hook.api.extId}): Running afterDev hook...`)
189-
await hook.fn(hook.api, { quasarConf })
190-
})
183+
if (typeof quasarConf.build.afterDev === 'function') {
184+
await quasarConf.build.afterDev({ quasarConf })
185+
}
191186

192-
quasarConfFile.watch(onQuasarConfChange)
187+
// run possible afterDev hooks
188+
await ctx.appExt.runAppExtensionHook('afterDev', async hook => {
189+
log(`Extension(${hook.api.extId}): Running afterDev hook...`)
190+
await hook.fn(hook.api, { quasarConf })
193191
})
192+
193+
quasarConfFile.watch(onQuasarConfChange)

app-vite/lib/cmd/inspect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ if (isModeInstalled(ctx.appPaths, argv.mode) !== true) {
7474
fatal('Requested mode for inspection is NOT installed.')
7575
}
7676

77-
const depth = parseInt(argv.depth, 10) || Infinity
77+
const depth = Number.parseInt(argv.depth, 10) || Infinity
7878

7979
import { QuasarConfigFile } from '../quasar-config-file.js'
8080
const quasarConfFile = new QuasarConfigFile({

app-vite/lib/cmd/mode.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ function displayModes() {
140140
}
141141

142142
if (argv._.length === 2) {
143+
// oxlint-disable-next-line unicorn/prefer-top-level-await
143144
run()
144145
} else {
145146
displayModes()

app-vite/lib/cmd/new.js

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -218,23 +218,19 @@ async function getAsset(assetType) {
218218
}
219219
}
220220

221-
async function generate() {
222-
const { relativePath, ext, reference } = await getAsset(type)
223-
const fullExt = `.${ext}`
221+
const { relativePath, ext, reference } = await getAsset(type)
222+
const fullExt = `.${ext}`
224223

225-
names.forEach(name => {
226-
const file = join(
227-
relativePath,
228-
name + (name.endsWith(fullExt) ? '' : fullExt)
229-
)
230-
const targetFile = appPaths.resolve.app(file)
231-
232-
createFile({
233-
targetFile,
234-
ext,
235-
reference
236-
})
237-
})
238-
}
224+
names.forEach(name => {
225+
const file = join(
226+
relativePath,
227+
name + (name.endsWith(fullExt) ? '' : fullExt)
228+
)
229+
const targetFile = appPaths.resolve.app(file)
239230

240-
generate()
231+
createFile({
232+
targetFile,
233+
ext,
234+
reference
235+
})
236+
})

0 commit comments

Comments
 (0)