From ac33c2e07d6e2838f948bbef8d525688ad6a6e85 Mon Sep 17 00:00:00 2001 From: junwen-k <40173716+junwen-k@users.noreply.github.com> Date: Sun, 16 Jun 2024 16:44:05 +0800 Subject: [PATCH] chore(eslint,lintstaged): update eslint and lint-staged config --- .vscode/settings.json | 1 + eslint.config.js | 4 ++-- .lintstagedrc.json => examples/joy-ui-vite/.lintstagedrc.json | 0 examples/shadcn-ui-nextjs/.lintstagedrc.json | 4 ++++ packages/use-ask/.lintstagedrc.json | 4 ++++ 5 files changed, 11 insertions(+), 2 deletions(-) rename .lintstagedrc.json => examples/joy-ui-vite/.lintstagedrc.json (100%) create mode 100644 examples/shadcn-ui-nextjs/.lintstagedrc.json create mode 100644 packages/use-ask/.lintstagedrc.json diff --git a/.vscode/settings.json b/.vscode/settings.json index 77babbc..f391dfe 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,6 +4,7 @@ }, "eslint.workingDirectories": [{ "mode": "auto" }], "eslint.useFlatConfig": true, + "eslint.experimental.useFlatConfig": true, "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true } diff --git a/eslint.config.js b/eslint.config.js index 5fa5483..1e60caf 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -17,12 +17,13 @@ export default tseslint.config( { ignores: ['node_modules/', '{examples,packages}/**/dist/', 'examples/**/.next/'], }, + ...fixupConfigRules(compat.config(turbo)), { files: ['examples/shadcn-ui-nextjs/**/*.{js?(x),mjs,ts?(x),mdx}'], extends: [...fixupConfigRules(compat.config(nextPlugin.configs['core-web-vitals']))], settings: { next: { - rootDir: ['apps/*/'], + rootDir: ['apps/shadcn-ui-nextjs/'], }, }, }, @@ -32,7 +33,6 @@ export default tseslint.config( eslint.configs.recommended, ...fixupConfigRules(compat.config(importPlugin.configs.recommended)), ...fixupConfigRules(compat.config(importPlugin.configs.typescript)), - ...fixupConfigRules(compat.config(turbo)), ], rules: { 'import/order': [ diff --git a/.lintstagedrc.json b/examples/joy-ui-vite/.lintstagedrc.json similarity index 100% rename from .lintstagedrc.json rename to examples/joy-ui-vite/.lintstagedrc.json diff --git a/examples/shadcn-ui-nextjs/.lintstagedrc.json b/examples/shadcn-ui-nextjs/.lintstagedrc.json new file mode 100644 index 0000000..a17ee73 --- /dev/null +++ b/examples/shadcn-ui-nextjs/.lintstagedrc.json @@ -0,0 +1,4 @@ +{ + "**/*.{js,mjs,ts,tsx,md,mdx}": ["eslint --fix", "prettier --check --write"], + "**/*.{json,yml}": ["prettier --check --write"] +} diff --git a/packages/use-ask/.lintstagedrc.json b/packages/use-ask/.lintstagedrc.json new file mode 100644 index 0000000..a17ee73 --- /dev/null +++ b/packages/use-ask/.lintstagedrc.json @@ -0,0 +1,4 @@ +{ + "**/*.{js,mjs,ts,tsx,md,mdx}": ["eslint --fix", "prettier --check --write"], + "**/*.{json,yml}": ["prettier --check --write"] +}