mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
107 lines
2.5 KiB
JavaScript
107 lines
2.5 KiB
JavaScript
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'
|
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
import typescriptEslint from '@typescript-eslint/eslint-plugin'
|
|
import react from 'eslint-plugin-react'
|
|
import _import from 'eslint-plugin-import'
|
|
import globals from 'globals'
|
|
import tsParser from '@typescript-eslint/parser'
|
|
import path from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
import js from '@eslint/js'
|
|
import { FlatCompat } from '@eslint/eslintrc'
|
|
|
|
const __filename = fileURLToPath(import.meta.url)
|
|
const __dirname = path.dirname(__filename)
|
|
const compat = new FlatCompat({
|
|
baseDirectory: __dirname,
|
|
recommendedConfig: js.configs.recommended,
|
|
allConfig: js.configs.all,
|
|
})
|
|
|
|
export default [
|
|
{
|
|
ignores: [
|
|
'**/dist',
|
|
'**/.eslintrc.cjs',
|
|
'**/eslint.config.mjs',
|
|
'**/babel.config.js',
|
|
'*/node_modules/*',
|
|
'**/vite.config.ts',
|
|
'**/vite-env.d.ts',
|
|
'**/jest.config.ts',
|
|
'**/coverage',
|
|
'src/components/Map/*.js',
|
|
'src/components/Map/country_borders_WGS84.ts',
|
|
],
|
|
},
|
|
...fixupConfigRules(
|
|
compat.extends(
|
|
'eslint:recommended',
|
|
'plugin:react-hooks/recommended',
|
|
'plugin:prettier/recommended',
|
|
'plugin:react/recommended',
|
|
'plugin:import/recommended',
|
|
'plugin:import/typescript',
|
|
'plugin:@typescript-eslint/recommended-type-checked'
|
|
)
|
|
),
|
|
{
|
|
plugins: {
|
|
'react-refresh': reactRefresh,
|
|
'@typescript-eslint': fixupPluginRules(typescriptEslint),
|
|
react: fixupPluginRules(react),
|
|
import: fixupPluginRules(_import),
|
|
},
|
|
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.browser,
|
|
},
|
|
|
|
parser: tsParser,
|
|
ecmaVersion: 5,
|
|
sourceType: 'script',
|
|
|
|
parserOptions: {
|
|
project: true,
|
|
tsconfigRootDir: __dirname,
|
|
},
|
|
},
|
|
|
|
settings: {
|
|
'import/resolver': {
|
|
typescript: {},
|
|
},
|
|
|
|
react: {
|
|
pragma: 'React',
|
|
version: '18',
|
|
},
|
|
},
|
|
|
|
rules: {
|
|
'react-refresh/only-export-components': [
|
|
'warn',
|
|
{
|
|
allowConstantExport: true,
|
|
},
|
|
],
|
|
|
|
'prettier/prettier': [
|
|
'error',
|
|
{
|
|
endOfLine: 'auto',
|
|
},
|
|
],
|
|
|
|
'no-console': 'error',
|
|
'no-async-promise-executor': 'off',
|
|
'no-unused-vars': 'off',
|
|
'@typescript-eslint/no-unused-vars': 'off',
|
|
'react/jsx-uses-react': 'off',
|
|
'react/react-in-jsx-scope': 'off',
|
|
'import/no-named-as-default-member': 'off',
|
|
},
|
|
},
|
|
]
|