diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9c0f9d89..53c29c37 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -81,6 +81,9 @@ importers: '@prettier/plugin-xml': specifier: ^3.4.2 version: 3.4.2(prettier@3.8.3) + '@stylistic/eslint-plugin': + specifier: ^5.10.0 + version: 5.10.0(eslint@9.39.4(jiti@2.6.1)) '@tailwindcss/vite': specifier: ^4.2.4 version: 4.2.4(vite@6.4.2(@types/node@20.19.39)(jiti@2.6.1)(lightningcss@1.32.0)) @@ -845,79 +848,66 @@ packages: resolution: {integrity: sha512-2QxQrM+KQ7DAW4o22j+XZ6RKdxjLD7BOWTP0Bv0tmjdyhXSsr2Ul1oJDQqh9Zf5qOwTuTc7Ek83mOFaKnodPjg==} cpu: [arm] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.60.2': resolution: {integrity: sha512-TbziEu2DVsTEOPif2mKWkMeDMLoYjx95oESa9fkQQK7r/Orta0gnkcDpzwufEcAO2BLBsD7mZkXGFqEdMRRwfw==} cpu: [arm] os: [linux] - libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.60.2': resolution: {integrity: sha512-bO/rVDiDUuM2YfuCUwZ1t1cP+/yqjqz+Xf2VtkdppefuOFS2OSeAfgafaHNkFn0t02hEyXngZkxtGqXcXwO8Rg==} cpu: [arm64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.60.2': resolution: {integrity: sha512-hr26p7e93Rl0Za+JwW7EAnwAvKkehh12BU1Llm9Ykiibg4uIr2rbpxG9WCf56GuvidlTG9KiiQT/TXT1yAWxTA==} cpu: [arm64] os: [linux] - libc: [musl] '@rollup/rollup-linux-loong64-gnu@4.60.2': resolution: {integrity: sha512-pOjB/uSIyDt+ow3k/RcLvUAOGpysT2phDn7TTUB3n75SlIgZzM6NKAqlErPhoFU+npgY3/n+2HYIQVbF70P9/A==} cpu: [loong64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-loong64-musl@4.60.2': resolution: {integrity: sha512-2/w+q8jszv9Ww1c+6uJT3OwqhdmGP2/4T17cu8WuwyUuuaCDDJ2ojdyYwZzCxx0GcsZBhzi3HmH+J5pZNXnd+Q==} cpu: [loong64] os: [linux] - libc: [musl] '@rollup/rollup-linux-ppc64-gnu@4.60.2': resolution: {integrity: sha512-11+aL5vKheYgczxtPVVRhdptAM2H7fcDR5Gw4/bTcteuZBlH4oP9f5s9zYO9aGZvoGeBpqXI/9TZZihZ609wKw==} cpu: [ppc64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-ppc64-musl@4.60.2': resolution: {integrity: sha512-i16fokAGK46IVZuV8LIIwMdtqhin9hfYkCh8pf8iC3QU3LpwL+1FSFGej+O7l3E/AoknL6Dclh2oTdnRMpTzFQ==} cpu: [ppc64] os: [linux] - libc: [musl] '@rollup/rollup-linux-riscv64-gnu@4.60.2': resolution: {integrity: sha512-49FkKS6RGQoriDSK/6E2GkAsAuU5kETFCh7pG4yD/ylj9rKhTmO3elsnmBvRD4PgJPds5W2PkhC82aVwmUcJ7A==} cpu: [riscv64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-riscv64-musl@4.60.2': resolution: {integrity: sha512-mjYNkHPfGpUR00DuM1ZZIgs64Hpf4bWcz9Z41+4Q+pgDx73UwWdAYyf6EG/lRFldmdHHzgrYyge5akFUW0D3mQ==} cpu: [riscv64] os: [linux] - libc: [musl] '@rollup/rollup-linux-s390x-gnu@4.60.2': resolution: {integrity: sha512-ALyvJz965BQk8E9Al/JDKKDLH2kfKFLTGMlgkAbbYtZuJt9LU8DW3ZoDMCtQpXAltZxwBHevXz5u+gf0yA0YoA==} cpu: [s390x] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.60.2': resolution: {integrity: sha512-UQjrkIdWrKI626Du8lCQ6MJp/6V1LAo2bOK9OTu4mSn8GGXIkPXk/Vsp4bLHCd9Z9Iz2OTEaokUE90VweJgIYQ==} cpu: [x64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-musl@4.60.2': resolution: {integrity: sha512-bTsRGj6VlSdn/XD4CGyzMnzaBs9bsRxy79eTqTCBsA8TMIEky7qg48aPkvJvFe1HyzQ5oMZdg7AnVlWQSKLTnw==} cpu: [x64] os: [linux] - libc: [musl] '@rollup/rollup-openbsd-x64@4.60.2': resolution: {integrity: sha512-6d4Z3534xitaA1FcMWP7mQPq5zGwBmGbhphh2DwaA1aNIXUu3KTOfwrWpbwI4/Gr0uANo7NTtaykFyO2hPuFLg==} @@ -982,6 +972,12 @@ packages: '@standard-schema/spec@1.1.0': resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} + '@stylistic/eslint-plugin@5.10.0': + resolution: {integrity: sha512-nPK52ZHvot8Ju/0A4ucSX1dcPV2/1clx0kLcH5wDmrE4naKso7TUC/voUyU1O9OTKTrR6MYip6LP0ogEMQ9jPQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^9.0.0 || ^10.0.0 + '@svgr/babel-plugin-add-jsx-attribute@8.0.0': resolution: {integrity: sha512-b9MIk7yhdS1pMCZM8VeNfUlSKVRhsHZNMl5O9SfaX0l0t5wjdgu4IDzGB8bpnGBBOjGST3rRFVsaaEtI4W6f7g==} engines: {node: '>=14'} @@ -1088,28 +1084,24 @@ packages: engines: {node: '>= 20'} cpu: [arm64] os: [linux] - libc: [glibc] '@tailwindcss/oxide-linux-arm64-musl@4.2.4': resolution: {integrity: sha512-bBADEGAbo4ASnppIziaQJelekCxdMaxisrk+fB7Thit72IBnALp9K6ffA2G4ruj90G9XRS2VQ6q2bCKbfFV82g==} engines: {node: '>= 20'} cpu: [arm64] os: [linux] - libc: [musl] '@tailwindcss/oxide-linux-x64-gnu@4.2.4': resolution: {integrity: sha512-7Mx25E4WTfnht0TVRTyC00j3i0M+EeFe7wguMDTlX4mRxafznw0CA8WJkFjWYH5BlgELd1kSjuU2JiPnNZbJDA==} engines: {node: '>= 20'} cpu: [x64] os: [linux] - libc: [glibc] '@tailwindcss/oxide-linux-x64-musl@4.2.4': resolution: {integrity: sha512-2wwJRF7nyhOR0hhHoChc04xngV3iS+akccHTGtz965FwF0up4b2lOdo6kI1EbDaEXKgvcrFBYcYQQ/rrnWFVfA==} engines: {node: '>= 20'} cpu: [x64] os: [linux] - libc: [musl] '@tailwindcss/oxide-wasm32-wasi@4.2.4': resolution: {integrity: sha512-FQsqApeor8Fo6gUEklzmaa9994orJZZDBAlQpK2Mq+DslRKFJeD6AjHpBQ0kZFQohVr8o85PPh8eOy86VlSCmw==} @@ -2828,28 +2820,24 @@ packages: engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] lightningcss-linux-arm64-musl@1.32.0: resolution: {integrity: sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==} engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] - libc: [musl] lightningcss-linux-x64-gnu@1.32.0: resolution: {integrity: sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] - libc: [glibc] lightningcss-linux-x64-musl@1.32.0: resolution: {integrity: sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] - libc: [musl] lightningcss-win32-arm64-msvc@1.32.0: resolution: {integrity: sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==} @@ -5117,6 +5105,16 @@ snapshots: '@standard-schema/spec@1.1.0': {} + '@stylistic/eslint-plugin@5.10.0(eslint@9.39.4(jiti@2.6.1))': + dependencies: + '@eslint-community/eslint-utils': 4.9.1(eslint@9.39.4(jiti@2.6.1)) + '@typescript-eslint/types': 8.59.0 + eslint: 9.39.4(jiti@2.6.1) + eslint-visitor-keys: 4.2.1 + espree: 10.4.0 + estraverse: 5.3.0 + picomatch: 4.0.4 + '@svgr/babel-plugin-add-jsx-attribute@8.0.0(@babel/core@7.29.0)': dependencies: '@babel/core': 7.29.0 diff --git a/src/main/frontend/app/routes/datamapper/property-list.tsx b/src/main/frontend/app/routes/datamapper/property-list.tsx index ad212005..d416dda9 100644 --- a/src/main/frontend/app/routes/datamapper/property-list.tsx +++ b/src/main/frontend/app/routes/datamapper/property-list.tsx @@ -156,8 +156,10 @@ function PropertyList({ config, configDispatch }: PropertyListProperties) { setEditingMapping, openMapping, }) - //UseMemo is used here to ensure nodetype is not changed throughout rerenders. If the variable is updated reactflow throws a warning in the console; - //Don't add flow as dependency here, it'll become an infinite loop flow changes every rerender --> updates the memo --> the memo updates the nodetypes --> updating the nodetypes causes react to trigger a rerender resulting in a infinite loop + /* + * UseMemo is used here to ensure nodetype is not changed throughout rerenders. If the variable is updated reactflow throws a warning in the console; + * Don't add flow as dependency here, it'll become an infinite loop flow changes every rerender --> updates the memo --> the memo updates the nodetypes --> updating the nodetypes causes react to trigger a rerender resulting in a infinite loop + */ // eslint-disable-next-line react-hooks/exhaustive-deps }, [openMapping]) diff --git a/src/main/frontend/app/routes/settings/settings-menu-items.ts b/src/main/frontend/app/routes/settings/settings-menu-items.ts index 97beba23..9aa0ea37 100644 --- a/src/main/frontend/app/routes/settings/settings-menu-items.ts +++ b/src/main/frontend/app/routes/settings/settings-menu-items.ts @@ -2,7 +2,6 @@ import type { TreeItem } from 'react-complex-tree' import React from 'react' import WidgetIcon from '/icons/solar/Widget.svg?react' import RulerCrossPenIcon from '/icons/solar/Ruler Cross Pen.svg?react' -import CodeIcon from '/icons/solar/Code.svg?react' import GeneralSettings from '~/routes/settings/pages/general-settings' import StudioSettings from '~/routes/settings/pages/studio-settings' import ProjectSettings from './pages/project-settings' @@ -16,10 +15,12 @@ export interface SettingsMenuItemData { content?: React.FC } +//todo: add editor settings and icon after there are settings to add there + const SettingsMenuItems = { root: { index: 'root', - children: ['general', 'projects', 'studio', 'editor'], + children: ['general', 'projects', 'studio'], data: { title: '', description: '', @@ -51,14 +52,16 @@ const SettingsMenuItems = { content: StudioSettings, }, }, - editor: { - index: 'editor', - data: { - title: 'Editor', - description: 'Editor settings', - icon: CodeIcon, - }, - }, + /* + *editor: { + *index: 'editor', + *data: { + * title: 'Editor', + * description: 'Editor settings', + * icon: CodeIcon, + *}, + *}, + */ } as Record export default SettingsMenuItems diff --git a/src/main/frontend/app/utils/api.ts b/src/main/frontend/app/utils/api.ts index 3279a424..b4e2a8fc 100644 --- a/src/main/frontend/app/utils/api.ts +++ b/src/main/frontend/app/utils/api.ts @@ -56,9 +56,11 @@ export async function apiFetch(path: string, options?: RequestInit): Promise< const response = await fetch(apiUrl(path), { ...options, headers, - /* credentials is a requirement for csrf according to multiple sources, but seems to work fine without it ?? - It also breaks because of our CORS configuration which will result in - "credential is not supported if the CORS header 'Access-Control-Allow-Origin' is '*'" */ + /* + * credentials is a requirement for csrf according to multiple sources, but seems to work fine without it ?? + * It also breaks because of our CORS configuration which will result in + * "credential is not supported if the CORS header 'Access-Control-Allow-Origin' is '*'" + */ // credentials: 'include', }) diff --git a/src/main/frontend/app/utils/datamapper_utils/property-node-utils.ts b/src/main/frontend/app/utils/datamapper_utils/property-node-utils.ts index 7cd92ece..5e7a5351 100644 --- a/src/main/frontend/app/utils/datamapper_utils/property-node-utils.ts +++ b/src/main/frontend/app/utils/datamapper_utils/property-node-utils.ts @@ -170,8 +170,10 @@ export function sequentialReposition(nodes: Node[], startParentId: string, getNo //Set height for parent nodes = nodes.map((node) => (node.id === parentId ? { ...node, height: yOffset } : node)) - //Add padding at the bottom of a group - //Move up one + /* + * Add padding at the bottom of a group + * Move up one + */ parentId = getNodeFunc(parentId)?.parentId ?? null } diff --git a/src/main/frontend/app/utils/flow-utils.ts b/src/main/frontend/app/utils/flow-utils.ts index fe907a1b..846c6722 100644 --- a/src/main/frontend/app/utils/flow-utils.ts +++ b/src/main/frontend/app/utils/flow-utils.ts @@ -52,7 +52,8 @@ export function getEdgeLabelFromHandle(node: FlowNode | undefined, handleId: str return matched?.type?.toLowerCase() ?? 'success' } -/** Converts the tagname of a non capitalized element that has a classname attribute to the last part of said classname, e.g.: +/** + * Converts the tagname of a non capitalized element that has a classname attribute to the last part of said classname, e.g.: * * Becomes */ diff --git a/src/main/frontend/cypress/support/commands.ts b/src/main/frontend/cypress/support/commands.ts index 95857aea..4afd3b9a 100644 --- a/src/main/frontend/cypress/support/commands.ts +++ b/src/main/frontend/cypress/support/commands.ts @@ -1,37 +1,41 @@ -/// -// *********************************************** -// This example commands.ts shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add('login', (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) -// -// declare global { -// namespace Cypress { -// interface Chainable { -// login(email: string, password: string): Chainable -// drag(subject: string, options?: Partial): Chainable -// dismiss(subject: string, options?: Partial): Chainable -// visit(originalFn: CommandOriginalFn, url: string, options: Partial): Chainable -// } -// } -// } +/* eslint-disable unicorn/no-empty-file */ + +/* + * / + *********************************************** + *This example commands.ts shows you how to + *create various custom commands and overwrite + *existing commands. + * + *For more comprehensive examples of custom + *commands please read more here: + *https://on.cypress.io/custom-commands + *********************************************** + * + * + *-- This is a parent command -- + *Cypress.Commands.add('login', (email, password) => { ... }) + * + * + *-- This is a child command -- + *Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) + * + * + *-- This is a dual command -- + *Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) + * + * + *-- This will overwrite an existing command -- + *Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) + * + *declare global { + * namespace Cypress { + * interface Chainable { + * login(email: string, password: string): Chainable + * drag(subject: string, options?: Partial): Chainable + * dismiss(subject: string, options?: Partial): Chainable + * visit(originalFn: CommandOriginalFn, url: string, options: Partial): Chainable + * } + * } + *} + */ diff --git a/src/main/frontend/cypress/support/e2e.ts b/src/main/frontend/cypress/support/e2e.ts index c90b6b6d..c328d0bb 100644 --- a/src/main/frontend/cypress/support/e2e.ts +++ b/src/main/frontend/cypress/support/e2e.ts @@ -1,17 +1,19 @@ -// *********************************************************** -// This example support/e2e.ts is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** +/* + *********************************************************** + *This example support/e2e.ts is processed and + *loaded automatically before your test files. + * + *This is a great place to put global configuration and + *behavior that modifies Cypress. + * + *You can change the location of this file or turn off + *automatically serving support files with the + *'supportFile' configuration option. + * + *You can read more here: + *https://on.cypress.io/configuration + *********************************************************** + */ // Import commands.js using ES2015 syntax: import './commands' diff --git a/src/main/frontend/eslint.config.mjs b/src/main/frontend/eslint.config.mjs index e9e54f9e..2b67d1a4 100644 --- a/src/main/frontend/eslint.config.mjs +++ b/src/main/frontend/eslint.config.mjs @@ -5,6 +5,7 @@ import reactHooksPlugin from 'eslint-plugin-react-hooks'; import prettierPlugin from 'eslint-plugin-prettier'; import unicorn from 'eslint-plugin-unicorn'; import sonarjs from 'eslint-plugin-sonarjs'; +import stylistic from '@stylistic/eslint-plugin'; import js from '@eslint/js'; import eslintConfigPrettier from 'eslint-config-prettier'; @@ -35,6 +36,7 @@ export default [ 'react-hooks': reactHooksPlugin, 'prettier': prettierPlugin, 'sonarjs': sonarjs, + '@stylistic': stylistic, }, settings: { react: { @@ -64,6 +66,8 @@ export default [ 'prettier/prettier': 'warn', + '@stylistic/multiline-comment-style': ['error', 'starred-block'], + 'sonarjs/cognitive-complexity': 'warn', 'sonarjs/no-duplicate-string': 'warn', }, diff --git a/src/main/frontend/package.json b/src/main/frontend/package.json index ffb50dc1..42cd719d 100644 --- a/src/main/frontend/package.json +++ b/src/main/frontend/package.json @@ -40,6 +40,7 @@ "@eslint/js": "^9.39.4", "@mdx-js/react": "^3.1.1", "@prettier/plugin-xml": "^3.4.2", + "@stylistic/eslint-plugin": "^5.10.0", "@tailwindcss/vite": "^4.2.4", "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^16.3.2",