-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add prettier functionality for prisma and eslint #1334
Conversation
Add prettier-plugin-prisma to handle indentation and spacing formatting in .prisma files. Add eslint-config-prettier to handle conflicts as per next.js and prettier guidelines.
π¦ Changeset detectedLatest commit: 5bb7b9d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git βοΈ
|
Running Lighthouse audit... |
"next": "^13.2.4", | ||
"next-auth": "^4.20.1", | ||
"prettier": "^2.8.6", | ||
"prettier": "^2.8.7", | ||
"prettier-plugin-prisma": "^4.12.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why would we need a prettier plugin here? the prisma cli has a format
command and their VSCode extension is probably a better recommendation than a 3rd party prettier plugin?
import { type Installer } from "~/installers/index.js"; | ||
import { addPackageDependency } from "~/utils/addPackageDependency.js"; | ||
|
||
export const prettierInstaller: Installer = ({ projectDir, packages }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wonder if it'd be a good shout to combine this installer with eslint?
so the default would be no eslint n'or prettier, and you could choose an eslint+prettier
installer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're looking at #1332 as well i think moving eslint & prettier to its own option would be nice. Not everyone wants opinionated formatting or linting for every project. It would also mimick the 'create-next-app' eslint option
I'm mixed about this. The more linting we add, the weirder it gets that we don't ship a "complete"/"opinionated" config. But I do lean in favour of these specific ones making sense. Where do we want to stand on this stuff going forward? Where is the line of being too opinionated? Do we run a risk of people not realising that they're meant to add their own prettier and eslint settings? Should we pivot towards providing a reasonable "full loadout", and people can rip it out if they want? |
I think for a better out of the box experience adding the eslint config package at the very least would be a small improvement. It gets around potential conflicts with linting and formatting. The prisma plugin is probably more on the bloat side, its not really necessary like @juliusmarminge mentioned. |
If prisma plugin allows us to catch prisma formatting errors on CI I don't mind having it included. My 2c is that ct3a should ship whatever the maintainers think is the best opinionated stack. Data point of one, but as an End User of ct3a I don't want to bother with linters/formatters/etc - I want to work on my app asap and I will certainly not be bothering with adding/removing linters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is a better solution if you want to abide by Prisma's official formatter with the added benefits of auto-completed relationships.
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[prisma]": {
"editor.defaultFormatter": "Prisma.prisma"
},
superseded by #1392 |
Closes #
β Checklist
Changelog
[Short description of what has changed]
Screenshots
[Screenshots]
create-t3-app with all options selected.
You can find the directory here
π―