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

chore: fix lint staged #344

Merged
merged 11 commits into from
Dec 18, 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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ next-env.d.ts
.env.sentry-build-plugin

# for packages/lib
generated/
generated/
.eslintcache
.prettiercache
5 changes: 0 additions & 5 deletions .lintstagedrc.cjs

This file was deleted.

16 changes: 5 additions & 11 deletions apps/beets-frontend-v3/.lintstagedrc.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// https://nextjs.org/docs/pages/building-your-application/configuring/eslint#lint-staged
import baseConfig from '../../.lintstagedrc.cjs'
import path from 'path'

const buildEslintCommand = filenames =>
`next lint --fix --max-warnings 0 --file ${filenames
.map(f => path.relative(process.cwd(), f))
.join(' --file ')}`

export default {
...baseConfig,
'*.{js,jsx,ts,tsx}': [buildEslintCommand, 'bash -c "pnpm run typecheck"'],
'*.{js,jsx,ts,tsx}': "eslint --fix --cache --max-warnings 0",
'**/*.ts?(x)': 'bash -c "pnpm typecheck"',
'*.{md,json,yaml,ts,tsx}': 'prettier --write',
'*.css': 'stylelint --fix',
}

10 changes: 5 additions & 5 deletions apps/beets-frontend-v3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dev": "concurrently \"pnpm --filter @repo/lib graphql:gen --watch\" \"next dev -p 3001\"",
"dev:no-gen": "next dev -p 3001",
"gen:wagmi": "pnpm wagmi generate",
"lint": "next lint",
"lint:fix": "next lint --fix",
"format": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --check --cache --cache-location='node_modules/.cache/.prettiercache' --log-level=warn",
"format:fix": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --write --cache --cache-location='node_modules/.cache/.prettiercache' --log-level=warn",
"lint": "eslint . --cache",
"lint:fix": "eslint . --fix --max-warnings 0 --cache",
"format": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --check --cache --log-level=warn",
"format:fix": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --write --cache --log-level=warn",
"start": "next start",
"typecheck": "tsc --project tsconfig.json --noEmit",
"typecheck": "tsc --project tsconfig.json --noEmit --incremental",
"gen:theme-typings": "chakra-cli tokens ./lib/services/chakra/themes/beets/beets.theme.ts",
"postinstall": "npm run gen:theme-typings"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/beets-frontend-v3/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
".next/types/**/*.ts",
"../../packages/lib/global.d.ts"
],
"exclude": ["node_modules", ".next"]
"exclude": ["node_modules", ".next", "**/generated/**"]
}
16 changes: 5 additions & 11 deletions apps/frontend-v3/.lintstagedrc.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// https://nextjs.org/docs/pages/building-your-application/configuring/eslint#lint-staged
import baseConfig from '../../.lintstagedrc.cjs'
import path from 'path'

const buildEslintCommand = filenames =>
`next lint --fix --max-warnings 0 --file ${filenames
.map(f => path.relative(process.cwd(), f))
.join(' --file ')}`

export default {
...baseConfig,
'*.{js,jsx,ts,tsx}': [buildEslintCommand, 'bash -c "pnpm run typecheck"'],
'*.{js,jsx,ts,tsx}': "eslint --fix --cache --max-warnings 0",
'**/*.ts?(x)': 'bash -c "pnpm typecheck"',
'*.{md,json,yaml,ts,tsx}': 'prettier --write',
'*.css': 'stylelint --fix',
}

Binary file removed apps/frontend-v3/app/opengraphimage-old.jpg
Binary file not shown.
10 changes: 5 additions & 5 deletions apps/frontend-v3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dev": "concurrently \"pnpm --filter @repo/lib graphql:gen --watch\" \"next dev\"",
"dev:no-gen": "next dev",
"gen:wagmi": "pnpm wagmi generate",
"lint": "next lint",
"lint:fix": "next lint --fix",
"format": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --check --cache --cache-location='node_modules/.cache/.prettiercache' --log-level warn",
"format:fix": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --write --cache --cache-location='node_modules/.cache/.prettiercache' --log-level=warn",
"lint": "eslint . --max-warnings 0 --cache",
"lint:fix": "eslint . --fix --max-warnings 0 --cache",
"format": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --check --cache --log-level warn",
"format:fix": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --write --cache --log-level=warn",
"start": "next start",
"typecheck": "tsc --project tsconfig.json --noEmit",
"typecheck": "tsc --project tsconfig.json --noEmit --incremental",
"gen:theme-typings": "chakra-cli tokens ./lib/services/chakra/themes/bal/bal.theme.ts",
"postinstall": "npm run gen:theme-typings"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend-v3/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
".next/types/**/*.ts",
"../../packages/lib/global.d.ts"
],
"exclude": ["node_modules", ".next"]
"exclude": ["node_modules", ".next", "**/generated/**"]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"lint:all:fix": "turbo run lint:fix format:fix --continue --force",
"lint": "turbo lint",
"lint:fix": "turbo lint:fix",
"format": "prettier '*.*(md|json|yaml|ts|js|tsx)' --check --cache --cache-location='node_modules/.cache/.prettiercache'",
"format:fix": "prettier '*.*(md|json|yaml|ts|js|tsx)' --write --cache --cache-location='node_modules/.cache/.prettiercache' --log-level=warn",
"format": "prettier '*.*(md|json|yaml|ts|js|tsx)' --check --cache",
"format:fix": "prettier '*.*(md|json|yaml|ts|js|tsx)' --write --cache --log-level=warn",
"stylelint": "stylelint '**/*.css'",
"stylelint:fix": "pnpm run stylelint -- --fix",
"test:integration": "turbo test:integration --ui=stream --log-order=stream --",
Expand Down
12 changes: 11 additions & 1 deletion packages/eslint-config/next.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,22 @@ module.exports = {
// Ignore dotfiles
'.*.js',
'node_modules/',
'next.config.js',
],
overrides: [{ files: ['*.js?(x)', '*.ts?(x)'] }],
rules: {
curly: ['error', 'multi-line'],
'no-console': ['off'],
'max-len': ['warn', { code: 120, ignoreComments: true, ignoreUrls: true, ignoreTemplateLiterals: true, ignoreStrings: true }],
'max-len': [
'warn',
{
code: 120,
ignoreComments: true,
ignoreUrls: true,
ignoreTemplateLiterals: true,
ignoreStrings: true,
},
],
'@typescript-eslint/no-explicit-any': ['off'],
'no-html-link-for-pages': ['off'],
'no-restricted-imports': [
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --check --cache --cache-location='node_modules/.cache/.prettiercache' --log-level=warn",
"format:fix": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --write --cache --cache-location='node_modules/.cache/.prettiercache' --log-level=warn"
"format": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --check --cache --log-level=warn",
"format:fix": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --write --cache --log-level=warn"
}
}
7 changes: 7 additions & 0 deletions packages/lib/.lintstagedrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
'*.{js,jsx,ts,tsx}': "eslint --fix --cache --max-warnings 0",
'**/*.ts?(x)': 'bash -c "pnpm typecheck"',
'*.{md,json,yaml,ts,tsx}': 'prettier --write',
'*.css': 'stylelint --fix',
}

10 changes: 5 additions & 5 deletions packages/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
"private": true,
"scripts": {
"graphql:gen": "DOTENV_CONFIG_PATH=./.env.local graphql-codegen -r dotenv/config -c ./shared/services/api/codegen.ts",
"lint": "eslint . --cache --cache-location 'node_modules/.cache/.eslintcache'",
"lint:fix": "eslint . --fix --cache --cache-location 'node_modules/.cache/.eslintcache'",
"format": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --check --cache --cache-location='node_modules/.cache/.prettiercache' --log-level=warn",
"format:fix": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --write --cache --cache-location='node_modules/.cache/.prettiercache' --log-level=warn",
"lint": "eslint . --cache",
"lint:fix": "eslint . --fix --max-warnings 0 --cache",
"format": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --check --cache --log-level=warn",
"format:fix": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --write --cache --log-level=warn",
"test": "pnpm test:unit & pnpm run test:integration",
"test:integration": "vitest -c ./vitest.config.integration.ts",
"test:unit": "vitest",
"test:unit:coverage": "vitest --coverage",
"test:unit:silent:coverage": "SILENT_TESTS=true vitest --coverage",
"typecheck": "tsc --project tsconfig.json --noEmit"
"typecheck": "tsc --project tsconfig.json --noEmit --incremental"
},
"dependencies": {
"@apollo/client": "^3.11.8",
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
},
"include": ["**/*.ts", "**/*.tsx", "global.d.ts"],
"exclude": ["node_modules"]
"exclude": ["node_modules", "**/generated/**"]
}
4 changes: 2 additions & 2 deletions packages/prettier-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --check --cache --cache-location='node_modules/.cache/.prettiercache' --log-level=warn",
"format:fix": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --write --cache --cache-location='node_modules/.cache/.prettiercache' --log-level=warn"
"format": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --check --cache --log-level=warn",
"format:fix": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --write --cache --log-level=warn"
}
}
4 changes: 2 additions & 2 deletions packages/typescript-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"access": "public"
},
"scripts": {
"format": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --check --cache --cache-location='node_modules/.cache/.prettiercache' --log-level=warn",
"format:fix": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --write --cache --cache-location='node_modules/.cache/.prettiercache' --log-level=warn"
"format": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --check --cache --log-level=warn",
"format:fix": "prettier '**/*.*(md|json|yaml|ts|js|tsx)' --write --cache --log-level=warn"
}
}
7 changes: 4 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"PRIVATE_CURRENCYAPI_KEY",
"VITEST_POOL_ID",
"NODE_ENV",
"SILENT_TESTS"
"SILENT_TESTS",
"NEXT_RUNTIME"
],
"tasks": {
"dev": {
Expand Down
Loading