Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n-json/identical-keys suffix matching with similarly named files causes issues #50

Open
chemdrew opened this issue Mar 29, 2022 · 1 comment

Comments

@chemdrew
Copy link

When multiple files with the same suffix matching another language file are included in the filePaths there is an issue matching the correct file to check.

I updated the example/multiple-files-per-locale on my fork to demonstrate this with a simple example using search-results.json and another file z-search-results.json.

When running npm run lint in that example it outputs the following errors, despite all keys matching in each file:

Screen Shot 2022-03-29 at 3 39 46 PM

I tracked this down to be an issue with the code here https://github.com/godaddy/eslint-plugin-i18n-json/blob/master/src/identical-keys.js#L10-L13 and was able to solve this use case by replacing that with
const match = sourceFilePath.substr(sourceFilePath.lastIndexOf('/') + 1);

@andys8
Copy link

andys8 commented Nov 22, 2023

Encountered this issue with settings.json and security-settings.json. Is the PR good to go?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants