-
Notifications
You must be signed in to change notification settings - Fork 6
/
eslint.config.mjs
71 lines (69 loc) · 2.82 KB
/
eslint.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import pluginJs from '@eslint/js';
import nextPlugin from '@next/eslint-plugin-next';
import eslintConfigPrettier from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import pluginPromise from 'eslint-plugin-promise';
import pluginReact from 'eslint-plugin-react';
import tailwind from 'eslint-plugin-tailwindcss';
import globals from 'globals';
import tseslint from 'typescript-eslint';
export default [
{
files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}']
},
{
languageOptions: {
ecmaVersion: 'latest',
globals: { ...globals.browser, ...globals.node }
}
},
{
settings: {
react: {
version: 'detect'
}
}
},
pluginJs.configs.recommended, // ? https://github.com/eslint/eslint
importPlugin.flatConfigs.recommended, // ? https://github.com/import-js/eslint-plugin-import
...tseslint.configs.recommended, // ? https://github.com/typescript-eslint/typescript-eslint
pluginPromise.configs['flat/recommended'], // ? https://github.com/eslint-community/eslint-plugin-promise
pluginReact.configs.flat.recommended, // ? https://github.com/jsx-eslint/eslint-plugin-react
pluginReact.configs.flat['jsx-runtime'], // ? https://github.com/jsx-eslint/eslint-plugin-react
eslintConfigPrettier, // ? https://github.com/prettier/eslint-config-prettier
...tailwind.configs['flat/recommended'], // ? https://github.com/francoismassart/eslint-plugin-tailwindcss
{
rules: {
'no-unused-vars': 'off',
'react/react-in-jsx-scope': 'off',
'react-hooks/exhaustive-deps': 'off',
'react/display-name': 'off',
'react/prop-types': 'off',
'newline-before-return': 'error',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'tailwindcss/no-custom-classname': 'off',
'tailwindcss/migration-from-tailwind-2': 'off',
'import/no-unresolved': 'off',
'import/no-named-as-default': 'off'
}
},
// ! ===================== DISCLAIMER =====================
// ! There is no official solution available for new ESLint 9 flat config structure for NextJS
// ! The solution is taken from the community and may not be the best practice, use it at your own risk
// ? Ref: https://github.com/vercel/next.js/discussions/49337?sort=top#discussioncomment-5998603
// ! ======================================================
{
plugins: {
'@next/next': nextPlugin
},
rules: {
...nextPlugin.configs.recommended.rules,
...nextPlugin.configs['core-web-vitals'].rules,
'@next/next/no-img-element': 'off'
}
},
{
ignores: ['.next/*']
}
];