infinitered / ignite

Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more! 9 years of continuous development and counting.
MIT License
17.74k stars 1.4k forks source link

Fix/eslint newline error in model generator #2812

Open coolsoftwaretyler opened 1 month ago

coolsoftwaretyler commented 1 month ago

Please verify the following:

Describe your PR

In Ignite X, the model generator would create files that did not pass Prettier config. See "before" screenshot, which came from npx ignite-cli generate model Pizza in a fresh Ignite X app.

This change primarily fixes the prettier error, as seen in the "after" screenshot, which I got by running:

# In my local Ignite X repo
node ~/ignite/bin/ignite generate model --update
node ~/ignite/bin/ignite generate model FixedPizza

However, when I attempted to update the Jest snapshots, I ran into this issue from Jest: https://github.com/jestjs/jest/issues/14305

One workaround is to disable prettier in Jest, which you'll see in cb78066ea24539569e21dcc20fbf9d5b9fe0c09c. We could drop that commit and just take the snapshot changes from 89841942359faa1c434c000a018d04e27d834777. I'm not sure if there's some other workaround or configuration in place that fixes that problem.

Screenshots (if applicable)

Before After
2024-10-17-eslint-error-with-missing-newline 2024-10-17-missing-newline-fixed