Skip to content

Commit

Permalink
debug eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
barbalex committed Jul 11, 2024
1 parent 4ea4957 commit 8a78b39
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 112 deletions.
26 changes: 9 additions & 17 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ const compat = new FlatCompat({

export default [
{
ignores: ['**/dist', '**/node_modules/'],
ignores: ['**/dist', '**/*.mjs', '**/node_modules/'],
},
...fixupConfigRules(
compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic',
'plugin:react/recommended',
// 'plugin:react/recommended',
'plugin:react-hooks/recommended',
),
),
Expand All @@ -38,25 +38,17 @@ export default [
languageOptions: {
globals: {
...globals.browser,
...globals.amd,
...globals.node,
},

parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module',
// ecmaVersion: 'latest',
// sourceType: 'module',

parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},

settings: {
react: {
version: 'detect',
},
// parserOptions: {
// ecmaFeatures: {
// jsx: true,
// },
// },
},

rules: {
Expand Down
59 changes: 0 additions & 59 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
"use-debounce": "10.0.1"
},
"devDependencies": {
"@babel/eslint-parser": "7.24.8",
"@babel/preset-react": "7.24.7",
"@emotion/babel-plugin": "11.11.0",
"@eslint/compat": "1.1.0",
Expand Down
85 changes: 85 additions & 0 deletions src/components/Projekte/Daten/TpopFilter/ActiveFilters.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { useContext } from 'react'
import styled from '@emotion/styled'
import { observer } from 'mobx-react-lite'
import { useParams } from 'react-router-dom'

import storeContext from '../../../../storeContext.js'
import ErrorBoundary from '../../../shared/ErrorBoundary.jsx'

const FilterCommentTitle = styled.div`
margin-top: -10px;
margin-bottom: -10px;
padding: 0 10px;
font-size: 0.75em;
font-weight: bold;
color: rgba(0, 0, 0, 0.87);
`
const FilterCommentList = styled.ul``
const FilterComment = styled.li`
padding: 0 10px;
font-size: 0.75em;
`

export const ActiveFilters = observer(() => {
const { apId } = useParams()

const store = useContext(storeContext)

const { nodeLabelFilter, mapFilter, apFilter, artIsFiltered, popIsFiltered } =
store.tree

const navApFilterComment = apFilter
? `Navigationsbaum, "nur AP"-Filter: Nur Teil-Populationen von AP-Arten werden berücksichtigt.`
: undefined
const navHiearchyComment =
// popId ? 'Navigationsbaum, Hierarchie-Filter: Im Navigationsbaum ist eine Population gewählt. Es werden nur ihre Teil-Populationen berücksichtigt.' :
apId
? 'Navigationsbaum, Hierarchie-Filter: Im Navigationsbaum ist eine Art gewählt. Es werden nur ihre Teil-Populationen berücksichtigt.'
: undefined
const navLabelComment = nodeLabelFilter.tpop
? `Navigationsbaum, Label-Filter: Das Label der Teil-Populationen wird nach "${nodeLabelFilter.tpop}" gefiltert.`
: undefined
const artHierarchyComment = artIsFiltered
? 'Formular-Filter, Ebene Art: Es werden nur Teil-Populationen berücksichtigt, deren Art die Bedingungen des gesetzten Filters erfüllt.'
: undefined
const popHierarchyComment = popIsFiltered
? 'Formular-Filter, Ebene Population: Es werden nur Teil-Populationen berücksichtigt, deren Population die Bedingungen des gesetzten Filters erfüllt.'
: undefined
const mapFilterComment = mapFilter
? 'Karten-Filter: wird angewendet.'
: undefined

const showFilterComments =
!!navApFilterComment ||
!!navHiearchyComment ||
!!navLabelComment ||
!!artHierarchyComment ||
!!popHierarchyComment ||
!!mapFilter

if (!showFilterComments) return null

return (
<ErrorBoundary>
<FilterCommentTitle>Zusätzlich aktive Filter:</FilterCommentTitle>
<FilterCommentList>
{!!navApFilterComment && (
<FilterComment>{navApFilterComment}</FilterComment>
)}
{!!navHiearchyComment && (
<FilterComment>{navHiearchyComment}</FilterComment>
)}
{!!navLabelComment && <FilterComment>{navLabelComment}</FilterComment>}
{!!artHierarchyComment && (
<FilterComment>{artHierarchyComment}</FilterComment>
)}
{!!popHierarchyComment && (
<FilterComment>{popHierarchyComment}</FilterComment>
)}
{!!mapFilterComment && (
<FilterComment>{mapFilterComment}</FilterComment>
)}
</FilterCommentList>
</ErrorBoundary>
)
})
29 changes: 3 additions & 26 deletions src/components/Projekte/Daten/TpopFilter/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import ErrorBoundary from '../../../shared/ErrorBoundary.jsx'
import Error from '../../../shared/Error.jsx'
import OrTabs from './Tabs.jsx'
import useSearchParamsState from '../../../../modules/useSearchParamsState.js'
import { ActiveFilters } from './ActiveFilters.tsx'

const Container = styled.div`
flex-grow: 1;
Expand Down Expand Up @@ -75,7 +76,7 @@ const TpopFilter = () => {
const [activeTab, setActiveTab] = useState(0)
useEffect(() => {
if (dataFilter.tpop.length - 1 < activeTab) {
// filter was emtied, need to set correct tab
// filter was emptied, need to set correct tab
setActiveTab(0)
}
}, [activeTab, dataFilter.tpop.length])
Expand Down Expand Up @@ -142,31 +143,7 @@ const TpopFilter = () => {
filteredNr={dataTpops?.allTpopsFiltered?.totalCount ?? '...'}
activeTab={activeTab}
/>
{showFilterComments && (
<>
<FilterCommentTitle>Zusätzlich aktive Filter:</FilterCommentTitle>
<FilterCommentList>
{!!navApFilterComment && (
<FilterComment>{navApFilterComment}</FilterComment>
)}
{!!navHiearchyComment && (
<FilterComment>{navHiearchyComment}</FilterComment>
)}
{!!navLabelComment && (
<FilterComment>{navLabelComment}</FilterComment>
)}
{!!artHierarchyComment && (
<FilterComment>{artHierarchyComment}</FilterComment>
)}
{!!popHierarchyComment && (
<FilterComment>{popHierarchyComment}</FilterComment>
)}
{!!mapFilterComment && (
<FilterComment>{mapFilterComment}</FilterComment>
)}
</FilterCommentList>
</>
)}
<ActiveFilters />
<OrTabs
dataFilter={dataFilter.tpop}
activeTab={activeTab}
Expand Down
24 changes: 16 additions & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,28 @@
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": true,
"checkJs": false,
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",

"allowJs": true,
"checkJs": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"noImplicitAny": false,
"jsx": "react-jsx"
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "Node"
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}

0 comments on commit 8a78b39

Please sign in to comment.