Files
Compass/web/eslint.config.mjs
2026-02-23 14:48:03 +01:00

121 lines
3.5 KiB
JavaScript

import js from '@eslint/js'
import tseslint from 'typescript-eslint'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import next from '@next/eslint-plugin-next'
import lodash from 'eslint-plugin-lodash'
import unusedImports from 'eslint-plugin-unused-imports'
import simpleImportSort from 'eslint-plugin-simple-import-sort'
import eslintConfigPrettier from 'eslint-config-prettier'
export default tseslint.config(
js.configs.recommended,
...tseslint.configs.recommended,
{
plugins: {
react,
'react-hooks': reactHooks,
'@next/next': next,
lodash,
'unused-imports': unusedImports,
'simple-import-sort': simpleImportSort,
},
languageOptions: {
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
globals: {
window: 'readonly',
document: 'readonly',
navigator: 'readonly',
console: 'readonly',
process: 'readonly',
module: 'readonly',
require: 'readonly',
__dirname: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
fetch: 'readonly',
URL: 'readonly',
URLSearchParams: 'readonly',
Blob: 'readonly',
File: 'readonly',
FormData: 'readonly',
Headers: 'readonly',
Request: 'readonly',
Response: 'readonly',
AbortController: 'readonly',
localStorage: 'readonly',
sessionStorage: 'readonly',
IntersectionObserver: 'readonly',
ResizeObserver: 'readonly',
MutationObserver: 'readonly',
performance: 'readonly',
Image: 'readonly',
Audio: 'readonly',
HTMLElement: 'readonly',
Event: 'readonly',
CustomEvent: 'readonly',
MessageEvent: 'readonly',
ErrorEvent: 'readonly',
ProgressEvent: 'readonly',
WebSocket: 'readonly',
Worker: 'readonly',
import: 'readonly',
},
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'react/prop-types': 'off',
'react/display-name': 'off',
'react/no-unescaped-entities': 'off',
'react/jsx-no-target-blank': 'off',
'react/no-unstable-nested-components': ['error', {allowAsProps: true}],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'@next/next/no-img-element': 'off',
'linebreak-style': ['error', process.platform === 'win32' ? 'windows' : 'unix'],
'lodash/import-scope': [2, 'member'],
'unused-imports/no-unused-imports': 'warn',
'no-constant-condition': 'off',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
},
},
{
ignores: [
'public/mtg/*',
'.next/*',
'node_modules/*',
'eslint.config.mjs',
'out/*',
'coverage/*',
'public/service-worker.js',
'pages_unused/*',
'tailwind.config.js',
],
},
eslintConfigPrettier,
)