Skip to content

Commit f77fa16

Browse files
authored
Merge pull request #25 from MiniMax-AI-Dev/feat/eslint-typescript
feat: add TypeScript ESLint and clean up unused code
2 parents 0885244 + 163c8f4 commit f77fa16

File tree

24 files changed

+97
-31
lines changed

24 files changed

+97
-31
lines changed

build.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { readFileSync, writeFileSync } from 'fs';
22

3-
const VERSION = process.env.VERSION ?? 'dev';
3+
const pkg = JSON.parse(readFileSync('package.json', 'utf-8'));
4+
const VERSION = process.env.VERSION ?? pkg.version;
45
const OUT = 'dist/minimax.mjs';
56

67
await Bun.build({

bun.lock

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import eslint from '@eslint/js';
2+
import tseslint from 'typescript-eslint';
3+
4+
export default tseslint.config(
5+
eslint.configs.recommended,
6+
...tseslint.configs.recommended,
7+
{
8+
files: ['src/**/*.ts', 'test/**/*.ts', 'build.ts'],
9+
},
10+
{
11+
ignores: ['dist/', 'node_modules/'],
12+
},
13+
{
14+
rules: {
15+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
16+
'@typescript-eslint/no-explicit-any': 'warn',
17+
},
18+
},
19+
);

package.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
"version": "0.3.1",
44
"description": "CLI for the MiniMax AI Platform",
55
"type": "module",
6-
"engines": { "node": ">=18" },
7-
"bin": { "minimax": "./dist/minimax.mjs" },
6+
"engines": {
7+
"node": ">=18"
8+
},
9+
"bin": {
10+
"minimax": "./dist/minimax.mjs"
11+
},
812
"files": ["dist/minimax.mjs"],
913
"scripts": {
1014
"dev": "bun run src/main.ts",
@@ -20,8 +24,10 @@
2024
"@clack/prompts": "^0.7.0"
2125
},
2226
"devDependencies": {
23-
"typescript": "^5.8.3",
27+
"@eslint/js": "^9.0.0",
2428
"@types/bun": "latest",
25-
"eslint": "^9.24.0"
29+
"eslint": "^9.24.0",
30+
"typescript": "^5.8.3",
31+
"typescript-eslint": "^8.58.0"
2632
}
2733
}

src/args.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export function parseFlags(argv: string[], options: OptionDef[]): GlobalFlags {
7676
const arg = argv[i]!;
7777

7878
if (arg === '--help' || arg === '-h') { flags.help = true; i++; continue; }
79-
if (arg === '--') { i++; break; }
79+
if (arg === '--') { break; }
8080

8181
if (arg.startsWith('--')) {
8282
const eqIdx = arg.indexOf('=');

src/commands/auth/login.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { saveCredentials } from '../../auth/credentials';
55
import { startBrowserFlow, startDeviceCodeFlow } from '../../auth/oauth';
66
import { requestJson } from '../../client/http';
77
import { quotaEndpoint } from '../../client/endpoints';
8-
import { formatOutput } from '../../output/formatter';
8+
99
import { getConfigPath } from '../../config/paths';
1010
import { readConfigFile, writeConfigFile } from '../../config/loader';
1111
import { isInteractive } from '../../utils/env';

src/commands/auth/logout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default defineCommand({
1616
'minimax auth logout --dry-run',
1717
'minimax auth logout --yes',
1818
],
19-
async run(config: Config, flags: GlobalFlags) {
19+
async run(config: Config, _flags: GlobalFlags) {
2020
const creds = await loadCredentials();
2121
const fileConfig = readConfigFile();
2222
const hasConfigKey = !!fileConfig.api_key;

src/commands/auth/refresh.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default defineCommand({
1515
examples: [
1616
'minimax auth refresh',
1717
],
18-
async run(config: Config, flags: GlobalFlags) {
18+
async run(config: Config, _flags: GlobalFlags) {
1919
const creds = await loadCredentials();
2020

2121
if (!creds) {

src/commands/auth/status.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default defineCommand({
1616
'minimax auth status',
1717
'minimax auth status --output json',
1818
],
19-
async run(config: Config, flags: GlobalFlags) {
19+
async run(config: Config, _flags: GlobalFlags) {
2020
try {
2121
const credential = await resolveCredential(config);
2222
const format = detectOutputFormat(config.output);

src/commands/config/show.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default defineCommand({
1313
'minimax config show',
1414
'minimax config show --output json',
1515
],
16-
async run(config: Config, flags: GlobalFlags) {
16+
async run(config: Config, _flags: GlobalFlags) {
1717
const file = loadConfigFile();
1818
const format = detectOutputFormat(config.output);
1919

0 commit comments

Comments
 (0)