Skip to content
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

Closed
wants to merge 5 commits into from

Conversation

squink13
Copy link

@squink13 squink13 commented Apr 4, 2023

Closes #

βœ… Checklist

  • I have followed every step in the contributing guide (updated 2022-10-06).
  • The PR title follows the convention we established conventional-commit
  • I performed a functional test on my final commit

Changelog

[Short description of what has changed]

  • Updated prisma and @prisma/client to 4.12.0
  • Added prettier-plugin-prisma package to allow formatting of prisma schema files
  • Added eslint-config-prettier to handle conflicts with eslint and prettier whenever prettier is installed as per Next.js and Prettier recommendations

Screenshots

[Screenshots]

image
create-t3-app with all options selected.

You can find the directory here

πŸ’―

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-bot
Copy link

changeset-bot bot commented Apr 4, 2023

πŸ¦‹ Changeset detected

Latest commit: 5bb7b9d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-t3-app Minor

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

@vercel
Copy link

vercel bot commented Apr 4, 2023

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
create-t3-app βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Apr 4, 2023 9:21am

@github-actions github-actions bot added πŸ“Œ area: cli Relates to the CLI πŸ“Œ area: t3-app Relates to the generated T3 App πŸ“š documentation Improvements or additions to documentation labels Apr 4, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Apr 4, 2023

Running Lighthouse audit...

@juliusmarminge
Copy link
Member

I like the idea here and we should also do #1332.

I think @nexxeln objects though

"next": "^13.2.4",
"next-auth": "^4.20.1",
"prettier": "^2.8.6",
"prettier": "^2.8.7",
"prettier-plugin-prisma": "^4.12.0",
Copy link
Member

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 }) => {
Copy link
Member

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?

Copy link
Author

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

@c-ehrlich
Copy link
Member

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?

@squink13
Copy link
Author

squink13 commented Apr 4, 2023

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.

@bai
Copy link
Contributor

bai commented Apr 5, 2023

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.

Copy link
Contributor

@keeandev keeandev left a 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"
},

@juliusmarminge
Copy link
Member

superseded by #1392

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
πŸ“Œ area: cli Relates to the CLI πŸ“Œ area: t3-app Relates to the generated T3 App πŸ“š documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants