Skip to content

Commit

Permalink
update ts; remove suppressImplicitAnyIndexErrors (#68)
Browse files Browse the repository at this point in the history
* update ts; remove suppressImplicitAnyIndexErrors

* update eslint

* one more linting update

* update node
  • Loading branch information
ChristopherChudzicki authored Feb 16, 2024
1 parent ca46b7f commit 4d45f3c
Show file tree
Hide file tree
Showing 5 changed files with 240 additions and 304 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: Set up NodeJS
uses: actions/setup-node@v2-beta
with:
node-version: 15.3.0
node-version: 20.11.1

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@
"@types/ramda": "^0.27.27",
"@types/react": "^16.9.49",
"@types/react-dom": "^16.9.8",
"@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/parser": "^5.37.0",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"babel-eslint": "10.x",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.4",
"eslint": "^7.32.0",
"eslint": "^8.56.0",
"eslint-config-google": "0.x",
"eslint-config-mitodl": "^1.0.0",
"eslint-plugin-babel": "5.x",
Expand All @@ -71,7 +71,7 @@
"react": "^16.13.1",
"react-dom": "^16.13.1",
"ts-node": "^10.9.1",
"typescript": "^4.8.3"
"typescript": "^5.3.3"
},
"peerDependencies": {
"@types/history": "^4.9",
Expand Down
12 changes: 7 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const useFacetOptions = (
): ((group: string) => Aggregation | null) => {
return useCallback(
(group: string) => {
const emptyActiveFacets = (activeFacets[group] || []).map(
const emptyActiveFacets = (activeFacets[group as keyof Facets] || []).map(
(facet: string) => ({
key: facet,
doc_count: 0
Expand Down Expand Up @@ -197,11 +197,12 @@ export const useSearchInputs = (history: HHistory): UseSearchInputsResult => {
setSearchParams(current => {
const { activeFacets, sort, ui } = current
const newFacets = clone(activeFacets)
const facetName = name as keyof Facets

if (isEnabled) {
newFacets[name] = _.union(newFacets[name] || [], [value])
newFacets[facetName] = _.union(newFacets[facetName] || [], [value])
} else {
newFacets[name] = _.without(newFacets[name] || [], value)
newFacets[facetName] = _.without(newFacets[facetName] || [], value)
}
return {
...current,
Expand All @@ -222,10 +223,11 @@ export const useSearchInputs = (history: HHistory): UseSearchInputsResult => {
const newFacets = clone(activeFacets)

facets.forEach(([name, value, isEnabled]) => {
const facetName = name as keyof Facets
if (isEnabled) {
newFacets[name] = _.union(newFacets[name] || [], [value])
newFacets[facetName] = _.union(newFacets[facetName] || [], [value])
} else {
newFacets[name] = _.without(newFacets[name] || [], value)
newFacets[facetName] = _.without(newFacets[facetName] || [], value)
}
})
return {
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"outDir": "./dist/",
"tsBuildInfoFile": ".tsbuildinfo",
"strict": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
Expand Down
Loading

0 comments on commit 4d45f3c

Please sign in to comment.