这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@coolsoftwaretyler
Copy link
Contributor

@coolsoftwaretyler coolsoftwaretyler commented Mar 7, 2025

Description

Supercedes #2812, just with a fresh master branch since there's been some drift and we had weird CI stuff going on.

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: jestjs/jest#14305, so I included this workaround.

Screenshots (if applicable)

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

Checklist

  • README.md and other relevant documentation has been updated with my changes
  • I have manually tested this, including by generating a new app locally (see docs).

expect(read(`${TEMP_DIR}/app/models/Pizza.ts`)).toMatchInlineSnapshot(`
"import { Instance, SnapshotIn, SnapshotOut, types } from \\"mobx-state-tree\\"
import { withSetPropAction } from \\"./helpers/withSetPropAction\\"
"import { Instance, SnapshotIn, SnapshotOut, types } from \\"mobx-state-tree\\"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: I think some of the bigger diffs here come from setting prettierPath: null in order to get Prettier v3 to play nice with Jest. See jestjs/jest#14305 (comment)

"jsx"
]
],
"prettierPath": null
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coolsoftwaretyler coolsoftwaretyler changed the title Fix/eslint newline error model generator take 2 fix: eslint newline error on model generator Mar 7, 2025
Copy link
Contributor

@frankcalise frankcalise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for redoing that!

@coolsoftwaretyler coolsoftwaretyler merged commit 3d9fe38 into master Mar 7, 2025
3 checks passed
@coolsoftwaretyler coolsoftwaretyler deleted the fix/eslint-newline-error-model-generator-take-2 branch March 7, 2025 14:27
infinitered-circleci pushed a commit that referenced this pull request Mar 7, 2025
## [10.1.7](v10.1.6...v10.1.7) (2025-03-07)

### Bug Fixes

* **cli:** fix missing newlines in model generator ([#2910](#2910) by [@coolsoftwaretyler](https://github.com/coolsoftwaretyler)) ([3d9fe38](3d9fe38))
@infinitered-circleci
Copy link
Collaborator

🎉 This PR is included in version 10.1.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants