Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.vscode
node_modules
build
dist
.github
.git
.idea
.next
.husky
storybook-static
**/mockServiceWorker.js
/fixture
22 changes: 22 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
root: true,
env: {},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Specify the execution environment in the ESLint configuration.

The env object is currently empty, but it should specify the execution environments for proper linting. For a Node.js project with tests, consider adding the appropriate environments.

-  env: {},
+  env: {
+    node: true,
+    es2022: true,
+    jest: true
+  },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
env: {},
env: {
node: true,
es2022: true,
jest: true
},

globals: {},
extends: ['ts-prefixer'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['tsconfig.json'],
},
plugins: [],
rules: {},
settings: {},
overrides: [
{
// Disable the no-unused-vars rule for test files
files: ['tests/**/*.js', 'utils/**/*.test.js'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
},
},
],
}
13 changes: 13 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Lint
on:
pull_request: ~
push:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm lint
19 changes: 10 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#!/usr/bin/env node
import OpenAI from 'openai'
import { promisify } from 'util'
import path from 'path'
import process from 'process'
import { exec as originalExec, execSync } from 'child_process'
import prompts from 'prompts'
import { program } from 'commander'
import fs from 'fs'
import os from 'os'
import path from 'path'
import process from 'process'
import { promisify } from 'util'

import { program } from 'commander'
import OpenAI from 'openai'
import prompts from 'prompts'

import { sanitizeCommitMessage } from './utils/sanitizeCommitMessage.js'

let openai
Expand Down Expand Up @@ -120,12 +122,11 @@ const gptCommit = async () => {
}
}

const gitExtension = (args) => {
const gitExtension = (_args) => {
// Load configuration at startup
loadConfig()

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

program
.command('commit')
Expand Down
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"scripts": {
"prepare": "husky",
"prettier": "prettier --ignore-unknown --write .",
"test": "vitest run"
"test": "vitest run",
"lint": "eslint . --ext .ts,.tsx,.js,jsx,cjs,mjs",
"lint:fix": "eslint . --ext .ts,.tsx,.js,jsx,cjs,mjs --fix"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -37,11 +39,19 @@
"node": "22.15.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^8.32.0",
"@typescript-eslint/parser": "^8.32.0",
"@vitest/coverage-v8": "3.1.2",
"@vitest/ui": "^3.1.2",
"eslint": "8.57.0",
"eslint-config-ts-prefixer": "2.0.0-beta.1",
"eslint-import-resolver-typescript": "^4.3.4",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.4.0",
"husky": "^9.1.7",
"lint-staged": "^15.5.1",
"prettier": "^3.5.3",
"typescript": "^5.8.3",
"vite": "^6.3.3",
"vitest": "^3.1.2"
},
Expand Down
Loading
Loading