Skip to content

Commit a2752b6

Browse files
committed
style: lint
1 parent 7d4750c commit a2752b6

17 files changed

+223
-176
lines changed

.vscode/settings.json

+47-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,53 @@
22
"explorer.fileNesting.enabled": true,
33
"explorer.fileNesting.expand": false,
44
"explorer.fileNesting.patterns": {
5-
"package.json": "bun.lockb, pnpm-lock.yaml, .gitignore, tsconfig.json, *.d.ts, .release-it.json, eslint.config.js",
6-
"README.md": "CHANGELOG*",
7-
"docker-compose.yml": "wrangler.*, .env*, .dev.vars, public_keys.*, drizzle.config.*"
5+
"package.json": "bun.lockb, .gitignore, tsconfig.json, *.d.ts, .release-it.json, eslint.config.*",
6+
"README.md": "CHANGELOG*, LICENSE",
7+
".env": ".env.*"
88
},
99
"editor.tabSize": 2,
1010
"typescript.tsdk": "node_modules/typescript/lib",
11-
}
11+
// Enable the ESlint flat config support
12+
"eslint.experimental.useFlatConfig": true,
13+
14+
// Disable the default formatter, use eslint instead
15+
"prettier.enable": false,
16+
"editor.formatOnSave": false,
17+
18+
// Auto fix
19+
"editor.codeActionsOnSave": {
20+
"source.fixAll.eslint": "explicit",
21+
"source.organizeImports": "never"
22+
},
23+
24+
// Silent the stylistic rules in you IDE, but still auto fix them
25+
"eslint.rules.customizations": [
26+
{ "rule": "style/*", "severity": "off" },
27+
{ "rule": "format/*", "severity": "off" },
28+
{ "rule": "*-indent", "severity": "off" },
29+
{ "rule": "*-spacing", "severity": "off" },
30+
{ "rule": "*-spaces", "severity": "off" },
31+
{ "rule": "*-order", "severity": "off" },
32+
{ "rule": "*-dangle", "severity": "off" },
33+
{ "rule": "*-newline", "severity": "off" },
34+
{ "rule": "*quotes", "severity": "off" },
35+
{ "rule": "*semi", "severity": "off" }
36+
],
37+
38+
// Enable eslint for all supported languages
39+
"eslint.validate": [
40+
"javascript",
41+
"javascriptreact",
42+
"typescript",
43+
"typescriptreact",
44+
"vue",
45+
"html",
46+
"markdown",
47+
"json",
48+
"jsonc",
49+
"yaml",
50+
"toml",
51+
"gql",
52+
"graphql"
53+
]
54+
}

bun.lockb

218 KB
Binary file not shown.

eslint.config.mjs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// eslint.config.mjs
2+
import antfu from "@antfu/eslint-config"
3+
4+
export default antfu({
5+
stylistic: {
6+
quotes: "double",
7+
},
8+
})

package.json

+19-17
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
{
2+
"name": "strigi",
3+
"type": "module",
4+
"version": "0.0.0",
5+
"description": "CLI tool leveraging GenAI to generate commands based on user prompts.",
6+
"module": "src/main.ts",
7+
"scripts": {
8+
"start": "bun .",
9+
"dev": "bun --watch .",
10+
"build": "bun build ./src/main.ts --outfile dist/s --compile --minify --sourcemap",
11+
"lint": "eslint .",
12+
"lint:fix": "eslint . --fix"
13+
},
14+
"peerDependencies": {
15+
"typescript": "^5.0.0"
16+
},
217
"dependencies": {
318
"@google/generative-ai": "^0.3.1",
419
"@inquirer/prompts": "^4.3.1",
520
"chalk": "^5.3.0",
621
"chalk-template": "^1.1.0",
722
"clipanion": "^4.0.0-rc.3",
8-
"figlet": "^1.7.0",
923
"ora": "^8.0.1"
1024
},
1125
"devDependencies": {
26+
"@antfu/eslint-config": "^2.12.1",
1227
"@types/bun": "latest",
1328
"@types/figlet": "^1.5.8",
14-
"@types/inquirer": "^9.0.7"
15-
},
16-
"peerDependencies": {
17-
"typescript": "^5.0.0"
18-
},
19-
"name": "strigi",
20-
"version": "0.0.0",
21-
"description": "CLI tool leveraging GenAI to generate commands based on user prompts.",
22-
"module": "src/main.ts",
23-
"type": "module",
24-
"scripts": {
25-
"start": "bun .",
26-
"dev": "bun --watch .",
27-
"build": "bun build ./src/main.ts --outfile dist/s --compile",
28-
"preview": "bun build ./src/main.ts --outfile dist/s --compile --minify --sourcemap"
29+
"@types/inquirer": "^9.0.7",
30+
"eslint": "^8.57.0"
2931
}
30-
}
32+
}

src/commands/AuthCommand.ts

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
1-
import { password } from "@inquirer/prompts";
2-
import c from "chalk-template";
3-
import { Command, Option } from "clipanion";
4-
import { config, saveConfig } from "../config";
1+
import { password } from "@inquirer/prompts"
2+
import c from "chalk-template"
3+
import { Command, Option } from "clipanion"
4+
import { config, saveConfig } from "../config"
55

66
export default class AuthCommand extends Command {
77
static usage = Command.Usage({
8-
description: "Authenticate"
8+
description: "Authenticate",
99
})
1010

11-
static paths = [["auth"], ["a"]];
11+
static paths = [["auth"], ["a"]]
1212

13-
geminiApiKey = Option.String('-g, --gemini', { description: 'Gemini API key to use' })
13+
geminiApiKey = Option.String("-g, --gemini", { description: "Gemini API key to use" })
1414

1515
async saveGeminiApiKey(geminiApiKey: string) {
1616
try {
17-
config.geminiApiKey = geminiApiKey;
17+
config.geminiApiKey = geminiApiKey
1818
await saveConfig()
1919
this.context.stdout.write(c`{green Gemini API key set successfully!}\n`)
20-
} catch (_e) {
21-
const e = _e as Error;
20+
}
21+
catch (_e) {
22+
const e = _e as Error
2223
this.context.stdout.write(c`{red Error saving Gemini API key:}\n\n${e.message}\n`)
2324
}
2425
}
2526

2627
async execute() {
2728
if (this.geminiApiKey) {
2829
this.saveGeminiApiKey(this.geminiApiKey)
29-
return;
30+
return
3031
}
3132

3233
const answer = await password({
33-
message: "Enter the Gemini API key"
34+
message: "Enter the Gemini API key",
3435
})
3536

3637
this.saveGeminiApiKey(answer)

src/commands/LogoutCommand.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
import c from "chalk-template";
2-
import { Command } from "clipanion";
3-
import { config, saveConfig } from "../config";
1+
import c from "chalk-template"
2+
import { Command } from "clipanion"
3+
import { config, saveConfig } from "../config"
44

55
export default class LogoutCommand extends Command {
66
static usage = Command.Usage({
7-
description: "Delete Gemini API key from config"
7+
description: "Delete Gemini API key from config",
88
})
99

10-
static paths = [["logout"], ["l"]];
10+
static paths = [["logout"], ["l"]]
1111

1212
async execute() {
1313
try {
14-
delete config.geminiApiKey;
14+
delete config.geminiApiKey
1515
await saveConfig()
1616
this.context.stdout.write(c`{green Gemini API key has been deleted successfully!}\n`)
17-
} catch (_e) {
18-
const e = _e as Error;
17+
}
18+
catch (_e) {
19+
const e = _e as Error
1920
this.context.stdout.write(c`{red Error deleting Gemini API key:}\n\n${e.message}\n`)
2021
}
2122
}

0 commit comments

Comments
 (0)