Skip to content

add-missing does not work if it compares against empty property files #41

@acaparroso

Description

@acaparroso

When trying to propagate a new language folder from an original english file with terms, npx mfv add-missing threw this error:

TypeError: Cannot read properties of undefined (reading 'comma')
    at C:\D2L\web-components\activities\node_modules\messageformat-validator\bin\cli.js:277:65
    at Array.forEach (<anonymous>)
    at C:\D2L\web-components\activities\node_modules\messageformat-validator\bin\cli.js:259:29
    at Array.forEach (<anonymous>)
    at C:\D2L\web-components\activities\node_modules\messageformat-validator\bin\cli.js:234:14

All other files were created using the script:

echo -e "/* eslint quotes: 0 */\n\nexport default {\n};" | tee -a ar.js cy.js da.js de.js en.js es-es.js es.js fr-fr.js fr-on.js fr.js hi.js ja.js ko.js nl.js pt.js sv.js tr.js zh-cn.js zh-tw.js

It did not like trying to read the properties of an empty object. They all looked like this:

/* eslint quotes: 0 */

export default {
};

This issue can be circumvented by adding a dummy data to all files:

/* eslint quotes: 0 */

export default {
"dummy":"dummy"
};

Then re-running npx mfv add-missing, and removing all instances of "dummy":"dummy".

In this scenario, it would be nice to be able to propagate the terms to new files in the case of new lang folders, or an extra supported language being added to old components.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions