113 lines
2.8 KiB
JavaScript
113 lines
2.8 KiB
JavaScript
import tseslint from '@typescript-eslint/eslint-plugin';
|
|
import tsparser from '@typescript-eslint/parser';
|
|
import reactPlugin from 'eslint-plugin-react';
|
|
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
import unusedImports from 'eslint-plugin-unused-imports';
|
|
import prettierPlugin from 'eslint-plugin-prettier';
|
|
import importPlugin from 'eslint-plugin-import';
|
|
import nextPlugin from '@next/eslint-plugin-next';
|
|
|
|
export default [
|
|
{
|
|
ignores: ['.next', 'node_modules']
|
|
},
|
|
{
|
|
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
ignores: [
|
|
'build/**/*',
|
|
'public/**/*',
|
|
'dist/**/*',
|
|
'coverage/**/*',
|
|
'*.config.js',
|
|
'*.config.ts',
|
|
'postcss.config.js',
|
|
'tailwind.config.js',
|
|
],
|
|
languageOptions: {
|
|
parser: tsparser,
|
|
parserOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
},
|
|
},
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': tseslint,
|
|
'react': reactPlugin,
|
|
'react-hooks': reactHooksPlugin,
|
|
'unused-imports': unusedImports,
|
|
'prettier': prettierPlugin,
|
|
'import': importPlugin,
|
|
'next': nextPlugin,
|
|
},
|
|
settings: {
|
|
react: {
|
|
version: 'detect',
|
|
},
|
|
},
|
|
rules: {
|
|
'react/prop-types': 'off',
|
|
'react/jsx-uses-react': 'off',
|
|
'react/react-in-jsx-scope': 'off',
|
|
'react/self-closing-comp': 'warn',
|
|
'react/jsx-sort-props': [
|
|
'warn',
|
|
{
|
|
callbacksLast: true,
|
|
shorthandFirst: true,
|
|
noSortAlphabetically: false,
|
|
reservedFirst: true,
|
|
},
|
|
],
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
'react-hooks/rules-of-hooks': 'error',
|
|
'no-unused-vars': 'off',
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'warn',
|
|
{
|
|
args: 'after-used',
|
|
ignoreRestSiblings: false,
|
|
argsIgnorePattern: '^_.*?$',
|
|
},
|
|
],
|
|
'unused-imports/no-unused-imports': 'warn',
|
|
'import/order': [
|
|
'warn',
|
|
{
|
|
groups: [
|
|
'type',
|
|
'builtin',
|
|
'object',
|
|
'external',
|
|
'internal',
|
|
'parent',
|
|
'sibling',
|
|
'index',
|
|
],
|
|
pathGroups: [
|
|
{
|
|
pattern: '~/**',
|
|
group: 'external',
|
|
position: 'after',
|
|
},
|
|
],
|
|
'newlines-between': 'always',
|
|
},
|
|
],
|
|
'prettier/prettier': 'warn',
|
|
'padding-line-between-statements': [
|
|
'warn',
|
|
{ blankLine: 'always', prev: '*', next: 'return' },
|
|
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
|
|
{
|
|
blankLine: 'any',
|
|
prev: ['const', 'let', 'var'],
|
|
next: ['const', 'let', 'var'],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
];
|