Skip to content

Commit

Permalink
feat: replace co by eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
MaGOs92 committed Nov 24, 2023
1 parent 0fe3a18 commit 6ba3ec6
Show file tree
Hide file tree
Showing 14 changed files with 923 additions and 1,539 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": ["next", "xo", "xo-nextjs"]
"extends": ["next", "prettier"]
}
1 change: 0 additions & 1 deletion components/dashboard/charts/creation-count.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable unicorn/no-array-reduce */
import {Chart} from 'react-chartjs-2'
import PropTypes from 'prop-types'
import {Chart as ChartJS, registerables} from 'chart.js'
Expand Down
1 change: 0 additions & 1 deletion components/dashboard/charts/publication-count.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable unicorn/no-array-reduce */
import {Chart} from 'react-chartjs-2'
import PropTypes from 'prop-types'
import {Chart as ChartJS, registerables} from 'chart.js'
Expand Down
1 change: 0 additions & 1 deletion components/dashboard/charts/publications-per-department.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ ChartJS.register(...registerables)
const PublicationPerDepartmentChart = ({publicationsResponse}) => {
const data = useMemo(() => {
const sortedDepartments = departements.map(({nom, code}) => {
// eslint-disable-next-line unicorn/no-array-reduce
const count = publicationsResponse.reduce((acc, {publishedBAL}) => {
const selectedCommunes = Object.keys(publishedBAL).filter(
codeCommune => codeCommune.slice(0, code.length) === code
Expand Down
3 changes: 1 addition & 2 deletions components/editable-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ type EditableListProps<T> = {
actions?: Record<string, (item: T) => void>;
}

// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
export const EditableList = <T extends unknown>({
createBtn,
headers,
Expand All @@ -45,7 +44,7 @@ export const EditableList = <T extends unknown>({
useEffect(() => {
if (pageinationRef.current) {
const paginationLinks = pageinationRef.current.querySelectorAll('.fr-pagination__link')
paginationLinks.forEach((link: HTMLAnchorElement, index) => {
paginationLinks.forEach((link: Element, index) => {
if (index - 1 === page?.current) {
link.setAttribute('aria-current', 'page')
} else {
Expand Down
5 changes: 2 additions & 3 deletions components/modal-alerte.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {useEffect} from 'react'
import React, {useEffect} from 'react'
import {createModal} from '@codegouvfr/react-dsfr/Modal'
import {useIsModalOpen} from '@codegouvfr/react-dsfr/Modal/useIsModalOpen'

Expand All @@ -9,12 +9,11 @@ const modal = createModal({

type ModalAlertProps<T> = {
item: T;
setItem: (item: T) => void;
setItem: (item: T | null) => void;
onAction: () => Promise<void>;
title: string;
}

// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
export const ModalAlert = <T extends unknown>({item, setItem, onAction, title}: ModalAlertProps<T>) => {
const isOpen = useIsModalOpen(modal)

Expand Down
1 change: 0 additions & 1 deletion components/multi-select-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const StyledAutocomplete = styled(Autocomplete)`
}
`

// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
export const MultiSelectInput = <T extends unknown>({label, placeholder, options, onChange, value, hint, isDisabled}: MultiSelectInputProps<T>) => {
const [searchValue, setSearchValue] = useState('')

Expand Down
1 change: 0 additions & 1 deletion components/partenaires-de-la-charte/partenaire-form.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import React, {useState} from 'react'
import styled from 'styled-components'
import type {PartenaireDeLaCharteCommuneType, PartenaireDeLaCharteEntrepriseType, PartenaireDeLaCharteOrganismeType} from 'types/partenaire-de-la-charte'
Expand Down
1 change: 0 additions & 1 deletion lib/api-mes-adresses.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { BaseLocaleType } from "../types/mes-adresses";
import type { PageType } from "../types/page";

Expand Down
1 change: 0 additions & 1 deletion lib/partenaires-de-la-charte.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type {PartenaireDeLaChartType} from 'types/partenaire-de-la-charte'

// eslint-disable-next-line @typescript-eslint/naming-convention
const NEXT_PUBLIC_BAL_ADMIN_URL = process.env.NEXT_PUBLIC_BAL_ADMIN_URL || 'http://localhost:3000'

async function processResponse(response) {
Expand Down
44 changes: 6 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dev": "node server",
"build": "next build",
"start": "NODE_ENV=production node server",
"lint": "xo",
"lint": "eslint --ext .js,.ts,.tsx .",
"predev": "only-include-used-icons",
"prebuild": "only-include-used-icons"
},
Expand Down Expand Up @@ -40,44 +40,12 @@
"devDependencies": {
"@types/react": "^18.2.14",
"dotenv": "^16.0.3",
"eslint-config-xo": "^0.42.0",
"eslint-config-xo-nextjs": "^4.2.1",
"eslint": "^8.54.0",
"eslint-config-next": "^14.0.3",
"eslint-config-prettier": "^9.0.0",
"next-transpile-modules": "^9.0.0",
"xo": "^0.52.3"
},
"xo": {
"extends": "xo-nextjs",
"semicolon": false,
"space": 2,
"envs": [
"browser",
"es2021"
],
"rules": {
"camelcase": "warn",
"unicorn/catch-error-name": "off",
"react/jsx-sort-props": "off",
"import/no-anonymous-default-export": "off",
"unicorn/prevent-abbreviations": "off",
"comma-dangle": "off",
"import/extensions": "off",
"node/prefer-global/process": "off",
"unicorn/no-array-for-each": "off",
"unicorn/prefer-switch": "off",
"n/prefer-global/process": "off",
"react/no-unknown-property": [
"error",
{
"ignore": [
"jsx"
]
}
],
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/triple-slash-reference": "off"
}
"prettier": "^3.1.0",
"typescript": "5.2.2"
},
"engines": {
"node": ">= 18"
Expand Down
1 change: 0 additions & 1 deletion pages/mes-adresses/base-locale/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {formatDate} from '@/lib/util/date'

import CopyToClipBoard from '@/components/copy-to-clipboard'

// eslint-disable-next-line @typescript-eslint/naming-convention
const NEXT_PUBLIC_MES_ADRESSES_URL = process.env.NEXT_PUBLIC_MES_ADRESSES_URL || 'http://mes-adresses.data.gouv.fr'

const BaseLocale = () => {
Expand Down
2 changes: 0 additions & 2 deletions server/migrations/populate-partners.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ async function main() {

main().catch(error => {
console.error(error)
// eslint-disable-next-line unicorn/no-process-exit
process.exit(1)
}).then(() => {
// eslint-disable-next-line unicorn/no-process-exit
process.exit(0)
})
Loading

0 comments on commit 6ba3ec6

Please sign in to comment.