UNPKG

eslint-fixer-gpt

Version:

Automatically provide in-depth suggestions to fix ESLint errors

30 lines 1.18 kB
#! /usr/bin/env node "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const path_1 = __importDefault(require("path")); const openai_1 = __importDefault(require("openai")); const ingest_1 = require("./engine/ingest"); const process_1 = require("./engine/process"); const args = process.argv.slice(2); if (args.length < 2) { console.error('Please provide path and OPENAI API Key'); process.exit(1); } const openai = new openai_1.default({ apiKey: args[1], }); const filePath = path_1.default.resolve(args[0]); const model = "gpt-3.5-turbo"; const eslintFixerGPT = async () => { const lintOutput = (0, ingest_1.readJsonFile)(filePath); const responses = await (0, process_1.processLint)(lintOutput, model, openai); responses.forEach((response) => { console.log("********************************************************************************************************"); console.log(response); }); }; module.exports = eslintFixerGPT(); //# sourceMappingURL=index.js.map