1
0
Fork 0
hackaton_2023/eslint.config.js

76 lines
2.4 KiB
JavaScript

import * as eslintrc from '@eslint/eslintrc';
import js from '@eslint/js';
import typescript from '@typescript-eslint/eslint-plugin';
import parser from '@typescript-eslint/parser';
import importPlugin from 'eslint-plugin-import';
import prittierConfig from 'eslint-plugin-prettier/recommended.js';
import react from 'eslint-plugin-react';
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
import globals from 'globals';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
/** @type { import("eslint").Linter.FlatConfig[] } */
export default [
{
ignores: ['**/*.js', '!*.config.js'],
},
{
files: ['src/**/*.ts', 'src/**/*.tsx'],
},
{
languageOptions: {
globals: {
...globals.node,
...eslintrc.Legacy.environments.get('es2024').globals,
},
parser,
parserOptions: {
...eslintrc.Legacy.environments.get('es2024').parserOptions,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
version: 'detect',
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: true,
node: true,
},
},
rules: {
...typescript.configs['recommended'].rules,
'import/no-unresolved': 'error',
'import/named': 'error',
'import/export': 'error',
'import/no-named-as-default': 'warn',
'import/no-named-as-default-member': 'warn',
'import/no-duplicates': 'warn',
'@typescript-eslint/no-unused-vars': 'off',
'unicorn/filename-case': [
'error',
{
case: 'camelCase',
},
],
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
},
plugins: {
'@typescript-eslint': typescript,
react,
import: importPlugin,
'react-hooks': reactHooksPlugin,
},
},
importPlugin.configs.typescript,
eslintPluginUnicorn.configs['flat/recommended'],
js.configs.recommended,
prittierConfig,
];