86 lines
2.0 KiB
JavaScript
86 lines
2.0 KiB
JavaScript
|
import js from '@eslint/js';
|
||
|
import nextPlugin from '@next/eslint-plugin-next';
|
||
|
import pluginImport from 'eslint-plugin-import';
|
||
|
import configPrettier from 'eslint-plugin-prettier/recommended';
|
||
|
import reactPlugin from 'eslint-plugin-react';
|
||
|
import reactHooks from 'eslint-plugin-react-hooks';
|
||
|
import tseslint from 'typescript-eslint';
|
||
|
export default [
|
||
|
configPrettier,
|
||
|
js.configs.recommended,
|
||
|
...tseslint.configs.recommended,
|
||
|
...tseslint.configs.stylistic,
|
||
|
reactPlugin.configs.flat.recommended, // This is not a plugin object, but a shareable config object
|
||
|
reactPlugin.configs.flat['jsx-runtime'], // Add this if you are using React 17+
|
||
|
{
|
||
|
plugins: {
|
||
|
'react-hooks': reactHooks,
|
||
|
},
|
||
|
rules: reactHooks.configs.recommended.rules,
|
||
|
},
|
||
|
{
|
||
|
plugins: {
|
||
|
'@next/next': nextPlugin,
|
||
|
},
|
||
|
rules: nextPlugin.configs.recommended.rules,
|
||
|
},
|
||
|
{
|
||
|
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
|
||
|
plugins: {
|
||
|
import: pluginImport,
|
||
|
},
|
||
|
rules: {
|
||
|
'import/order': [
|
||
|
'error',
|
||
|
{
|
||
|
alphabetize: {
|
||
|
order: 'asc',
|
||
|
caseInsensitive: true,
|
||
|
},
|
||
|
|
||
|
'newlines-between': 'always',
|
||
|
},
|
||
|
],
|
||
|
|
||
|
'import/no-deprecated': 'warn',
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
|
||
|
settings: {
|
||
|
react: {
|
||
|
version: 'detect',
|
||
|
},
|
||
|
},
|
||
|
rules: {
|
||
|
'no-duplicate-imports': 'error',
|
||
|
'@/lines-between-class-members': [
|
||
|
'error',
|
||
|
'always',
|
||
|
{
|
||
|
exceptAfterSingleLine: true,
|
||
|
},
|
||
|
],
|
||
|
'prettier/prettier': 'error',
|
||
|
'react/no-unescaped-entities': 'error',
|
||
|
'react/react-in-jsx-scope': 'off',
|
||
|
|
||
|
'react/prop-types': [
|
||
|
2,
|
||
|
{
|
||
|
ignore: ['className', 'position'],
|
||
|
},
|
||
|
],
|
||
|
|
||
|
'no-unused-vars': 'off',
|
||
|
|
||
|
'@typescript-eslint/no-unused-vars': [
|
||
|
'error',
|
||
|
{
|
||
|
argsIgnorePattern: '^_',
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
},
|
||
|
];
|