Fix eslint automatique

pull/2093/head
Jérémy Rialland 2022-04-04 17:04:31 +02:00 committed by Jérémy Rialland
parent 7d824d1c9d
commit 8d9f52b5df
33 changed files with 94 additions and 89 deletions

View File

@ -42,7 +42,7 @@ const formatRulesToAlgolia = (rules: ParsedRules<string>) =>
ruleName,
namespace,
pathDepth: path.length,
acronyme: acronyme,
acronyme,
titre: title,
icone: icônes,
description: description || résumé,

View File

@ -97,6 +97,7 @@ export class Log implements ATTracker {
constructor(options?: Record<string, string | number>) {
console.debug('ATTracker::new', options)
}
setProp(name: string, value: boolean | string, persistent: boolean): void {
console.debug('ATTracker::setProp', { name, value, persistent })
}
@ -106,6 +107,7 @@ export class Log implements ATTracker {
console.debug('ATTracker::events.send', name, data)
},
}
privacy: ATTracker['privacy'] = {
setVisitorMode(...args) {
console.debug('ATTracker::privacy.setVisitorMode', ...args)
@ -119,6 +121,7 @@ export class Log implements ATTracker {
return { name: 'exempt' }
},
}
dispatch(): void {
console.debug('ATTracker::dispatch')
}

View File

@ -6,7 +6,6 @@ import { useSelector } from 'react-redux'
import { targetUnitSelector } from '@/selectors/simulationSelectors'
import BarChartBranch from './BarChart'
import './Distribution.css'
import './PaySlip'
import { getCotisationsBySection } from './PaySlip'
import RuleLink from './RuleLink'

View File

@ -120,7 +120,7 @@ export function WhenNotApplicable({
}
export function WhenAlreadyDefined({
dottedName: dottedName,
dottedName,
children,
}: {
dottedName: DottedName
@ -135,7 +135,7 @@ export function WhenAlreadyDefined({
}
export function WhenNotAlreadyDefined({
dottedName: dottedName,
dottedName,
children,
}: {
dottedName: DottedName

View File

@ -66,7 +66,7 @@ export default function MoreInfosOnUs() {
}}
>
<g>
<path d={icons['github'].icon} />
<path d={icons.github.icon} />
</g>
</svg>
}

View File

@ -28,7 +28,7 @@ export function getNotifications(engine: Engine) {
return Object.values(engine.getParsedRules())
.filter(
(rule) =>
rule.rawNode['type'] === 'notification' &&
rule.rawNode.type === 'notification' &&
!!engine.evaluate(rule.dottedName).nodeValue
)
.map(({ dottedName, rawNode: { sévérité, résumé, description } }) => ({

View File

@ -39,7 +39,7 @@ export const SalaireNetSection = () => {
<Line rule="contrat salarié . rémunération . net imposable" />
<Condition
expression={{
['toutes ces conditions']: [
'toutes ces conditions': [
'contrat salarié . rémunération . avantages en nature', // bool
'contrat salarié . frais professionnels . titres-restaurant', // bool
],

View File

@ -40,7 +40,7 @@ export function SimulationGoal({
appear = true,
alwaysShow = false,
editable = true,
isTypeBoolean = false, //TODO : remove when type inference works in publicodes
isTypeBoolean = false, // TODO : remove when type inference works in publicodes
}: SimulationGoalProps) {
const dispatch = useDispatch()
const engine = useEngine()

View File

@ -121,9 +121,7 @@ export default function Conversation({ customEndMessages }: ConversationProps) {
</Trans>
</H3>
<Body>
{customEndMessages ? (
customEndMessages
) : (
{customEndMessages || (
<Trans i18nKey="simulation-end.text">
Vous avez maintenant accès à l'estimation la plus précise possible.
</Trans>

View File

@ -25,7 +25,7 @@ export function ExplicableRule<Names extends string = DottedName>({
return null
}
//TODO montrer les variables de type 'une possibilité'
// TODO montrer les variables de type 'une possibilité'
return (
<ButtonHelp

View File

@ -237,7 +237,7 @@ export function InstitutionsPartenairesArtisteAuteur() {
target="_blank"
rel="noreferrer"
>
<img src={logosSrc['IRCEC']} title="logo IRCEC" />
<img src={logosSrc.IRCEC} title="logo IRCEC" />
</InstitutionLogo>
<Body>{descriptionIRCEC}</Body>
<Value

View File

@ -155,7 +155,7 @@ const flatMapChildren = (children: React.ReactNode): Array<string | number> => {
? child
: isIterable(child)
? flatMapChildren(Array.from(child))
: typeof child == 'object' && 'props' in child
: typeof child === 'object' && 'props' in child
? // eslint-disable-next-line
(child.props?.value as string) ?? flatMapChildren(child.props?.children)
: ''

View File

@ -48,24 +48,24 @@ export function getNextSteps(
missingVariables
)
const innerKeys = flatten(map(keys, missingVariables)),
missingByTargetsAdvanced = Object.fromEntries(
Object.entries(countBy(identity, innerKeys)).map(
// Give higher score to top level questions
([name, score]) => [
name,
score + Math.max(0, 4 - name.split('.').length),
]
)
const innerKeys = flatten(map(keys, missingVariables))
const missingByTargetsAdvanced = Object.fromEntries(
Object.entries(countBy(identity, innerKeys)).map(
// Give higher score to top level questions
([name, score]) => [name, score + Math.max(0, 4 - name.split('.').length)]
)
)
const missingByCompound = mergeWith(
pair,
missingByTargetsAdvanced,
missingByTotalScore
),
pairs = toPairs<number>(missingByCompound),
sortedPairs = sortWith([descend(byCount), descend(byScore) as any], pairs)
pair,
missingByTargetsAdvanced,
missingByTotalScore
)
const pairs = toPairs<number>(missingByCompound)
const sortedPairs = sortWith(
[descend(byCount), descend(byScore) as any],
pairs
)
return map(head, sortedPairs) as any
}

View File

@ -66,8 +66,6 @@ export default function useSearchParamsSimulationSharing() {
setUrlSituationIsExtracted(true)
}
return
}, [
currentUrl,
simulationUrl,

View File

@ -357,12 +357,8 @@ function useSimpleNumberFieldState(
commit: () => {
rawInputValue && updateInputValue(numberValue)
},
incrementToMax: () => {
return
},
decrementToMin: () => {
return
},
incrementToMax: () => null,
decrementToMin: () => null,
setInputValue: handleInputValueChange,
formatter,
}

View File

@ -1,6 +1,7 @@
export { default as Container } from './Container'
import styled from 'styled-components'
export { default as Container } from './Container'
export const Spacing = styled.div<
| { xxl: true }
| { xl: true }

View File

@ -6,13 +6,15 @@ export function hexToHSL(hex: string): [number, number, number] {
let r = parseInt(result[1], 16)
let g = parseInt(result[2], 16)
let b = parseInt(result[3], 16)
;(r /= 255), (g /= 255), (b /= 255)
const max = Math.max(r, g, b),
min = Math.min(r, g, b)
let h = 0,
s = 0
r /= 255
g /= 255
b /= 255
const max = Math.max(r, g, b)
const min = Math.min(r, g, b)
let h = 0
let s = 0
const l = (max + min) / 2
if (max != min) {
if (max !== min) {
const d = max - min
s = l > 0.5 ? d / (2 - max - min) : d / (max + min)
switch (max) {

View File

@ -77,7 +77,7 @@ export default function CreateCompany({ statut }: CreateCompanyProps) {
'entreprise.page.description',
"La liste complète des démarches à faire pour créer une {{statut}} auprès de l'administration française.",
],
{ statut: statut }
{ statut }
)
}
/>

View File

@ -181,12 +181,8 @@ export default function Gérer() {
<WhenApplicable dottedName="entreprise . imposition . IS">
<Grid item xs={12} md={6} lg={4} alignSelf="flex-end">
<Grid container spacing={3} columns={2}>
<SimulateurCard fromGérer {...simulateurs['is']} small />
<SimulateurCard
fromGérer
{...simulateurs['dividendes']}
small
/>
<SimulateurCard fromGérer {...simulateurs.is} small />
<SimulateurCard fromGérer {...simulateurs.dividendes} small />
</Grid>
</Grid>
</WhenApplicable>

View File

@ -2,9 +2,11 @@ import { DistributionBranch } from '@/components/Distribution'
import { Condition } from '@/components/EngineValue'
import PeriodSwitch from '@/components/PeriodSwitch'
import SimulateurWarning from '@/components/SimulateurWarning'
import Simulation from '@/components/Simulation'
import Simulation, {
SimulationGoal,
SimulationGoals,
} from '@/components/Simulation'
import { InstitutionsPartenairesArtisteAuteur } from '@/components/simulationExplanation/InstitutionsPartenaires'
import { SimulationGoal, SimulationGoals } from '@/components/Simulation'
import { EngineContext } from '@/components/utils/EngineContext'
import useSimulationConfig from '@/components/utils/useSimulationConfig'
import { H2 } from '@/design-system/typography/heading'

View File

@ -2,9 +2,11 @@ import ChiffreAffairesActivitéMixte from '@/components/ChiffreAffairesActivité
import { WhenAlreadyDefined } from '@/components/EngineValue'
import PeriodSwitch from '@/components/PeriodSwitch'
import SimulateurWarning from '@/components/SimulateurWarning'
import Simulation from '@/components/Simulation'
import Simulation, {
SimulationGoal,
SimulationGoals,
} from '@/components/Simulation'
import { InstitutionsPartenairesAutoEntrepreneur } from '@/components/simulationExplanation/InstitutionsPartenaires'
import { SimulationGoal, SimulationGoals } from '@/components/Simulation'
import StackedBarChart from '@/components/StackedBarChart'
import { H2 } from '@/design-system/typography/heading'
import { useContext } from 'react'

View File

@ -1,6 +1,8 @@
import RuleLink from '@/components/RuleLink'
import Simulation from '@/components/Simulation'
import { SimulationGoal, SimulationGoals } from '@/components/Simulation'
import Simulation, {
SimulationGoal,
SimulationGoals,
} from '@/components/Simulation'
import { FromTop } from '@/components/ui/animate'
import Warning from '@/components/ui/WarningBlock'
import { useIsEmbedded } from '@/components/utils/embeddedContext'

View File

@ -2,8 +2,10 @@ import { updateSituation } from '@/actions/actions'
import { HiddenOptionContext } from '@/components/conversation/ChoicesInput'
import { Condition } from '@/components/EngineValue'
import Notifications from '@/components/Notifications'
import Simulation from '@/components/Simulation'
import { SimulationGoal, SimulationGoals } from '@/components/Simulation'
import Simulation, {
SimulationGoal,
SimulationGoals,
} from '@/components/Simulation'
import StackedBarChart from '@/components/StackedBarChart'
import Warning from '@/components/ui/WarningBlock'
import { useEngine } from '@/components/utils/EngineContext'

View File

@ -184,7 +184,7 @@ export const Row = ({
.filter(<T,>(x: T | null): x is T => Boolean(x))
if (items.length > 0) {
items.unshift({ key: 'non', text: choices['non'][0] })
items.unshift({ key: 'non', text: choices.non[0] })
}
return (

View File

@ -86,8 +86,8 @@ export default function Simulateurs() {
<SimulateurCard small {...simulators['chirurgien-dentiste']} />
<SimulateurCard small {...simulators.médecin} />
<SimulateurCard small {...simulators['sage-femme']} />
<SimulateurCard small {...simulators['pharmacien']} />
<SimulateurCard small {...simulators['avocat']} />
<SimulateurCard small {...simulators.pharmacien} />
<SimulateurCard small {...simulators.avocat} />
<SimulateurCard small {...simulators['expert-comptable']} />
</Grid>
</>
@ -108,8 +108,8 @@ export default function Simulateurs() {
<Trans>Autres outils</Trans>
</H2>
<Grid container spacing={3}>
<SimulateurCard {...simulators['is']} />
<SimulateurCard {...simulators['dividendes']} />
<SimulateurCard {...simulators.is} />
<SimulateurCard {...simulators.dividendes} />
<SimulateurCard {...simulators['économie-collaborative']} />
<SimulateurCard {...simulators['demande-mobilité']} />
</Grid>

View File

@ -3,9 +3,11 @@ import ChiffreAffairesActivitéMixte from '@/components/ChiffreAffairesActivité
import { Condition } from '@/components/EngineValue'
import PeriodSwitch from '@/components/PeriodSwitch'
import SimulateurWarning from '@/components/SimulateurWarning'
import Simulation from '@/components/Simulation'
import Simulation, {
SimulationGoal,
SimulationGoals,
} from '@/components/Simulation'
import IndépendantExplanation from '@/components/simulationExplanation/IndépendantExplanation'
import { SimulationGoal, SimulationGoals } from '@/components/Simulation'
import { useEngine } from '@/components/utils/EngineContext'
import { Radio, ToggleGroup } from '@/design-system/field'
import { DottedName } from 'modele-social'

View File

@ -1,8 +1,10 @@
import PeriodSwitch from '@/components/PeriodSwitch'
import SimulateurWarning from '@/components/SimulateurWarning'
import Simulation from '@/components/Simulation'
import Simulation, {
SimulationGoal,
SimulationGoals,
} from '@/components/Simulation'
import SalaryExplanation from '@/components/simulationExplanation/SalaryExplanation'
import { SimulationGoal, SimulationGoals } from '@/components/Simulation'
export function SASUSimulation() {
return (

View File

@ -5,9 +5,11 @@ import Value, {
} from '@/components/EngineValue'
import PeriodSwitch from '@/components/PeriodSwitch'
import RuleLink from '@/components/RuleLink'
import Simulation from '@/components/Simulation'
import Simulation, {
SimulationGoal,
SimulationGoals,
} from '@/components/Simulation'
import SalaryExplanation from '@/components/simulationExplanation/SalaryExplanation'
import { SimulationGoal, SimulationGoals } from '@/components/Simulation'
import { FromTop } from '@/components/ui/animate'
import Emoji from '@/components/utils/Emoji'
import { useEngine } from '@/components/utils/EngineContext'

View File

@ -244,10 +244,10 @@ function getSimulatorsData({
),
},
eirl: {
...pureSimulatorsData['eirl'],
...pureSimulatorsData.eirl,
config: indépendantConfig as SimulationConfig,
meta: {
...pureSimulatorsData['eirl']?.meta,
...pureSimulatorsData.eirl?.meta,
ogImage: AutoEntrepreneurPreview,
},
component: IndépendantSimulation,
@ -255,10 +255,10 @@ function getSimulatorsData({
nextSteps: ['comparaison-statuts'],
},
sasu: {
...pureSimulatorsData['sasu'],
...pureSimulatorsData.sasu,
config: sasuConfig as SimulationConfig,
meta: {
...pureSimulatorsData['sasu']?.meta,
...pureSimulatorsData.sasu?.meta,
ogImage: RémunérationSASUPreview,
},
path: sitePaths.simulateurs.sasu,
@ -306,10 +306,10 @@ function getSimulatorsData({
),
},
eurl: {
...pureSimulatorsData['eurl'],
...pureSimulatorsData.eurl,
config: eurlConfig as SimulationConfig,
meta: {
...pureSimulatorsData['eurl']?.meta,
...pureSimulatorsData.eurl?.meta,
ogImage: RémunérationSASUPreview,
},
path: sitePaths.simulateurs.eurl,
@ -510,7 +510,7 @@ function getSimulatorsData({
path: sitePaths.gérer.formulaireMobilité,
},
pharmacien: {
...pureSimulatorsData['pharmacien'],
...pureSimulatorsData.pharmacien,
config: pharmacienConfig,
path: sitePaths.simulateurs['profession-libérale'].pharmacien,
component: IndépendantPLSimulation,
@ -540,7 +540,7 @@ function getSimulatorsData({
component: IndépendantPLSimulation,
},
avocat: {
...pureSimulatorsData['avocat'],
...pureSimulatorsData.avocat,
config: avocatConfig,
path: sitePaths.simulateurs['profession-libérale'].avocat,
component: IndépendantPLSimulation,
@ -558,7 +558,7 @@ function getSimulatorsData({
component: IndépendantPLSimulation,
},
pamc: {
...pureSimulatorsData['pamc'],
...pureSimulatorsData.pamc,
path: sitePaths.simulateurs.pamc,
config: professionLibéraleConfig as SimulationConfig,
component: PAMCHome,
@ -595,7 +595,7 @@ function getSimulatorsData({
component: AidesEmbauche,
},
is: {
...pureSimulatorsData['is'],
...pureSimulatorsData.is,
path: sitePaths.simulateurs.is,
component: ISSimulation,
seoExplanations: (
@ -633,7 +633,7 @@ function getSimulatorsData({
),
},
dividendes: {
...pureSimulatorsData['dividendes'],
...pureSimulatorsData.dividendes,
path: sitePaths.simulateurs.dividendes,
component: DividendesSimulation,
config: dividendesConfig as SimulationConfig,

View File

@ -111,16 +111,16 @@ const CustomTooltip = ({ payload, active }: CustomTooltipProps) => {
<Ul size="XS">
<Li>
<Strong>
{Math.round((data['très bien'] ?? 0) + (data['bien'] ?? 0))}%
{Math.round((data['très bien'] ?? 0) + (data.bien ?? 0))}%
</Strong>{' '}
satisfaits{' '}
<small>
({Math.round(data['très bien'] ?? 0)}% <Emoji emoji="😀" /> /{' '}
{Math.round(data['bien'] ?? 0)}% <Emoji emoji="🙂" />)
{Math.round(data.bien ?? 0)}% <Emoji emoji="🙂" />)
</small>
</Li>
<Li>
<Strong>{Math.round(data['mauvais'] ?? 0)}%</Strong> négatifs
<Strong>{Math.round(data.mauvais ?? 0)}%</Strong> négatifs
<Emoji emoji="🙁" />
</Li>
</Ul>

View File

@ -90,7 +90,7 @@ export default function Options() {
}}
>
<g style={{ fill: '#030303' }}>
<path d={icons['github'].icon} />
<path d={icons.github.icon} />
</g>
</svg>
}

View File

@ -59,7 +59,7 @@ const runSimulations = (
const evaluatedNotifications = Object.values(engine.getParsedRules())
.filter(
(rule) =>
rule.rawNode['type'] === 'notification' &&
rule.rawNode.type === 'notification' &&
engine.evaluate(rule.dottedName).nodeValue === true
)
.map((node) => node.dottedName)

View File

@ -38,7 +38,7 @@ export default defineConfig(({ command }) => ({
return
}
const relativePath = filePath.replace(__dirname + '/', '')
const relativePath = filePath.replace(path.join(__dirname, '/'), '')
console.log('Transform:', relativePath)
const source = JSON.stringify(data)
@ -59,8 +59,6 @@ export default defineConfig(({ command }) => ({
.emit()
.then(() => console.log(' Done! :', relativePath + '.d.ts'))
.catch((err) => console.error(err))
return
},
}),
toml,