Skip to content

Commit 9afed24

Browse files
Merge pull request #18 from laststance/add/linter
2 parents baca82b + 6848dbb commit 9afed24

13 files changed

+2675
-90
lines changed

.eslintignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.vscode
2+
node_modules
3+
build
4+
dist
5+
.github
6+
.git
7+
.idea
8+
.next
9+
.husky
10+
storybook-static
11+
**/mockServiceWorker.js
12+
/fixture

.eslintrc.cjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module.exports = {
2+
root: true,
3+
env: {},
4+
globals: {},
5+
extends: ['ts-prefixer'],
6+
parser: '@typescript-eslint/parser',
7+
parserOptions: {
8+
project: ['tsconfig.json'],
9+
},
10+
plugins: [],
11+
rules: {},
12+
settings: {},
13+
overrides: [
14+
{
15+
// Disable the no-unused-vars rule for test files
16+
files: ['tests/**/*.js', 'utils/**/*.test.js'],
17+
rules: {
18+
'@typescript-eslint/no-unused-vars': 'off',
19+
},
20+
},
21+
],
22+
}

.github/workflows/lint.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Lint
2+
on:
3+
pull_request: ~
4+
push:
5+
branches:
6+
- main
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: ./.github/actions/prepare
13+
- run: pnpm lint

index.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/usr/bin/env node
2-
import OpenAI from 'openai'
3-
import { promisify } from 'util'
4-
import path from 'path'
5-
import process from 'process'
62
import { exec as originalExec, execSync } from 'child_process'
7-
import prompts from 'prompts'
8-
import { program } from 'commander'
93
import fs from 'fs'
104
import os from 'os'
5+
import path from 'path'
6+
import process from 'process'
7+
import { promisify } from 'util'
8+
9+
import { program } from 'commander'
10+
import OpenAI from 'openai'
11+
import prompts from 'prompts'
12+
1113
import { sanitizeCommitMessage } from './utils/sanitizeCommitMessage.js'
1214

1315
let openai
@@ -120,12 +122,11 @@ const gptCommit = async () => {
120122
}
121123
}
122124

123-
const gitExtension = (args) => {
125+
const gitExtension = (_args) => {
124126
// Load configuration at startup
125127
loadConfig()
126128

127-
// Extract the command and arguments from the command line
128-
const [command, ...rest] = args
129+
// No need to extract command and args since we're using Commander
129130

130131
program
131132
.command('commit')

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"scripts": {
88
"prepare": "husky",
99
"prettier": "prettier --ignore-unknown --write .",
10-
"test": "vitest run"
10+
"test": "vitest run",
11+
"lint": "eslint . --ext .ts,.tsx,.js,jsx,cjs,mjs",
12+
"lint:fix": "eslint . --ext .ts,.tsx,.js,jsx,cjs,mjs --fix"
1113
},
1214
"repository": {
1315
"type": "git",
@@ -37,11 +39,19 @@
3739
"node": "22.15.0"
3840
},
3941
"devDependencies": {
42+
"@typescript-eslint/eslint-plugin": "^8.32.0",
43+
"@typescript-eslint/parser": "^8.32.0",
4044
"@vitest/coverage-v8": "3.1.2",
4145
"@vitest/ui": "^3.1.2",
46+
"eslint": "8.57.0",
47+
"eslint-config-ts-prefixer": "2.0.0-beta.1",
48+
"eslint-import-resolver-typescript": "^4.3.4",
49+
"eslint-plugin-import": "^2.31.0",
50+
"eslint-plugin-prettier": "^5.4.0",
4251
"husky": "^9.1.7",
4352
"lint-staged": "^15.5.1",
4453
"prettier": "^3.5.3",
54+
"typescript": "^5.8.3",
4555
"vite": "^6.3.3",
4656
"vitest": "^3.1.2"
4757
},

0 commit comments

Comments
 (0)