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

Update to eslint v9 #221

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pipeline {
"<a href=${BUILD_URL}artifact/integrations/standalone/build/mock.html>&raquo; Variables Editor Mock</a>"

withChecks('ESLint') {
recordIssues enabledForFailure: true, publishAllIssues: true, aggregatingResults: true, tools: [esLint(pattern: 'packages/**/eslint.xml,integrations/**/eslint.xml')], qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]]
recordIssues enabledForFailure: true, publishAllIssues: true, aggregatingResults: true, tools: [esLint(pattern: 'eslint.xml')], qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]]
}

withChecks('Test') {
Expand Down
47 changes: 0 additions & 47 deletions config/base.eslintrc.json

This file was deleted.

16 changes: 16 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import tseslint from 'typescript-eslint';
import config from '@axonivy/eslint-config';

export default tseslint.config(
...config.base,
// TypeScript configs
{
name: 'typescript-eslint',
languageOptions: {
parserOptions: {
project: true, // Uses tsconfig.json from current directory
tsconfigRootDir: import.meta.dirname
}
}
}
);
9 changes: 0 additions & 9 deletions integrations/standalone/.eslintrc.cjs

This file was deleted.

11 changes: 3 additions & 8 deletions integrations/standalone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"private": true,
"version": "13.1.0-next",
"dependencies": {
"@axonivy/ui-components": "~13.1.0-next.413",
"@axonivy/ui-icons": "~13.1.0-next.413",
"@axonivy/ui-components": "~13.1.0-next.417",
"@axonivy/ui-icons": "~13.1.0-next.417",
"@axonivy/variable-editor": "*",
"@axonivy/variable-editor-protocol": "*",
"react": "^18.3.1",
Expand All @@ -23,12 +23,7 @@
"package": "vite build",
"type": "tsc --noEmit",
"dev": "vite",
"serve": "vite preview",
"lint": "eslint --ext .ts,.tsx ./src",
"lint:fix": "eslint --fix --ext .ts,.tsx ./src",
"webtest:mock": "npx playwright test -c ./tests/mock",
"webtest:engine": "npx playwright test -c ./tests/integration",
"webtest:screenshot": "npx playwright test -c ./tests/screenshots"
"serve": "vite preview"
},
"type": "module"
}
20 changes: 12 additions & 8 deletions integrations/standalone/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ import { webSocketConnection, type Connection } from '@axonivy/jsonrpc';
import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import './index.css';
import { URLParams } from './url-helper';
import { appParam, directSaveParam, pmvParam, readonlyParam, themeParam, webSocketBaseParam } from './url-helper';

export async function start(): Promise<void> {
const server = URLParams.webSocketBase();
const app = URLParams.app();
const pmv = URLParams.pmv();
const theme = URLParams.theme();
const readonly = URLParams.readonly();
const directSave = URLParams.directSave();
const server = webSocketBaseParam();
const app = appParam();
const pmv = pmvParam();
const theme = themeParam();
const readonly = readonlyParam();
const directSave = directSaveParam();
const queryClient = initQueryClient();
const root = ReactDOM.createRoot(document.getElementById('root')!);
const rootElement = document.getElementById('root');
if (!rootElement) {
throw new Error('rootElement not found');
}
const root = ReactDOM.createRoot(rootElement);

root.render(
<React.StrictMode>
Expand Down
6 changes: 5 additions & 1 deletion integrations/standalone/src/mock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import * as ReactDOM from 'react-dom/client';
import './index.css';
import { VariablesClientMock } from './mock/variables-client-mock';

const root = ReactDOM.createRoot(document.getElementById('root')!);
const rootElement = document.getElementById('root');
if (!rootElement) {
throw new Error('rootElement not found');
}
const root = ReactDOM.createRoot(rootElement);
const client = new VariablesClientMock();
const queryClient = initQueryClient();

Expand Down
92 changes: 45 additions & 47 deletions integrations/standalone/src/url-helper.ts
Original file line number Diff line number Diff line change
@@ -1,57 +1,55 @@
export namespace URLParams {
export function parameter(key: string): string | undefined {
const param = new URLSearchParams(window.location.search).get(key);
return param !== null ? decodeURIComponent(param) : undefined;
}
export function parameter(key: string): string | undefined {
const param = new URLSearchParams(window.location.search).get(key);
return param !== null ? decodeURIComponent(param) : undefined;
}

export function app(): string {
return parameter('app') ?? '';
}
export function appParam(): string {
return parameter('app') ?? '';
}

export function pmv(): string {
return parameter('pmv') ?? '';
}
export function pmvParam(): string {
return parameter('pmv') ?? '';
}

export function theme(): 'dark' | 'light' {
const theme = parameter('theme');
if (theme === 'dark') {
return theme;
}
return 'light';
export function themeParam(): 'dark' | 'light' {
const theme = parameter('theme');
if (theme === 'dark') {
return theme;
}
return 'light';
}

export function readonly(): boolean {
const readonly = parameter('readonly');
if (readonly === 'true') {
return true;
}
return false;
export function readonlyParam(): boolean {
const readonly = parameter('readonly');
if (readonly === 'true') {
return true;
}
return false;
}

export function directSave(): boolean {
return parameter('directSave') !== undefined;
}
export function directSaveParam(): boolean {
return parameter('directSave') !== undefined;
}

export function webSocketBaseParam(): string {
return `${isSecureConnection() ? 'wss' : 'ws'}://${server()}`;
}

export function webSocketBase(): string {
return `${isSecureConnection() ? 'wss' : 'ws'}://${server()}`;
const isSecureConnection = () => {
const secureParam = parameter('secure');
if (secureParam === 'true') {
return true;
}
if (secureParam === 'false') {
return false;
}
return window.location.protocol === 'https:';
};

const isSecureConnection = () => {
const secureParam = parameter('secure');
if (secureParam === 'true') {
return true;
}
if (secureParam === 'false') {
return false;
}
return window.location.protocol === 'https:';
};

const server = () => {
return parameter('server') ?? basePath();
};

const basePath = () => {
return 'localhost:8081';
};
}
const server = () => {
return parameter('server') ?? basePath();
};

const basePath = () => {
return 'localhost:8081';
};
Loading
Loading