11#!/usr/bin/env node
22
3- const { Command } = require ( 'commander' ) ;
4- const chalk = require ( 'chalk' ) ;
5- const ora = require ( 'ora' ) ;
6- const fs = require ( 'fs' ) . promises ;
7- const path = require ( 'path' ) ;
8- const readline = require ( 'readline' ) ;
9- const IndonesianFormalizer = require ( './formalizer' ) ;
3+ import chalk from 'chalk' ;
4+ import { Command } from 'commander' ;
5+ import fs from 'fs/promises' ;
6+ import ora from 'ora' ;
7+ import path from 'path' ;
8+ import readline from 'readline' ;
9+ import IndonesianFormalizer from './formalizer.js' ; // tambahkan .js agar import ESM bisa resolve
1010
1111const program = new Command ( ) ;
1212const formalizer = new IndonesianFormalizer ( ) ;
@@ -56,6 +56,7 @@ program
5656 console . log ( '\n' + chalk . blue ( '📊 Analisis Formalitas:' ) ) ;
5757 console . log ( chalk . white ( ` Level: ${ analysis . level } ` ) ) ;
5858 console . log ( chalk . white ( ` Skor Formalitas: ${ analysis . score } %` ) ) ;
59+ // eslint-disable-next-line max-len
5960 console . log ( chalk . white ( ` Kata Informal: ${ analysis . informalWords } /${ analysis . totalWords } ` ) ) ;
6061 }
6162
@@ -64,6 +65,7 @@ program
6465 if ( suggestions . length > 0 ) {
6566 console . log ( '\n' + chalk . magenta ( '💡 Saran Perbaikan:' ) ) ;
6667 suggestions . forEach ( ( s , i ) => {
68+ // eslint-disable-next-line max-len
6769 console . log ( chalk . white ( ` ${ i + 1 } . ${ s . reason } : "${ s . original } " → "${ s . suggestion } "` ) ) ;
6870 } ) ;
6971 }
@@ -122,6 +124,7 @@ program
122124 . description ( 'Mode interaktif untuk formalisasi real-time' )
123125 . action ( ( ) => {
124126 console . log ( chalk . cyan ( banner ) ) ;
127+ // eslint-disable-next-line max-len
125128 console . log ( chalk . yellow ( 'Mode Interaktif - Ketik teks informal, tekan Enter untuk formalisasi' ) ) ;
126129 console . log ( chalk . gray ( 'Ketik "exit" untuk keluar, "help" untuk bantuan\n' ) ) ;
127130
@@ -133,7 +136,7 @@ program
133136
134137 rl . prompt ( ) ;
135138
136- rl . on ( 'line' , ( line ) => {
139+ rl . on ( 'line' , line => {
137140 const input = line . trim ( ) ;
138141
139142 if ( input === 'exit' || input === 'quit' ) {
@@ -214,7 +217,7 @@ program
214217 . option ( '-d, --directory <dir>' , 'Directory input' )
215218 . option ( '-o, --output-dir <dir>' , 'Directory output' )
216219 . option ( '-e, --extension <ext>' , 'File extension (default: .txt)' , '.txt' )
217- . action ( async ( options ) => {
220+ . action ( async options => {
218221 console . log ( chalk . cyan ( banner ) ) ;
219222
220223 const dir = options . directory || '.' ;
0 commit comments