EsLint v9 (#154)
* Upgrade ESLint and related configurations to version 9 - Update ESLint to version 9.19.0 - Migrate ESLint configurations to flat config format - Remove deprecated ESLint config files - Update package dependencies and configurations - Simplify ESLint setup across packages - Remove unnecessary ESLint config blocks from package.json files - Improved CI caching with Turborepo tasks - Removed duplicate styles
This commit is contained in:
committed by
GitHub
parent
e2f45cae49
commit
6f9cf22fa8
@@ -1,29 +1,20 @@
|
||||
/** @type {import("eslint").Linter.Config} */
|
||||
const config = {
|
||||
env: {
|
||||
es2022: true,
|
||||
node: true,
|
||||
export default [
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
rules: {
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
paths: [
|
||||
{
|
||||
name: '@kit/supabase/database',
|
||||
importNames: ['Database'],
|
||||
message:
|
||||
'Please use the application types from your app "~/lib/database.types" instead',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: true,
|
||||
},
|
||||
plugins: ['@typescript-eslint', 'import'],
|
||||
rules: {
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
paths: [
|
||||
{
|
||||
name: '@kit/supabase/database',
|
||||
importNames: ['Database'],
|
||||
message:
|
||||
'Please use the application types from your app "~/lib/database.types" instead',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
];
|
||||
|
||||
@@ -1,63 +1,92 @@
|
||||
/** @type {import("eslint").Linter.Config} */
|
||||
const config = {
|
||||
extends: [
|
||||
'turbo',
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended-type-checked',
|
||||
'plugin:@typescript-eslint/stylistic-type-checked',
|
||||
'prettier',
|
||||
],
|
||||
env: {
|
||||
es2022: true,
|
||||
node: true,
|
||||
},
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: true,
|
||||
},
|
||||
plugins: ['@typescript-eslint', 'import'],
|
||||
rules: {
|
||||
'turbo/no-undeclared-env-vars': 'off',
|
||||
'@typescript-eslint/array-type': 'off',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'off',
|
||||
'@typescript-eslint/no-unsafe-argument': 'off',
|
||||
'@typescript-eslint/consistent-type-definitions': 'off',
|
||||
'@typescript-eslint/no-unsafe-member-access': 'off',
|
||||
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
|
||||
'@typescript-eslint/only-throw-error': 'off',
|
||||
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
||||
],
|
||||
'@typescript-eslint/no-misused-promises': [
|
||||
2,
|
||||
{ checksVoidReturn: { attributes: false } },
|
||||
],
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
paths: [
|
||||
{
|
||||
name: 'react-i18next',
|
||||
importNames: ['Trans'],
|
||||
message: 'Please use `@kit/ui/trans` instead',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
ignorePatterns: [
|
||||
'**/.eslintrc.cjs',
|
||||
'**/*.config.js',
|
||||
'**/*.config.cjs',
|
||||
'**/node_modules',
|
||||
'database.types.ts',
|
||||
'.next',
|
||||
'dist',
|
||||
'pnpm-lock.yaml',
|
||||
],
|
||||
reportUnusedDisableDirectives: true,
|
||||
};
|
||||
import eslint from '@eslint/js';
|
||||
import eslintConfigPrettier from 'eslint-config-prettier';
|
||||
import eslintReact from 'eslint-plugin-react';
|
||||
import reactPlugin from 'eslint-plugin-react';
|
||||
import hooksPlugin from 'eslint-plugin-react-hooks';
|
||||
import tsEsLint from 'typescript-eslint';
|
||||
|
||||
module.exports = config;
|
||||
import nextConfig from './nextjs.js';
|
||||
|
||||
export default tsEsLint.config(
|
||||
eslint.configs.recommended,
|
||||
tsEsLint.configs.recommended,
|
||||
eslintReact.configs.flat.recommended,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
ecmaVersion: 2022,
|
||||
sourceType: 'module',
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
modules: true,
|
||||
},
|
||||
projectService: true,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
settings: {
|
||||
react: {
|
||||
version: 'detect',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
plugins: {
|
||||
'react-hooks': hooksPlugin,
|
||||
},
|
||||
rules: hooksPlugin.configs.recommended.rules,
|
||||
},
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
...reactPlugin.configs.flat['jsx-runtime'],
|
||||
...reactPlugin.configs.flat.recommended,
|
||||
},
|
||||
nextConfig,
|
||||
eslintConfigPrettier,
|
||||
{
|
||||
rules: {
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
'import/no-anonymous-default-export': 'off',
|
||||
'turbo/no-undeclared-env-vars': 'off',
|
||||
'@typescript-eslint/array-type': 'off',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'off',
|
||||
'@typescript-eslint/no-unsafe-argument': 'off',
|
||||
'@typescript-eslint/consistent-type-definitions': 'off',
|
||||
'@typescript-eslint/no-unsafe-member-access': 'off',
|
||||
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
|
||||
'@typescript-eslint/only-throw-error': 'off',
|
||||
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
||||
],
|
||||
'@typescript-eslint/no-misused-promises': [
|
||||
2,
|
||||
{ checksVoidReturn: { attributes: false } },
|
||||
],
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
paths: [
|
||||
{
|
||||
name: 'react-i18next',
|
||||
importNames: ['Trans'],
|
||||
message: 'Please use `@kit/ui/trans` instead',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
ignores: [
|
||||
'**/node_modules',
|
||||
'**/database.types.ts',
|
||||
'.next',
|
||||
'dist',
|
||||
'pnpm-lock.yaml',
|
||||
],
|
||||
},
|
||||
);
|
||||
|
||||
3
tooling/eslint/eslint.config.mjs
Normal file
3
tooling/eslint/eslint.config.mjs
Normal file
@@ -0,0 +1,3 @@
|
||||
import eslint from '@eslint/js';
|
||||
|
||||
export default [eslint.configs.recommended];
|
||||
@@ -1,9 +1,16 @@
|
||||
/** @type {import('eslint').Linter.Config} */
|
||||
const config = {
|
||||
extends: ['plugin:@next/next/recommended'],
|
||||
rules: {
|
||||
'@next/next/no-html-link-for-pages': 'off',
|
||||
},
|
||||
};
|
||||
import { FlatCompat } from '@eslint/eslintrc';
|
||||
|
||||
module.exports = config;
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: import.meta.dirname,
|
||||
});
|
||||
|
||||
const nextEslintConfig = [
|
||||
...compat.config({
|
||||
extends: ['next/core-web-vitals', 'next/typescript'],
|
||||
rules: {
|
||||
'@next/next/no-html-link-for-pages': 'off',
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
export default nextEslintConfig;
|
||||
|
||||
@@ -2,38 +2,32 @@
|
||||
"name": "@kit/eslint-config",
|
||||
"version": "0.2.0",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"files": [
|
||||
"./apps.js"
|
||||
"./apps.js",
|
||||
"./base.js",
|
||||
"./nextjs.js"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "rm -rf .turbo node_modules",
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --check \"**/*.{js,json}\"",
|
||||
"typecheck": "tsc --noEmit"
|
||||
"format": "prettier --check \"**/*.{js,json}\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@next/eslint-plugin-next": "15.1.6",
|
||||
"@types/eslint": "^8.56.10",
|
||||
"@typescript-eslint/eslint-plugin": "^8.23.0",
|
||||
"@typescript-eslint/parser": "^8.23.0",
|
||||
"@types/eslint": "9.6.1",
|
||||
"eslint-config-next": "15.1.6",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
"eslint-config-turbo": "^2.4.0",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-react": "7.37.4",
|
||||
"eslint-plugin-react-hooks": "^5.1.0"
|
||||
"eslint-plugin-react-hooks": "^5.1.0",
|
||||
"typescript-eslint": "8.23.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kit/prettier-config": "workspace:*",
|
||||
"@kit/tsconfig": "workspace:*",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint": "^9.19.0",
|
||||
"typescript": "^5.7.3"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"extends": [
|
||||
"./apps.js"
|
||||
]
|
||||
},
|
||||
"prettier": "@kit/prettier-config"
|
||||
}
|
||||
|
||||
20
tooling/eslint/react.js
vendored
20
tooling/eslint/react.js
vendored
@@ -1,20 +0,0 @@
|
||||
/** @type {import('eslint').Linter.Config} */
|
||||
const config = {
|
||||
extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],
|
||||
rules: {
|
||||
'react/prop-types': 'off',
|
||||
},
|
||||
globals: {
|
||||
React: 'writable',
|
||||
},
|
||||
settings: {
|
||||
react: {
|
||||
version: 'detect',
|
||||
},
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"extends": "@kit/tsconfig/base.json",
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
|
||||
},
|
||||
"include": ["."],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"name": "@kit/tailwind-config",
|
||||
"version": "0.1.0",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"postcss.js"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "rm -rf .turbo node_modules",
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --check \"**/*.{js,ts,json}\"",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"postcss": "8.5.1",
|
||||
"tailwindcss": "4.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kit/eslint-config": "workspace:*",
|
||||
"@kit/prettier-config": "workspace:*",
|
||||
"@kit/tsconfig": "workspace:*",
|
||||
"@tailwindcss/postcss": "^4.0.3",
|
||||
"eslint": "^8.57.0",
|
||||
"prettier": "^3.4.2",
|
||||
"typescript": "^5.7.3"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"extends": [
|
||||
"@kit/eslint-config/base"
|
||||
]
|
||||
},
|
||||
"prettier": "@kit/prettier-config"
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
module.exports = {
|
||||
plugins: {
|
||||
'@tailwindcss/postcss': {},
|
||||
},
|
||||
};
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"extends": "@kit/tsconfig/base.json",
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
|
||||
},
|
||||
"include": ["."],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user