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:
Elliot DeNolf
2024-08-29 10:15:36 -04:00
committed by GitHub
parent dd3d985091
commit 142616e6ad
267 changed files with 1681 additions and 611 deletions

View File

@@ -167,7 +167,9 @@ async function installAndConfigurePayload(
}
const logDebug = (message: string) => {
if (debug) origDebug(message)
if (debug) {
origDebug(message)
}
}
if (!fs.existsSync(projectDir)) {

View File

@@ -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)) {

View File

@@ -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
}

View File

@@ -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 {

View File

@@ -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)

View File

@@ -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]