Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Améliore la config ESLint #695

Merged
merged 16 commits into from
Jun 27, 2024
38 changes: 38 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Lint

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
checks: write
contents: write

jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 18

- name: Install dependencies
run: yarn install

- name: Lint front-end
run: yarn lint
working-directory: confiture-web-app/

- name: Lint back-end
run: yarn eslint "src/**/*.ts"
working-directory: confiture-rest-api/
1 change: 1 addition & 0 deletions confiture-rest-api/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/generated
2 changes: 2 additions & 0 deletions confiture-rest-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-simple-import-sort": "^12.1.0",
"eslint-plugin-unused-imports": "^3.1.0",
"prettier": "^3.1.1",
"source-map-support": "^0.5.20",
"ts-loader": "^9.2.3",
Expand Down
13 changes: 8 additions & 5 deletions confiture-web-app/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@
"parser": "@typescript-eslint/parser",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"plugins": ["@typescript-eslint", "unused-imports", "simple-import-sort"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:vue/vue3-recommended",
"plugin:prettier/recommended"
],
"env": {
"jest": true
},
"globals": {
"dsfr": true
},
"rules": {
"vue/multi-word-component-names": "off",
"vue/no-v-html": "off",
"@typescript-eslint/no-explicit-any": "off"
"no-duplicate-imports": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": "error"
}
}
2 changes: 2 additions & 0 deletions confiture-web-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-simple-import-sort": "^12.0.0",
"eslint-plugin-unused-imports": "^3.1.0",
"eslint-plugin-vue": "^9.18.1",
"prettier": "^3.0.3",
"typescript": "^5.2.2",
Expand Down
3 changes: 2 additions & 1 deletion confiture-web-app/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<script setup lang="ts">
import { useHead } from "@unhead/vue";
import { onMounted } from "vue";

import SiteFooter from "./components/layout/SiteFooter.vue";
import SiteHeader from "./components/layout/SiteHeader.vue";
import ToastNotification from "./components/ui/ToastNotification.vue";
import { useAccountStore } from "./store/account";
import SiteHeader from "./components/layout/SiteHeader.vue";

// Default meta tags
useHead({
Expand Down
2 changes: 1 addition & 1 deletion confiture-web-app/src/components/PageMeta.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineComponent } from "vue";
import { useHead } from "@unhead/vue";
import { defineComponent } from "vue";

const PageMeta = defineComponent({
name: "PageMeta",
Expand Down
3 changes: 2 additions & 1 deletion confiture-web-app/src/components/SummaryCard.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { useSlots, computed } from "vue";
import { computed, useSlots } from "vue";

import { useUniqueId } from "../composables/useUniqueId";
import StatDonut, { StatDonutTheme } from "./StatDonut.vue";

Expand Down
18 changes: 9 additions & 9 deletions confiture-web-app/src/components/account/dashboard/AuditRow.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<script lang="ts" setup>
import { ref, computed } from "vue";
import { computed, ref } from "vue";

import { useNotifications } from "../../../composables/useNotifications";
import { useAuditStore } from "../../../store";
import { AuditStatus, AuditType } from "../../../types";
import { AccountAudit } from "../../../types/account";
import {
formatDate,
captureWithPayloads,
slugify,
formatBytes,
getCriteriaCount
formatDate,
getCriteriaCount,
slugify
} from "../../../utils";
import Dropdown from "../../ui/Dropdown.vue";
import CopyIcon from "../../icons/CopyIcon.vue";
import DuplicateModal from "../../audit/DuplicateModal.vue";
import DeleteModal from "../../audit/DeleteModal.vue";
import { useNotifications } from "../../../composables/useNotifications";
import { useAuditStore } from "../../../store";
import DuplicateModal from "../../audit/DuplicateModal.vue";
import CopyIcon from "../../icons/CopyIcon.vue";
import Dropdown from "../../ui/Dropdown.vue";

const props = defineProps<{
audit: AccountAudit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script lang="ts" setup>
import { AuditStatus } from "../../../types";
import { AccountAudit } from "../../../types/account";
import { pluralize } from "../../../utils";
import NoAudit from "./NoAudit.vue";
import AuditRow from "./AuditRow.vue";
import { AccountAudit } from "../../../types/account";
import NoAudit from "./NoAudit.vue";

// FIXME: "audits" type
defineProps<{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { ref, nextTick } from "vue";
import { nextTick, ref } from "vue";

defineProps<{ email: string }>();

Expand Down
4 changes: 2 additions & 2 deletions confiture-web-app/src/components/account/settings/Account.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script lang="ts" setup>
import { HTTPError } from "ky";
import { nextTick, ref } from "vue";
import { useRouter } from "vue-router";

import { useAccountStore } from "../../../store/account";
import { HTTPError } from "ky";
import { useNotifications } from "../../../composables/useNotifications";
import { useAccountStore } from "../../../store/account";
import { captureWithPayloads } from "../../../utils";
import DsfrPassword from "../../ui/DsfrPassword.vue";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script lang="ts" setup>
import { ref, nextTick } from "vue";
import { HTTPError } from "ky";
import { nextTick, ref } from "vue";

import { useAccountStore } from "../../../store/account";
import { useNotifications } from "../../../composables/useNotifications";
import { useAccountStore } from "../../../store/account";
import { captureWithPayloads } from "../../../utils";
import DsfrPassword from "../../ui/DsfrPassword.vue";

Expand Down
4 changes: 2 additions & 2 deletions confiture-web-app/src/components/account/settings/Profile.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts" setup>
import { ref, computed, watch, onMounted } from "vue";
import { computed, onMounted, ref, watch } from "vue";

import { useAccountStore } from "../../../store/account";
import { useNotifications } from "../../../composables/useNotifications";
import { useAccountStore } from "../../../store/account";
import DsfrField from "../../ui/DsfrField.vue";

const accountStore = useAccountStore();
Expand Down
1 change: 1 addition & 0 deletions confiture-web-app/src/components/audit/AraTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<script setup lang="ts" generic="T">
import { ref, watch } from "vue";

import { useUniqueId } from "../../composables/useUniqueId";

const props = defineProps<{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { slugify } from "../../utils";
import { AssistiveTechnology, Browsers, Platform } from "../../enums";
import { slugify } from "../../utils";

const props = defineProps<{
value: string;
Expand Down
28 changes: 14 additions & 14 deletions confiture-web-app/src/components/audit/AuditGenerationCriterium.vue
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<script setup lang="ts">
import { marked } from "marked";
import { computed, ref, Ref } from "vue";
import { debounce } from "lodash-es";
import { FileErrorMessage } from "../../enums";
import {
formatStatus,
handleFileUploadError,
handleFileDeleteError
} from "../../utils";
import { marked } from "marked";
import { computed, Ref, ref } from "vue";

import { useIsOffline } from "../../composables/useIsOffline";
import { useNotifications } from "../../composables/useNotifications";
import { FileErrorMessage } from "../../enums";
import { useAuditStore, useFiltersStore, useResultsStore } from "../../store";
import {
AuditFile,
AuditPage,
AuditType,
CriterionResultUserImpact,
CriteriumResult,
CriteriumResultStatus,
AuditFile
CriteriumResultStatus
} from "../../types";
import {
formatStatus,
handleFileDeleteError,
handleFileUploadError
} from "../../utils";
import RadioGroup, { RadioColor } from "../ui/RadioGroup.vue";
import CriteriumCompliantAccordion from "./CriteriumCompliantAccordion.vue";
import CriteriumNotApplicableAccordion from "./CriteriumNotApplicableAccordion.vue";
import CriteriumNotCompliantAccordion from "./CriteriumNotCompliantAccordion.vue";
import CriteriumTestsAccordion from "./CriteriumTestsAccordion.vue";
import { useResultsStore, useFiltersStore, useAuditStore } from "../../store";
import { useNotifications } from "../../composables/useNotifications";
import RadioGroup, { RadioColor } from "../ui/RadioGroup.vue";
import { useIsOffline } from "../../composables/useIsOffline";

const store = useResultsStore();
const auditStore = useAuditStore();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<script setup lang="ts">
import { computed, watch, nextTick } from "vue";
import { ref } from "vue";
import { computed, nextTick, ref, watch } from "vue";

import { useFiltersStore, useResultsStore } from "../../store";
import { pluralize } from "../../utils";
import { CriteriumResultStatus } from "../../types";
import { pluralize } from "../../utils";

defineProps<{
topics: { title: string; number: number; value: number }[];
Expand Down
10 changes: 5 additions & 5 deletions confiture-web-app/src/components/audit/AuditGenerationHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { computed, onMounted, ref } from "vue";
import { useRoute, useRouter } from "vue-router";

import NotesModal from "../../components/audit/NotesModal.vue";
import { useDevMode } from "../../composables/useDevMode";
import { useIsOffline } from "../../composables/useIsOffline";
import { useNotifications } from "../../composables/useNotifications";
Expand All @@ -17,15 +18,14 @@ import {
formatDate,
slugify
} from "../../utils";
import CopyIcon from "../icons/CopyIcon.vue";
import { StatDonutTheme } from "../StatDonut.vue";
import SummaryCard from "../SummaryCard.vue";
import Dropdown from "../ui/Dropdown.vue";
import AuditProgressBar from "./AuditProgressBar.vue";
import DeleteModal from "./DeleteModal.vue";
import Dropdown from "../ui/Dropdown.vue";
import DuplicateModal from "./DuplicateModal.vue";
import NotesModal from "../../components/audit/NotesModal.vue";
import SaveIndicator from "./SaveIndicator.vue";
import SummaryCard from "../SummaryCard.vue";
import CopyIcon from "../icons/CopyIcon.vue";
import { StatDonutTheme } from "../StatDonut.vue";

defineProps<{
auditName: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<script setup lang="ts">
import { computed } from "vue";

import { useFiltersStore } from "../../store";
import { AuditPage } from "../../types";
import AuditGenerationCriterium from "./AuditGenerationCriterium.vue";

import { useFiltersStore } from "../../store";
import NotApplicableSwitch from "./NotApplicableSwitch.vue";

defineProps<{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { computed } from "vue";

import { useResultsStore } from "../../store";

defineProps<{
Expand Down
2 changes: 1 addition & 1 deletion confiture-web-app/src/components/audit/AuditTypeRadio.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, computed } from "vue";
import { computed, ref } from "vue";

import { AuditType } from "../../types";
import { getCriteriaCount, pluralize } from "../../utils";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import { ref } from "vue";

import { useIsOffline } from "../../composables/useIsOffline";
import { FileErrorMessage } from "../../enums";
import { AuditFile, CriterionResultUserImpact } from "../../types";
import { formatUserImpact } from "../../utils";

import { CriterionResultUserImpact, AuditFile } from "../../types";
import FileUpload from "../ui/FileUpload.vue";
import LazyAccordion from "./LazyAccordion.vue";
import MarkdownHelpButton from "./MarkdownHelpButton.vue";
import { RadioColor } from "../ui/Radio.vue";
import RadioGroup from "../ui/RadioGroup.vue";
import LazyAccordion from "./LazyAccordion.vue";
import MarkdownHelpButton from "./MarkdownHelpButton.vue";

export interface Props {
id: string;
Expand Down
1 change: 1 addition & 0 deletions confiture-web-app/src/components/audit/DeleteModal.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts" setup>
import { ref } from "vue";

import DsfrModal from "../ui/DsfrModal.vue";

const modal = ref<InstanceType<typeof DsfrModal>>();
Expand Down
3 changes: 2 additions & 1 deletion confiture-web-app/src/components/audit/DuplicateModal.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts" setup>
import { ref } from "vue";
import DsfrModal from "../ui/DsfrModal.vue";

import DsfrField from "../ui/DsfrField.vue";
import DsfrModal from "../ui/DsfrModal.vue";

const modal = ref<InstanceType<typeof DsfrModal>>();

Expand Down
1 change: 1 addition & 0 deletions confiture-web-app/src/components/audit/LazyAccordion.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts" setup>
import { ref } from "vue";

import { useUniqueId } from "../../composables/useUniqueId";

defineProps<{
Expand Down
1 change: 1 addition & 0 deletions confiture-web-app/src/components/audit/LeaveModal.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { ref } from "vue";

import DsfrModal from "../ui/DsfrModal.vue";

defineProps<{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<script lang="ts" setup>
import { ref } from "vue";
import DsfrField from "../ui/DsfrField.vue";

import { useDevMode } from "../../composables/useDevMode";
import { useAccountStore } from "../../store";
import DsfrField from "../ui/DsfrField.vue";

const props = defineProps<{
email: string;
Expand Down
Loading
Loading