vttred / ose

Old-School Essentials – Foundry VTT Edition
https://ose.vtt.red
GNU General Public License v3.0
98 stars 57 forks source link

fix: needs to be non-static in order to override #466

Closed anthonyronda closed 1 year ago

anthonyronda commented 1 year ago

Fixes #460

This function was changed to static as part of a linting pass. We should be checking that we are not changing overrides to static, however, because in this case it caused this update() override to never run. The change to static has been reversed. In order to avoid the linter error "do not mutate function properties" we create a clone of the data object property.

This function also returned undefined for all of its conditionals, because (new)data.system doesn't exist. The data object's children are flattened into string-keys like this:

image

I switched to this new way of accessing them.

Finally, the linter is complaining about re-using duplicate string literals. This makes no sense in this context, and indeed it should not be triggering because string literals used as object keys are an exception in the SonarSouce/no-duplicate-string rule https://github.com/SonarSource/eslint-plugin-sonarjs/issues/107

anthonyronda commented 1 year ago

The linter is now happy, because the string literals are only used twice each 😆