Skip to content

Commit 60c69bd

Browse files
committed
fix(oxlint): integration of oxlint
components added
1 parent 31cfb88 commit 60c69bd

71 files changed

Lines changed: 463 additions & 464 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.oxlintrc.json

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,51 @@
77
"style": "error",
88
"restriction": "error"
99
},
10-
"plugins": ["import", "node", "oxc", "promise", "unicorn", "vitest"],
10+
"plugins": ["import", "node", "oxc", "promise", "unicorn", "vue"],
1111
"rules": {
1212
"unicorn/filename-case": [
1313
"error",
1414
{
15-
"case": "snakeCase"
15+
"cases": {
16+
"snakeCase": true
17+
}
1618
}
1719
],
18-
"eslint/func-style": [
20+
"eslint/func-style": ["error", "declaration"],
21+
"eslint/sort-keys": "off",
22+
"eslint/no-ternary": "off", // A utiliser pour des opérations simples
23+
"oxc/no-async-await": "off",
24+
"oxc/no-rest-spread-properties": "off", // Enable if older browser support is needed
25+
"eslint/max-statements": ["warn", 20],
26+
"eslint/id-length": ["error", { "exceptions": ["x", "y", "z", "i", "j", "k"], "min": 2 }],
27+
"eslint/no-console": "warn", // Disable for debugging. Disable later to not have browser logs
28+
"unicorn/numeric-separators-style": "off", // 1_000 ou 1000 ?
29+
"sort-imports": ["error", { "allowSeparatedGroups": true }],
30+
"eslint/curly": "off", // Quick statement in one line
31+
"eslint/no-undefined": "off", // Conflict with unicorn/no-typeof-undefined which prefers direct undefined comparison
32+
"unicorn/no-null": "warn", // A débattre ?
33+
"import/prefer-default-export": "off",
34+
"import/no-named-export": "off",
35+
"unicorn/prefer-global-this": "off",
36+
"import/unambiguous": "off",
37+
"oxc/no-optional-chaining": "off",
38+
"node/no-process-env": "off",
39+
"capitalized-comments": "warn",
40+
"unicorn/consistent-existence-index-check": "off", // Opérateur < > remplacés par !== -1 for index check
41+
"unicorn/require-post-message-target-origin": "off", // lorsqu'on envoie un message avec postMessage, on doit spécifier l'origin
42+
"unicorn/prefer-structured-clone": "off", // Pas compatible avec plugin Pinia ?
43+
"eslint/no-magic-numbers": [
1944
"error",
2045
{
21-
"style:": "declaration"
46+
"ignore": [-1, 0, 1, 2, 4],
47+
"ignoreArrayIndexes": true
2248
}
2349
],
24-
"eslint/sort-keys": "off",
25-
"eslint/no-ternary": "off",
26-
"import/no-named-export": "off",
27-
"import/prefer-default-export": "off"
50+
"vue/max-props": ["error", { "maxProps": 7 }]
2851
},
2952
"overrides": [
3053
{
31-
"files": ["**/components/*"],
54+
"files": ["app/components/**"],
3255
"rules": {
3356
"unicorn/filename-case": [
3457
"error",
@@ -37,6 +60,18 @@
3760
}
3861
]
3962
}
63+
},
64+
{
65+
"files": ["*.js", "app/plugins/**"],
66+
"rules": {
67+
"import/no-default-export": "off"
68+
}
69+
},
70+
{
71+
"files": ["utils/**"],
72+
"rules": {
73+
"promise/prefer-await-to-callbacks": "off"
74+
}
4075
}
4176
]
4277
}

app/components/Carousel.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
<script setup>
2+
// oxlint-disable-next-line import/no-unassigned-import
23
import "vue3-carousel/dist/carousel.css"
3-
import { Carousel, Slide, Navigation, Pagination } from "vue3-carousel"
4+
import { Carousel, Navigation, Pagination, Slide } from "vue3-carousel"
45
import { useDisplay } from "vuetify"
56
6-
const props = defineProps({
7+
const NB_ITEMS_TO_DISPLAY = 3
8+
9+
const { items } = defineProps({
710
items: { type: Array, required: true },
811
})
912
1013
const { name } = useDisplay()
11-
const nb_items_to_display = ref(3)
14+
const nb_items_to_display = ref(NB_ITEMS_TO_DISPLAY)
1215
watch(
1316
name,
1417
(value) => {
@@ -46,7 +49,7 @@
4649
<ClientOnly>
4750
<Carousel :settings="carrousel_settings">
4851
<Slide
49-
v-for="(item, index) in props.items"
52+
v-for="(item, index) in items"
5053
:key="index"
5154
class="carousel__slide"
5255
>

app/components/CrsSelector.vue

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
<script setup>
22
import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
3-
const schema = schemas.opengeodeweb_back.geographic_coordinate_systems
43
import { useGeodeStore } from "@ogw_front/stores/geode"
54
5+
const schema = schemas.opengeodeweb_back.geographic_coordinate_systems
6+
67
const emit = defineEmits([
78
"update_values",
89
"increment_step",
910
"decrement_step",
1011
])
1112
12-
const props = defineProps({
13+
const { geode_object_type, key_to_update } = defineProps({
1314
geode_object_type: { type: String, required: true },
1415
key_to_update: { type: String, required: true },
1516
})
1617
17-
const { geode_object_type, key_to_update } = props
18-
1918
const search = ref("")
2019
const data_table_loading = ref(false)
2120
const crs_list = ref([])
@@ -33,8 +32,8 @@
3332
})
3433
3534
function get_selected_crs(crs_code) {
36-
for (let i = 0; i <= crs_list.value.length; i++) {
37-
if (crs_list.value[i]["code"] == crs_code) {
35+
for (let i = 0; i <= crs_list.value.length; i += 1) {
36+
if (crs_list.value[i]["code"] === crs_code) {
3837
return crs_list.value[i]
3938
}
4039
}

app/components/DragAndDrop.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup>
2-
const props = defineProps({
2+
const { multiple, accept, loading, showExtensions, idleText, dropText, loadingText } = defineProps({
33
multiple: { type: Boolean, default: false },
44
accept: { type: String, default: "" },
55
loading: { type: Boolean, default: false },
@@ -14,18 +14,20 @@
1414
const isDragging = ref(false)
1515
const fileInput = ref(null)
1616
17-
const triggerFileDialog = () => fileInput.value?.click()
17+
function triggerFileDialog() {
18+
fileInput.value?.click()
19+
}
1820
19-
function handleDrop(e) {
21+
function handleDrop(event) {
2022
isDragging.value = false
21-
const files = Array.from(e.dataTransfer.files)
23+
const files = [...event.dataTransfer.files]
2224
emit("files-selected", files)
2325
}
2426
25-
function handleFileSelect(e) {
26-
const files = Array.from(e.target.files)
27+
function handleFileSelect(event) {
28+
const files = [...event.target.files]
2729
emit("files-selected", files)
28-
e.target.value = ""
30+
event.target.value = ""
2931
}
3032
</script>
3133

app/components/ExtensionSelector.vue

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@
1111
"decrement_step",
1212
])
1313
14-
const props = defineProps({
14+
const { geode_object_type, filenames } = defineProps({
1515
geode_object_type: { type: String, required: true },
1616
filenames: { type: Array, required: true },
1717
})
18-
const { geode_object_type, filenames } = props
1918
const geode_objects_and_output_extensions = ref({})
2019
const loading = ref(false)
2120
@@ -25,27 +24,20 @@
2524
toggle_loading()
2625
geode_objects_and_output_extensions.value = {}
2726
const geodeStore = useGeodeStore()
28-
const promise_array = filenames.map((filename) => {
29-
return new Promise((resolve, reject) => {
30-
const params = {
27+
const values = await Promise.all(
28+
filenames.map(async (filename) => {
29+
const response = await geodeStore.request(schema, {
3130
geode_object_type,
3231
filename,
33-
}
34-
geodeStore.request(schema, params, {
35-
request_error_function: () => reject(),
36-
response_function: (response) => {
37-
resolve(response.geode_objects_and_output_extensions)
38-
},
39-
response_error_function: () => reject(),
4032
})
41-
})
42-
})
43-
const values = await Promise.all(promise_array)
33+
return response.geode_objects_and_output_extensions
34+
}),
35+
)
4436
const all_keys = [...new Set(values.flatMap((value) => Object.keys(value)))]
4537
const common_keys = all_keys.filter(
4638
(i) => !values.some((j) => !Object.keys(j).includes(i)),
4739
)
48-
var final_object = {}
40+
const final_object = {}
4941
for (const key of common_keys) {
5042
final_object[key] = {}
5143
for (const value of values) {
@@ -61,7 +53,7 @@
6153
}
6254
6355
function update_values(output_geode_object, output_extension) {
64-
if (output_geode_object != "" && output_extension != "") {
56+
if (output_geode_object !== "" && output_extension !== "") {
6557
emit("update_values", {
6658
output_geode_object,
6759
output_extension,

app/components/FeedBack/Snackers.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
<script setup>
22
import { useFeedbackStore } from "@ogw_front/stores/feedback"
33
4+
const MARGIN_BETWEEN_SNACKERS = 60
5+
const FIRST_SNACKER_MARGIN = 8
6+
7+
48
const feedbackStore = useFeedbackStore()
59
const show = ref(true)
610
711
function calc_margin(index) {
8-
return index * 60 + 8 + "px"
12+
return `${index * MARGIN_BETWEEN_SNACKERS + FIRST_SNACKER_MARGIN}px`
913
}
1014
</script>
1115

app/components/FileSelector.vue

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,35 @@
1313
"decrement_step",
1414
])
1515
16-
const props = defineProps({
16+
const { multiple, files, auto_upload } = defineProps({
1717
multiple: { type: Boolean, required: true },
1818
files: { type: Array, default: () => [] },
1919
auto_upload: { type: Boolean, default: true },
2020
})
2121
22-
const internal_files = ref(props.files)
23-
const auto_upload = ref(props.auto_upload)
22+
const internal_files = ref(files)
23+
const internal_auto_upload = ref(auto_upload)
2424
const accept = ref("")
2525
const loading = ref(false)
2626
2727
watch(
28-
() => props.files,
29-
(val) => (internal_files.value = val),
28+
() => files,
29+
(val) => {
30+
internal_files.value = val
31+
},
3032
)
3133
3234
watch(
33-
() => props.auto_upload,
34-
(val) => (auto_upload.value = val),
35+
() => auto_upload,
36+
(val) => {
37+
internal_auto_upload.value = val
38+
},
3539
)
3640
3741
const toggle_loading = useToggle(loading)
3842
3943
function files_uploaded_event(value) {
40-
if (value.length) {
44+
if (value.length > 0) {
4145
emit("update_values", { files: value, auto_upload: false })
4246
emit("increment_step")
4347
}
@@ -47,7 +51,7 @@
4751
toggle_loading()
4852
const geodeStore = useGeodeStore()
4953
const response = await geodeStore.request(schema, {})
50-
accept.value = response.extensions.map((e) => `.${e}`).join(",")
54+
accept.value = response.extensions.map((extension) => `.${extension}`).join(",")
5155
toggle_loading()
5256
}
5357
@@ -58,7 +62,7 @@
5862
<FetchingData v-if="loading" />
5963
<FileUploader
6064
v-else
61-
v-bind="{ multiple, accept, files: internal_files, auto_upload }"
65+
v-bind="{ multiple, accept, files: internal_files, auto_upload: internal_auto_upload }"
6266
@files_uploaded="files_uploaded_event"
6367
/>
6468
</template>

0 commit comments

Comments
 (0)