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

fix : enforce linting / formatting standards (#80) #182

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,45 @@
{
"$schema": "https://json.schemastore.org/eslintrc",
"root": true,
"extends": [
"next/core-web-vitals",
"prettier",
"plugin:@next/next/recommended",
"plugin:tailwindcss/recommended"
],
"plugins": ["tailwindcss"]
}
"plugins": ["tailwindcss"],
"rules": {
"tailwindcss/no-contradicting-classname":"off",
"react/no-unescaped-entities": "off",
"@next/next/no-page-custom-font": "off",
"@next/next/no-html-link-for-pages": "off",
"tailwindcss/no-custom-classname": "off",
"tailwindcss/classnames-order": "off",
"no-multiple-empty-lines": [
"error",
{
"max": 1
}
],
"semi": "error",
"no-var": "error"
// "react/display-name": [false, {
// "ignoreTranspilerName": false, "checkContextObjects": false
// }]
},
"settings": {
"tailwindcss": {
"callees": ["cn", "cva"],
"config": "tailwind.config.ts"
},
"next": {
"rootDir": ["app/*/"]
}
},
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"parser": "@typescript-eslint/parser"
}
]
}
8 changes: 8 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
BRANCH_NAME=$(git branch --show-current)

if [ "$BRANCH_NAME" = "main" ]; then

exit 1
fi

pnpm lint-staged
27 changes: 25 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,28 @@
"trailingComma": "all",
"printWidth": 80,
"tabWidth": 2,
"plugins": ["prettier-plugin-tailwindcss"]
}
"endOfLine": "lf",
"singleQuote": false,
"importOrder": [
"^(react/(.*)$)|^(react$)",
"^(next/(.*)$)|^(next$)",
"<THIRD_PARTY_MODULES>",
"",
"^types$",
"^@/types/(.*)$",
"^@/config/(.*)$",
"^@/lib/(.*)$",
"^@/hooks/(.*)$",
"^@/components/ui/(.*)$",
"^@/components/(.*)$",
"^@/registry/(.*)$",
"^@/styles/(.*)$",
"^@/app/(.*)$",
"",
"^[./]"
],
"plugins": [
"prettier-plugin-tailwindcss",
"@ianvs/prettier-plugin-sort-imports"
]
}
2 changes: 1 addition & 1 deletion components/analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Script from "next/script";
export function Analytics() {
return (
<>
<Script>{`window.lemonSqueezyAffiliateConfig = { store: "magicui" };`}</Script>
<Script id="id">{`window.lemonSqueezyAffiliateConfig = { store: "magicui" };`}</Script>
<Script src="https://lmsqueezy.com/affiliate.js" defer></Script>
<Script
async
Expand Down
22 changes: 20 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,20 @@
"dev:email": "email dev -p 3004",
"dev:stripe": "stripe listen --forward-to localhost:3003/api/webhooks/stripe",
"prod:migrate": "dotenv -e .env -- npx prisma db push",
"prod:seed": "dotenv -e .env -- npx tsx prisma/seed.ts"
"prod:seed": "dotenv -e .env -- npx tsx prisma/seed.ts",
"prepare": "husky"
},
"husky": {
"hooks": {
"pre-push": "lint-staged"
}
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write",
"git add ."
]
},
"dependencies": {
"@heroicons/react": "^2.1.3",
Expand Down Expand Up @@ -83,13 +96,18 @@
"zod": "^3.21.4"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
"@tailwindcss/typography": "^0.5.9",
"@types/canvas-confetti": "^1.6.4",
"@types/node": "^20.8.9",
"@types/react": "18.2.12",
"@types/react-dom": "18.2.5",
"cssnano": "^6.0.3",
"dotenv": "^16.3.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-tailwindcss": "^3.17.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.5",
"mdast-util-toc": "^6.1.1",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.0",
Expand Down
Loading