godaddy / eslint-plugin-i18n-json

Fully extendable eslint plugin for JSON i18n translation files.
https://godaddy.github.io/2018/04/02/introducing-eslint-plugin-i18n-json/
MIT License
181 stars 24 forks source link

processor fail when json file contain '**' #35

Open davidnghk01 opened 4 years ago

davidnghk01 commented 4 years ago

Use Case: i want to use that plugin for linting and auto-fix my json config file

Example Input:

{
  "command": {
    "publish": {
      "conventionalCommits": true,
      "ignoreChanges": [
        "**/__fixtures__/**",
        "**/__mocks__/**",
        "**/__tests__/**",
        "yarn.lock",
        "CHANGELOG.md"
      ],
      "message": "chore(release): publish"
    }
  },
  "npmClient": "yarn",
  "packages": ["packages/*"],
  "version": "independent"
}

Result:

  6:12  error  Parsing error: '{' expected

Root case: My Json file contain '*/' which make that plugin consider end of comment

Work around: Manually escape */

{ "command": { "publish": { "conventionalCommits": true, "ignoreChanges": [ "\/fixtures/", "\/mocks/", "\/tests/*", "yarn.lock", "CHANGELOG.md" ], "message": "chore(release): publish" } }, "npmClient": "yarn", "packages": ["packages/"], "version": "independent" }

mayank23 commented 4 years ago

Thanks @davidnghk01 , will take a look into this, and get back to you 😄

davidnghk01 commented 4 years ago

jsonc plugin

FYI, turn out I find another plugin already done the json sorting feature

So I make use of that for my case ~