open-sauced / landing-page

This is the new landing page for open sauced
https://opensauced.pizza
30 stars 29 forks source link

chore: Revisit linting/styling #227

Open jpmcb opened 5 months ago

jpmcb commented 5 months ago

Maybe not blocking, but this changes a number of " double quotes over to ' single quotes: we can push this pr through but would probably be good to get the eslint/prettier checks in here along with a package.json script to easy execute linting

_Originally posted by @jpmcb in https://github.com/open-sauced/landing-page/pull/218#discussion_r1528704747_


Looks like we may need to revisit linting/styling in this repo (like we have in the app and etl: https://github.com/open-sauced/etl/pull/176)

Also noticed the npm run lint command is just calling next lint which we should probably call into prettier/eslint like we do elsewhere.

Jenna59 commented 5 months ago

@jpmcb would this be setting up the config files for eslint and prettier? I'm interested in working on it but the pull/176 link 404d, so I'm not sure exactly what I would have to do?

nickytonline commented 5 months ago

@Jenna59, looking at the prettier config, the single quote change is correct.

https://github.com/open-sauced/landing-page/blob/main/.prettierrc.js#L1-L6

module.exports = {
    trailingComma: 'es5',
    tabWidth: 2,
    semi: false,
    singleQuote: true,
}

I think the issue is we need to run prettier over all the files to ensure everything is formatted correctly (step 1), and then I think we need to put in place lint-staged with husky, so we get pre-commit hooks formatting things in case people are using different editors/settings.

  "lint-staged": {
    "*.{js,jsx,ts,tsx}": "eslint --cache --fix",
-    "*.{ts,tsx}": "vitest related --run",
    "*.{js,jsx,ts,tsx,css,md}": "prettier --write"
  }

Note that the landing page doesn't use vitest, so that can be omitted.

You can look at https://github.com/open-sauced/app/blob/beta/package.json#L160-L164 for lint-staged, and it would also require setting up Husky.

I'll let others chime in though as I'm typically not working in this project.

Jenna59 commented 5 months ago

.take @nickytonline would I need Sanity Studio access to work on this issue? https://github.com/open-sauced/landing-page?tab=readme-ov-file#-cms-sanity-commands

github-actions[bot] commented 5 months ago

Thanks for taking this on! If you have not already, join the conversation in our Discord

nickytonline commented 5 months ago

I don't think you do as I've never installed it.

nickytonline commented 5 months ago

I would probably break this up into a couple of PRs. One for running prettier on the whole code base to fix any existing forgetting issues and a second PR which would add Husky and lint-staged.

Again though, I don't usually work in this repo, so just checking in with @brandonroberts and @zeucapua before you start any of the work.

Jenna59 commented 4 months ago

Hey there @brandonroberts and @zeucapua I was hoping to start taking a look at things on Friday. Do you have any thoughts before I begin?

jpmcb commented 3 weeks ago

Hi @Jenna59 - still looking to tackle this? Happy to assist if you need help!