feat: Unify ESLint configs for Next.js apps (#27275)

* Move the eslint preset into a separate package.

* Import the next package into all apps. Remove redundant packages.

* Import the new eslint rules.

* Update the package-lock.
This commit is contained in:
Ivan Vasilov
2024-06-17 12:17:01 +02:00
committed by GitHub
parent e2271707cc
commit 3738cebbd7
19 changed files with 407 additions and 941 deletions

View File

@@ -0,0 +1,3 @@
module.exports = {
extends: ['eslint-config-supabase/next'],
}

View File

@@ -1,3 +0,0 @@
{
"extends": "next/core-web-vitals"
}

View File

@@ -18,7 +18,7 @@
"common": "*",
"config": "*",
"dayjs": "^1.11.10",
"eslint-config-next": "^14.2.3",
"eslint-config-supabase": "*",
"libpg-query": "^15.1.0",
"lodash": "^4.17.21",
"lucide-react": "^0.338.0",

View File

@@ -0,0 +1,3 @@
module.exports = {
extends: ['eslint-config-supabase/next'],
}

View File

@@ -1,3 +0,0 @@
{
"extends": "next/core-web-vitals"
}

View File

@@ -15,6 +15,7 @@
"dependencies": {
"@radix-ui/react-alert-dialog": "^1.0.5",
"contentlayer2": "0.4.5",
"eslint-config-supabase": "*",
"fs": "^0.0.1-security",
"jotai": "^2.8.0",
"lodash.template": "4.5.0",
@@ -45,14 +46,12 @@
"@types/react-dom": "^18.2.22",
"autoprefixer": "^10.0.1",
"config": "*",
"tsconfig": "*",
"eslint": "^8",
"eslint-config-next": "14.1.4",
"mdast-util-toc": "^6.1.1",
"postcss": "^8",
"rimraf": "^4.1.3",
"shiki": "^1.1.7",
"tailwindcss": "^3.3.0",
"tsconfig": "*",
"typescript": "^5",
"unist-builder": "3.0.0"
}

View File

@@ -1 +1,3 @@
module.exports = require('config/eslint-preset')
module.exports = {
extends: ['eslint-config-supabase/next'],
}

View File

@@ -38,6 +38,7 @@
"common": "*",
"common-tags": "^1.8.2",
"config": "*",
"eslint-config-supabase": "*",
"framer-motion": "^11.0.3",
"github-slugger": "^2.0.0",
"gray-matter": "^4.0.3",

8
apps/studio/.eslintrc.js Normal file
View File

@@ -0,0 +1,8 @@
module.exports = {
extends: ['eslint-config-supabase/next'],
rules: {
'@next/next/no-img-element': 'off',
'react/no-unescaped-entities': 'off',
'react/display-name': 'warn',
},
}

View File

@@ -1,8 +0,0 @@
{
"extends": "next/core-web-vitals",
"rules": {
"@next/next/no-img-element": "off",
"react/no-unescaped-entities": "off",
"react/display-name": "warn"
}
}

View File

@@ -151,7 +151,7 @@
"autoprefixer": "^10.4.14",
"common": "*",
"config": "*",
"eslint-config-next": "^14.2.3",
"eslint-config-supabase": "*",
"msw": "^2.3.0",
"next-router-mock": "^0.9.13",
"postcss": "^8.4.31",

9
apps/www/.eslintrc.js Normal file
View File

@@ -0,0 +1,9 @@
module.exports = {
extends: ['eslint-config-supabase/next'],
rules: {
'react-hooks/rules-of-hooks': 'warn',
'react/no-unescaped-entities': 'warn',
'react/display-name': 'warn',
'react/no-children-prop': 'warn',
},
}

View File

@@ -8,6 +8,7 @@
"build": "npm run content:build && next build",
"export": "next export",
"start": "next start",
"lint": "next lint",
"typecheck": "npm run content:build && tsc --noEmit",
"content:build": "contentlayer2 build",
"prettier": "prettier --write \"./{pages,components,lib,stores,styles,tests}/**/*.{ts,tsx,md,js,jsx,json}\"",
@@ -36,6 +37,7 @@
"contentlayer2": "^0.4.5",
"dat.gui": "^0.7.9",
"dayjs": "^1.11.10",
"eslint-config-supabase": "*",
"framer-motion": "^11.0.3",
"globby": "^13.2.2",
"gray-matter": "^4.0.3",

1259
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -37,7 +37,6 @@
},
"devDependencies": {
"eslint": "^8.57.0",
"eslint-config-custom": "*",
"prettier": "^4.0.0-alpha.8",
"prettier-plugin-sql-cst": "^0.11.0",
"sass": "^1.72.0",

View File

@@ -1,12 +0,0 @@
module.exports = {
extends: ["next", "prettier"],
settings: {
next: {
rootDir: ["apps/*/", "packages/*/"],
},
},
rules: {
"@next/next/no-html-link-for-pages": "off",
"react/jsx-key": "off",
},
};

View File

@@ -3,18 +3,12 @@
"version": "0.0.0",
"main": "index.js",
"license": "MIT",
"files": [
"eslint-preset.js"
],
"dependencies": {
"@mertasan/tailwindcss-variables": "^2.2.3",
"@radix-ui/colors": "^0.1.8",
"@tailwindcss/forms": "^0.5.0",
"@tailwindcss/typography": "^0.5.9",
"deepmerge": "^4.2.2",
"eslint-config-next": "^14.2.3",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react": "7.33.2",
"mini-svg-data-uri": "^1.4.3",
"tailwindcss-radix": "^2.0.0"
},

View File

@@ -0,0 +1,7 @@
module.exports = {
extends: ['prettier', 'next/core-web-vitals'],
rules: {
'@next/next/no-html-link-for-pages': 'off',
'react/jsx-key': 'off',
},
}

View File

@@ -0,0 +1,10 @@
{
"name": "eslint-config-supabase",
"version": "1.0.0",
"main": "next.js",
"license": "MIT",
"dependencies": {
"eslint-config-next": "^14.2.3",
"eslint-config-prettier": "^9.1.0"
}
}