chore(eslint): curly [skip-lint] (#7959)
Now enforcing curly brackets on all if statements. Includes auto-fixer. ```ts // ❌ Bad if (foo) foo++; // ✅ Good if (foo) { foo++; } ``` Note: this did not lint the `drizzle` package or any `db-*` packages. This will be done in the future.
This commit is contained in:
@@ -167,7 +167,9 @@ async function installAndConfigurePayload(
|
||||
}
|
||||
|
||||
const logDebug = (message: string) => {
|
||||
if (debug) origDebug(message)
|
||||
if (debug) {
|
||||
origDebug(message)
|
||||
}
|
||||
}
|
||||
|
||||
if (!fs.existsSync(projectDir)) {
|
||||
|
||||
@@ -4,13 +4,19 @@ import slugify from '@sindresorhus/slugify'
|
||||
import type { CliArgs } from '../types.js'
|
||||
|
||||
export async function parseProjectName(args: CliArgs): Promise<string> {
|
||||
if (args['--name']) return slugify(args['--name'])
|
||||
if (args._[0]) return slugify(args._[0])
|
||||
if (args['--name']) {
|
||||
return slugify(args['--name'])
|
||||
}
|
||||
if (args._[0]) {
|
||||
return slugify(args._[0])
|
||||
}
|
||||
|
||||
const projectName = await p.text({
|
||||
message: 'Project name?',
|
||||
validate: (value) => {
|
||||
if (!value) return 'Please enter a project name.'
|
||||
if (!value) {
|
||||
return 'Please enter a project name.'
|
||||
}
|
||||
},
|
||||
})
|
||||
if (p.isCancel(projectName)) {
|
||||
|
||||
@@ -9,7 +9,9 @@ export async function parseTemplate(
|
||||
if (args['--template']) {
|
||||
const templateName = args['--template']
|
||||
const template = validTemplates.find((t) => t.name === templateName)
|
||||
if (!template) throw new Error('Invalid template given')
|
||||
if (!template) {
|
||||
throw new Error('Invalid template given')
|
||||
}
|
||||
return template
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,9 @@ export async function selectDb(args: CliArgs, projectName: string): Promise<DbDe
|
||||
value: dbChoice.value,
|
||||
})),
|
||||
})
|
||||
if (p.isCancel(dbType)) process.exit(0)
|
||||
if (p.isCancel(dbType)) {
|
||||
process.exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
const dbChoice = dbChoiceRecord[dbType]
|
||||
@@ -73,7 +75,9 @@ export async function selectDb(args: CliArgs, projectName: string): Promise<DbDe
|
||||
initialValue: initialDbUri,
|
||||
message: `Enter ${dbChoice.title.split(' ')[0]} connection string`, // strip beta from title
|
||||
})
|
||||
if (p.isCancel(dbUri)) process.exit(0)
|
||||
if (p.isCancel(dbUri)) {
|
||||
process.exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -16,7 +16,9 @@ import { installPackages } from './install-packages.js'
|
||||
export async function updatePayloadInProject(
|
||||
appDetails: NextAppDetails,
|
||||
): Promise<{ message: string; success: boolean }> {
|
||||
if (!appDetails.nextConfigPath) return { message: 'No Next.js config found', success: false }
|
||||
if (!appDetails.nextConfigPath) {
|
||||
return { message: 'No Next.js config found', success: false }
|
||||
}
|
||||
|
||||
const projectDir = path.dirname(appDetails.nextConfigPath)
|
||||
|
||||
|
||||
@@ -36,7 +36,9 @@ export async function writeEnvFile(args: {
|
||||
.split('\n')
|
||||
.filter((e) => e)
|
||||
.map((line) => {
|
||||
if (line.startsWith('#') || !line.includes('=')) return line
|
||||
if (line.startsWith('#') || !line.includes('=')) {
|
||||
return line
|
||||
}
|
||||
|
||||
const split = line.split('=')
|
||||
const key = split[0]
|
||||
|
||||
Reference in New Issue
Block a user