jednano / eclint

Validate or fix code that doesn't adhere to EditorConfig settings or infer settings from existing code.
MIT License
307 stars 28 forks source link

Generated empty locales file after execute eclint command. #81

Closed yutakakinjyo closed 7 years ago

yutakakinjyo commented 7 years ago

Hi, I think eclint is good tool and useful to me 🎉 . Thank you for developing this tool. Now, I tried to execute following steps and got error, So I just report it in this issue.


in macOS sierra, and os lang is ja_JP

Error case

$ npm install -g eclint
$ cd path/to/project
$ eclint ( or eclint --help or eclint --version )

After executed above steps, empty jp_JP.json is generated.

/usr/local/lib/node_modules/eclint/locales/:[]: ls

result

en.json     ja_JP.json  zh_CN.json  zh_TW.json

and that is empty file.

$ wc ja_JP.json 
       0       0       0 ja_JP.json

After executed this steps, any commands dump parse errors.

$ eclint

/usr/local/lib/node_modules/eclint/node_modules/y18n/index.js:79
    else throw err
         ^

SyntaxError: syntax error in /usr/local/lib/node_modules/eclint/locales/ja_JP.json
    at JSON.parse (<anonymous>)
    at Y18N._readLocaleFile (/usr/local/lib/node_modules/eclint/node_modules/y18n/index.js:72:25)
    at Y18N.__ (/usr/local/lib/node_modules/eclint/node_modules/y18n/index.js:26:38)
    at Object.<anonymous> (/usr/local/lib/node_modules/eclint/dist/cli.js:187:12)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/eclint/bin/eclint.js:3:11)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)

Normally case

If execute eclint check command in first, jp_JP.json file is generated that include en contents.

$ cat ja_JP.json 

{
  "Usage: $0 <command> [files...] [options]": "Usage: $0 <command> [files...] [options]",
  "Validate that file(s) adhere to .editorconfig settings": "Validate that file(s) adhere to .editorconfig settings",
  "Fix formatting errors that disobey .editorconfig settings": "Fix formatting errors that disobey .editorconfig settings",
  "Infer .editorconfig settings from one or more files": "Infer .editorconfig settings from one or more files",
  "CommandError: Missing required sub-command.": "CommandError: Missing required sub-command.",
  "Indentation Style": "Indentation Style",
  "Indentation Size (in single-spaced characters)": "Indentation Size (in single-spaced characters)",
  "Width of a single tabstop character": "Width of a single tabstop character",
  "Line ending file format (Unix, DOS, Mac)": "Line ending file format (Unix, DOS, Mac)",
  "File character encoding": "File character encoding",
  "Denotes whether whitespace is allowed at the end of lines": "Denotes whether whitespace is allowed at the end of lines",
  "Denotes whether file should end with a newline": "Denotes whether file should end with a newline",
  "Forces hard line wrapping after the amount of characters specified": "Forces hard line wrapping after the amount of characters specified",
  "Block comments start with": "Block comments start with",
  "Lines in block comment start with": "Lines in block comment start with",
  "Block comments end with": "Block comments end with"
}

After executed eclint check command in first, Any commands are normally work.

Thanks. 😄

gucong3000 commented 7 years ago

I will work for this.

gucong3000 commented 7 years ago

Upstream bug: yargs/y18n#48

gucong3000 commented 7 years ago

Fixed on PR yargs/y18n#49

gucong3000 commented 7 years ago

@yutakakinjyo Would you like to translate en.json into Japanese?

gucong3000 commented 7 years ago

@yutakakinjyo Fixed in latest stable version. Would you please translate en.json into Japanese?