monorepo/apps/web2/eslint.config.mjs

123 lines
3.9 KiB
JavaScript
Raw Normal View History

2025-01-15 10:39:14 +08:00
import antfu from '@antfu/eslint-config';
import nextPlugin from '@next/eslint-plugin-next';
import eslintConfigPrettier from 'eslint-config-prettier';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import perfectionist from 'eslint-plugin-perfectionist';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import tailwind from 'eslint-plugin-tailwindcss';
import unusedImports from 'eslint-plugin-unused-imports';
export default antfu(
{
react: true,
typescript: {
2025-01-24 14:26:30 +08:00
tsconfigPath: 'tsconfig.eslint.json',
2025-01-15 10:39:14 +08:00
},
stylistic: false,
rules: {
'no-console': 'off',
'ts/no-use-before-define': 'off',
'ts/strict-boolean-expressions': 'off',
'ts/no-unsafe-member-access': 'off',
'ts/no-unsafe-call': 'off',
'ts/no-unsafe-assignment': 'off',
'ts/no-unsafe-return': 'off',
'ts/no-unsafe-argument': 'off',
'ts/no-misused-promises': 'off',
'ts/no-floating-promises': 'off',
'node/prefer-global/process': 'off',
'node/prefer-global/buffer': 'off',
'import/no-named-default': 'off',
'react-hooks/exhaustive-deps': 'off',
'react-refresh/only-export-components': 'off',
'react/no-leaked-conditional-rendering': 'off',
'react/no-forward-ref': 'off',
},
ignores: [
'public',
'node_modules',
'src/database/migrations',
'dist',
'build',
'.history',
'.next',
'LICENSE',
'yarn-error.log',
'public',
'pnpm-lock.yaml',
'package-lock.json',
'.DS_Store',
'.prettierignore',
'.gitignore',
'docker',
'Dockerfile*',
'next-env.d.ts',
'*.sql',
'*.lock',
'*.png',
'*.jpg',
'*.jpeg',
'*.eot',
'*.ttf',
'*.woff',
],
},
...tailwind.configs['flat/recommended'],
jsxA11y.flatConfigs.recommended,
{
plugins: {
'@next/next': nextPlugin,
},
rules: {
...nextPlugin.configs.recommended.rules,
...nextPlugin.configs['core-web-vitals'].rules,
},
},
{
name: 'perfectionist',
rules: {
'import/order': 'off',
'sort-imports': 'off',
'perfectionist/sort-imports':
perfectionist.configs['recommended-natural'].rules['perfectionist/sort-imports'],
'perfectionist/sort-exports':
perfectionist.configs['recommended-natural'].rules['perfectionist/sort-exports'],
'perfectionist/sort-named-imports':
perfectionist.configs['recommended-natural'].rules[
'perfectionist/sort-named-imports'
],
'perfectionist/sort-named-exports':
perfectionist.configs['recommended-natural'].rules[
'perfectionist/sort-named-exports'
],
},
},
{
plugins: {
'unused-imports': unusedImports,
},
rules: {
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
},
},
{
name: 'tailwind',
rules: {
'tailwindcss/no-custom-classname': 'off',
},
},
eslintConfigPrettier,
eslintPluginPrettierRecommended,
);