Skip to content

Commit

Permalink
fix(linting): resolve linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hueyy committed Jan 23, 2022
1 parent 2076a2f commit dc4dc05
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 30 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ module.exports = {
`warn`,
`never`,
],
"sonarjs/no-nested-template-literals": `warn`,
"sort-keys-fix/sort-keys-fix": `warn`,
"unicorn/consistent-function-scoping": `off`,
"unicorn/filename-case": [
Expand All @@ -79,9 +80,10 @@ module.exports = {
],
},
],
"unicorn/no-array-reduce": `off`,
"unicorn/no-array-reduce": `warn`,
"unicorn/no-await-expression-member": `off`,
"unicorn/no-null": 0,
"unicorn/prefer-code-point": `warn`,
"unicorn/prefer-module": `off`,
"unicorn/prefer-node-protocol": `off`,
"unicorn/prevent-abbreviations": [
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "clerkent",
"version": "2.8.4",
"version": "2.8.5",
"private": true,
"description": "quick search for international caselaw and legislation",
"repository": "https://github.com/lacuna-technologies/clerkent.git",
Expand Down Expand Up @@ -33,7 +33,7 @@
},
"lint-staged": {
"*.{ts,tsx,d.ts}": [
"tsc-files --noEmit"
"tsc-files --noEmit src/types/Filetypes.d.ts"
],
"*.{ts,tsx,js,jsx,json}": [
"eslint --cache --fix"
Expand Down
2 changes: 1 addition & 1 deletion scripts/getVersion.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs'

const packageJson = JSON.parse(fs.readFileSync(`package.json`, `utf-8`))
const packageJson = JSON.parse(fs.readFileSync(`package.json`).toString())

console.log(packageJson.version)
1 change: 1 addition & 0 deletions src/Popup/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ const Popup: React.FC = () => {
port.current.onMessage.addListener(onMessage)
}, [onMessage, sendMessage])

// eslint-disable-next-line sonarjs/cognitive-complexity
useEffect(() => {
(async () => {
let shouldDoSearch = false
Expand Down
9 changes: 3 additions & 6 deletions src/utils/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,11 @@ const INSTITUTIONAL_LOGINS = {
}

const dedupeObjects = (inputObject: Record<string, Record<string, string>>, jurisdictionCode: Law.JursidictionCode) =>
Object.entries(inputObject)
.reduce((accumulator, [id, object]: [string, Record<string, string>]) => ({
...accumulator,
[`${jurisdictionCode}_${id}`]: {
Object.fromEntries(Object.entries(inputObject)
.map(( [id, object]: [string, Record<string, string>]) => [`${jurisdictionCode}_${id}`, {
id: `${jurisdictionCode}_${id}`,
...object,
},
}), {})
}]))

const DATABASES: Record<string, Law.Database> = {
...dedupeObjects(SG_DATABASES, `SG`),
Expand Down
2 changes: 1 addition & 1 deletion src/utils/Helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const debounce = (function_: (...arguments_: any[]) => unknown, timeout = 500) =
}
}

const classnames = (...arguments_: string[]) => [...new Set([...arguments_])].filter(item => item && item.length > 0).join(` `)
const classnames = (...arguments_: string[]) => [...new Set(arguments_)].filter(item => item && item.length > 0).join(` `)

const escapeRegExp = (string: string) => string.replace(/[$()*+.?[\\\]^{|}]/g, `\\$&`)

Expand Down
5 changes: 3 additions & 2 deletions src/utils/scraper/ECHR/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import ECHR from './ECHR'
export default ECHR


export {default} from './ECHR'
5 changes: 3 additions & 2 deletions src/utils/scraper/EU/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import EU from './EU'
export default EU


export {default} from './EU'
5 changes: 3 additions & 2 deletions src/utils/scraper/HK/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import HK from './HK'
export default HK


export {default} from './HK'
5 changes: 3 additions & 2 deletions src/utils/scraper/SG/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import SG from './SG'
export default SG


export {default} from './SG'
5 changes: 3 additions & 2 deletions src/utils/scraper/UK/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import UK from './UK'
export default UK


export {default} from './UK'
5 changes: 3 additions & 2 deletions src/utils/scraper/UN/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import UN from './UN'
export default UN


export {default} from './UN'
6 changes: 2 additions & 4 deletions src/utils/scraper/custom/Custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ const getCaseByName = async (caseName: string): Promise<Law.Case[]> => {
.map(rawCase => toLawCase(rawCase))
}

const getCaseByCitation = async (citation: string, court: string): Promise<Law.Case[]> => Promise.resolve(
CustomCases
const getCaseByCitation = async (citation: string, court: string): Promise<Law.Case[]> => CustomCases
.filter(({ citations }) =>
citations.some((cit) => (new RegExp(`${citation}`, `i`)).test(cit)),
)
.map(({ citations, ...others }) => ({
...others,
citation: citations[0],
})),
)
}))

const Custom = {
getCaseByCitation,
Expand Down
5 changes: 3 additions & 2 deletions src/utils/scraper/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import Scraper from './Scraper'
export default Scraper


export {default} from './Scraper'
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@
"jest.config.ts.ts",
"src/types/Filetypes.d.ts"
],
"exclude": ["**/node_modules", "**/.*/"]
"exclude": [
"**/node_modules",
"**/.*/"
]
}

0 comments on commit dc4dc05

Please sign in to comment.