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
182 stars 25 forks source link

identical-keys rule displays error whenever structure changes #20

Closed maccuaa closed 5 years ago

maccuaa commented 6 years ago

I am using the identical-keys rule however every time I add or remove a key from an i18n file I get an error. The only way to clear the error is to restart the webpack-dev-server which I guess causes the eslint-plugin-i18n-json plugin to rescan all the files and then it's happy again.

It's not a major issue, but it is annoying to have to restart the dev server every single time.

ERROR in ./src/i18n/locales/en/resource.json
Module build failed (from ./node_modules/eslint-loader/index.js):
Module failed because of a eslint error.

/Users/maccuaa/Projects/sbp/ui/src/i18n/locales/en/resource.json
  0:0  error
- Expected
+ Received

@@ -336,2 +336,3 @@
        "username": "Message<String>",
+       "x": "Message<String>",
      },  i18n-json/identical-keys

✖ 1 problem (1 error, 0 warnings)✖ 1 problem (1 error, 0 warnings)

My Eslint configuration is:

rules: {
    'i18n-json/valid-json': 2,
    'i18n-json/valid-message-syntax': [
      2,
      {
        syntax: 'non-empty-string'
      }
    ],
    'i18n-json/sorted-keys': 2,
    'i18n-json/identical-keys': [
      2,
      {
        filePath: {
          'resource.json': path.resolve('src/i18n/locales/en/resource.json'),
     .
     .
     .
mayank23 commented 6 years ago

Hey @maccuaa 😃,

Thanks for posting this issue. I’ll take a look this week!

maccuaa commented 6 years ago

I think I have a fix. I'll create a PR.

pnevares commented 6 years ago

Thank you for the report and the PR @maccuaa !

maccuaa commented 5 years ago

Happy New Year @mayank23, @pnevares! Just wondering if you will you be creating a 2.4.1 release soon with my patch?

mayank23 commented 5 years ago

@maccuaa Hey, sorry been AFK for a bit. Will be wrapping the release up either today or tomorrow. Will comment here once it's out. Thanks! 😄

maccuaa commented 5 years ago

No worries, thanks! Great example docs btw :+1:

mayank23 commented 5 years ago

@maccuaa published! 😄