add eslint, bug fixes
This commit is contained in:
49
eslint.config.js
Normal file
49
eslint.config.js
Normal 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' }],
|
||||
},
|
||||
},
|
||||
]
|
||||
Reference in New Issue
Block a user