add eslint, bug fixes

This commit is contained in:
Salam-vsem
2025-05-18 00:56:02 +03:00
parent bc645a8261
commit 33a432cbd1
18 changed files with 3264 additions and 32 deletions

49
eslint.config.js Normal file
View File

@@ -0,0 +1,49 @@
import eslintPluginAstro from 'eslint-plugin-astro'
import typescriptParser from '@typescript-eslint/parser'
import typescriptPlugin from '@typescript-eslint/eslint-plugin'
import reactPlugin from 'eslint-plugin-react'
export default [
...eslintPluginAstro.configs.recommended,
{
ignores: [
'node_modules/**',
'dist/**',
'.astro/**',
'coverage/**',
'*.config.{js,ts,mjs}',
'.prettierrc',
'package*.json',
'tsconfig.json',
],
files: ['**/*.{ts,tsx,js,jsx,mjs,cjs}'],
plugins: {
'@typescript-eslint': typescriptPlugin,
react: reactPlugin,
},
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
project: './tsconfig.json',
},
},
rules: {
...typescriptPlugin.configs.recommended.rules,
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
},
},
]