mxmvshnvsk / i18n-unused

The static analyze tool for finding, marking and removing unused and missing i18n translations in your JavaScript project
MIT License
127 stars 21 forks source link

Making relative paths for localesPath and srcPath's a bit cleaner #28

Closed athammer closed 1 year ago

athammer commented 1 year ago

In i18n-unused.config.js I had the following properties.

  localesPath: './../../translations/',
  srcPath: './../..',

fullBasePath and pathFromSrc from lines 86, and 87 respectively would then be the following

  fullBasePath: '/Users/aaronh/Development/project-name/frontend/checkout-links/./../..',
  pathFromSrc: '/Users/aaronh/Development/project-name/translations/shared/en.json',

Instead they should be something like:

  fullBasePath: '/Users/aaronh/Development/project-name',
  pathFromSrc: 'translations/shared/en.json'

If we use the bottom paths we can more accurately use the ignorePaths prop in i18n-unused.config.js as the full path from pathFromSrc would never match with any strings in the ignorePaths string array.

I also added some basic tests. let me know if you want any changes :)

mxmvshnvsk commented 1 year ago

Hi, thank u =) your changes now available in v0.11.1