Fix manuel eslint

pull/2093/head
Jérémy Rialland 2022-04-04 17:06:21 +02:00 committed by Jérémy Rialland
parent 8d9f52b5df
commit 44a0033593
14 changed files with 27 additions and 23 deletions

View File

@ -64,7 +64,9 @@ module.exports = {
],
plugins: ['@typescript-eslint', 'react', 'react-hooks'],
rules: {
'no-void': 'off',
'ban-ts-comment': 'off',
'no-use-before-define': 'off',
'react/no-unescaped-entities': 'off',
'react/jsx-no-target-blank': 'off',
'@typescript-eslint/ban-ts-comment': 'off',

View File

@ -53,16 +53,16 @@ async function searchFullText(
if (!response.ok) {
return null
}
const json: SireneData = await response.json()
const json = (await response.json()) as SireneData
const etablissements = json.etablissement
.filter(
({ is_siege, categorie_entreprise, activite_principale }) =>
categorie_entreprise !== 'ETI' &&
is_siege === '1' &&
activite_principale !== '8411Z'
(data) =>
data.categorie_entreprise !== 'ETI' &&
data.is_siege === '1' &&
data.activite_principale !== '8411Z'
)
.map(({ l1_normalisee, siren }) => ({
denomination: l1_normalisee,
.map(({ l1_normalisee: denomination, siren }) => ({
denomination,
siren,
}))

View File

@ -71,7 +71,7 @@ export default function Notifications() {
{messages.map(({ sévérité, dottedName, résumé, description }) => (
<Message
icon
type={sévérité == 'avertissement' ? 'info' : 'primary'}
type={sévérité === 'avertissement' ? 'info' : 'primary'}
key={dottedName}
>
<Markdown>{résumé ?? description ?? ''}</Markdown>{' '}

View File

@ -50,8 +50,7 @@ export default function SchemeComparaison({
const situation = useSelector(situationSelector)
const displayResult =
useSelector(situationSelector)['dirigeant . rémunération . totale'] !=
undefined
useSelector(situationSelector)['dirigeant . rémunération . totale'] != null
const assimiléEngine = useMemo(
() =>
engine.shallowCopy().setSituation({

View File

@ -22,7 +22,7 @@ export default function SimulateurWarning({
localStorageKey={'app::simulateurs:warning-folded:v1:' + simulateur}
>
<Ul>
{simulateur == 'auto-entrepreneur' && (
{simulateur === 'auto-entrepreneur' && (
<>
<Li>
<Trans i18nKey="simulateurs.warning.auto-entrepreneur">
@ -59,7 +59,7 @@ export default function SimulateurWarning({
</Li>
)}
{simulateur == 'profession-libérale' && (
{simulateur === 'profession-libérale' && (
<Trans i18nKey="simulateurs.warning.profession-libérale">
<Li>
Ce simulateur est à destination des professions libérales en BNC.

View File

@ -124,7 +124,7 @@ export default function RuleInput<Names extends string = DottedName>({
throw new Error("Les seules API implémentées sont 'commune'")
}
if (rule.dottedName == 'contrat salarié . ATMP . taux collectif ATMP') {
if (rule.dottedName === 'contrat salarié . ATMP . taux collectif ATMP') {
return <SelectAtmp {...commonProps} />
}

View File

@ -30,7 +30,7 @@ export default function NewsBanner() {
useEffect(() => {
setItem(
localStorageKey,
lastViewedRelease == undefined ? lastRelease.name : lastViewedRelease
lastViewedRelease == null ? lastRelease.name : lastViewedRelease
)
}, [])

View File

@ -264,6 +264,8 @@ function componentCSS(Compo: unknown, props: Record<never, never>): string {
}
// eslint-disable-next-line no-console
console.error('Should not happen', result, typeof result)
return false
})
.join('')
}

View File

@ -40,7 +40,9 @@ export const ActiviteCard = ({
// debounce to avoid double onClick call when clicking on checkbox
() =>
debounce(1, () => {
selected === undefined ? null : dispatch?.(toggleActivité(title))
if (selected !== undefined) {
dispatch?.(toggleActivité(title))
}
})(),
[dispatch, selected]
)

View File

@ -1,7 +1,6 @@
import {
import originalReduceReducers, {
Action as OriginalAction,
Reducer as OriginalReducer,
default as originalReduceReducers,
} from 'reduce-reducers'
type Reducer<S, A extends OriginalAction> = (state: S, action: A) => S

View File

@ -51,7 +51,7 @@ export default function PageData(props: PageDataProps) {
const année = useContext(EngineContext).evaluate('année')
.nodeValue as Evaluation<number>
const year = typeof année === 'number' && année != 2022 ? ` - ${année}` : ''
const year = typeof année === 'number' && année !== 2022 ? ` - ${année}` : ''
const inIframe = useIsEmbedded()
useSimulationConfig(config)

View File

@ -15,5 +15,5 @@ export default (netlifyToml as { redirects: NetlifyRedirect[] }).redirects
from: decodeURIComponent(from.replace(/^:.*?\//, '/')),
to: decodeURIComponent(to.replace(/^:.*?\//, '/').replace(':splat', '*')),
}))
.filter(({ from, to }) => from != to)
.filter(({ from, to }) => from !== to)
.map((props) => <Redirect key={props.from} {...props} exact />)

View File

@ -47,7 +47,7 @@ export function companySituation(state: Situation = {}, action: Action) {
'établissement . localisation': { objet: action.details },
}
case 'SET_SIMULATION':
state['entreprise . SIREN'] ? state : {}
return state['entreprise . SIREN'] ? state : {}
}
return state

View File

@ -137,8 +137,8 @@ export const wrapperDebounceEvents = <T>(
if (typeof original === 'function') {
const debouncedFunction = async (...params: unknown[]) => {
await new Promise((res) =>
setTimeout(() => res(original(...params)), ms)
await new Promise((resolve) =>
setTimeout(() => resolve(original(...params)), ms)
)
}
@ -202,7 +202,7 @@ export async function getIframeOffset(): Promise<number> {
resolve(evt.data.value)
}
if (!window.parent.postMessage) {
reject('No parent window')
reject(new Error('No parent window'))
}
window.parent?.postMessage({ kind: 'get-offset' }, '*')
window.addEventListener('message', returnOffset)