Skip to content

Commit 3500a59

Browse files
committed
refactor: use eslint stylistic
1 parent 9a4d21b commit 3500a59

12 files changed

Lines changed: 46 additions & 32 deletions

File tree

eslint.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
import eslint from '@eslint/js';
44
import tseslint from 'typescript-eslint';
5+
import stylistic from '@stylistic/eslint-plugin';
56

67
export default tseslint.config({
78
files: ['**/*.ts'],
89
extends: [
910
eslint.configs.recommended,
1011
...tseslint.configs.recommended,
12+
stylistic.configs.recommended,
1113
]
1214
}, {
1315
files: ["**/*.spec.ts"],

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"@semantic-release/changelog": "6.0.3",
5151
"@semantic-release/exec": "7.1.0",
5252
"@semantic-release/git": "10.0.1",
53+
"@stylistic/eslint-plugin": "4.2.0",
5354
"@tsconfig/node20": "20.1.4",
5455
"@types/inquirer": "8.2.6",
5556
"@types/inquirer-autocomplete-prompt": "2.0.0",

src/commands/configurations/create.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export const createConfiguration = async () => {
3030
saveConfiguration(answers)
3131

3232
console.log(green(`Saved configuration '${bold(answers.configurationName)}'.`))
33-
} else {
33+
}
34+
else {
3435
console.log(red('You are excused.'))
3536
}
3637
}

src/commands/configurations/index.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export async function addConfigurationsCommands(program: Command) {
1717
.action(async () => {
1818
try {
1919
await createConfiguration()
20-
} catch (error) {
20+
}
21+
catch (error) {
2122
logError(error)
2223
}
2324
})
@@ -28,7 +29,8 @@ export async function addConfigurationsCommands(program: Command) {
2829
.action(async () => {
2930
try {
3031
await showConfiguration()
31-
} catch (error) {
32+
}
33+
catch (error) {
3234
logError(error)
3335
}
3436
})
@@ -40,7 +42,8 @@ export async function addConfigurationsCommands(program: Command) {
4042
.action(async () => {
4143
try {
4244
await removeConfiguration()
43-
} catch (error) {
45+
}
46+
catch (error) {
4447
logError(error)
4548
}
4649
})
@@ -53,10 +56,12 @@ export async function addConfigurationsCommands(program: Command) {
5356
try {
5457
if (name) {
5558
runConfigurationByName(name)
56-
} else {
59+
}
60+
else {
5761
await runConfiguration()
5862
}
59-
} catch (error) {
63+
}
64+
catch (error) {
6065
logError(error)
6166
}
6267
})

src/commands/configurations/prompts/kubernetes-service-account.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { tryCatch } from '../../../lib/util/error'
66
const source = tryCatch((answers: ConfigurationCreateAnswers, input?: string) => {
77
const instances = fetchKubernetesServiceAccounts(
88
answers.kubernetesContext,
9-
answers.kubernetesNamespace
9+
answers.kubernetesNamespace,
1010
)
1111
return search(instances, input)
1212
})

src/commands/configurations/remove.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { confirmationPrompt } from './prompts/confirmation'
99
export const removeConfiguration = async () => {
1010
inquirer.registerPrompt('autocomplete', autocomplete)
1111

12-
const { configuration, confirmation } =
13-
await inquirer.prompt<ConfigurationChooseAnswers>([
12+
const { configuration, confirmation }
13+
= await inquirer.prompt<ConfigurationChooseAnswers>([
1414
configurationPrompt,
1515
confirmationPrompt,
1616
])
@@ -19,9 +19,10 @@ export const removeConfiguration = async () => {
1919
deleteConfiguration(configuration.configurationName)
2020

2121
console.log(
22-
green(`Deleted configuration '${bold(configuration.configurationName)}'.`)
22+
green(`Deleted configuration '${bold(configuration.configurationName)}'.`),
2323
)
24-
} else {
24+
}
25+
else {
2526
console.log(red('You are excused.'))
2627
}
2728
}

src/commands/configurations/run.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ import { confirmationPrompt } from './prompts/confirmation'
99
export const runConfiguration = async () => {
1010
inquirer.registerPrompt('autocomplete', autocomplete)
1111

12-
const { configuration, confirmation } =
13-
await inquirer.prompt<ConfigurationChooseAnswers>([
12+
const { configuration, confirmation }
13+
= await inquirer.prompt<ConfigurationChooseAnswers>([
1414
configurationPrompt,
1515
confirmationPrompt,
1616
])
1717

1818
if (confirmation) {
1919
execConfiguration(configuration)
20-
} else {
20+
}
21+
else {
2122
console.log(red('You are excused.'))
2223
}
2324
}

src/lib/gcloud/sql-instances.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ export const fetchGoogleCloudSqlInstances = memoize(
3434

3535
// skip header line
3636
return instances.slice(1).map(parseInstance)
37-
}
37+
},
3838
)

src/lib/kubectl/service-accounts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ export const fetchKubernetesServiceAccounts = memoize(
99
--context="${context}" \
1010
--output='jsonpath={range .items[*]}{.metadata.name}{"\\n"}{end}'
1111
`)
12-
}
12+
},
1313
)

src/lib/updates.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ export const notifyForUpdates = () => {
1616
})
1717

1818
if (update && update.current !== update.latest) {
19-
const text =
20-
`${yellow(update.current)}${green(update.latest)}\n\n` +
21-
`${blue('brew')} upgrade ${name}\n` +
22-
`${blue('npm')} i -g ${name}`
19+
const text
20+
= `${yellow(update.current)}${green(update.latest)}\n\n`
21+
+ `${blue('brew')} upgrade ${name}\n`
22+
+ `${blue('npm')} i -g ${name}`
2323

2424
const box = boxen(text, {
2525
title: 'Update Available',

0 commit comments

Comments
 (0)