Skip to content

Commit

Permalink
chore(all): Some general code clean up (#4431)
Browse files Browse the repository at this point in the history
* chore(all): Some general code clean up

* chore(all): Some general code clean up
  • Loading branch information
hartra344 authored Mar 25, 2024
1 parent 79723c4 commit f8ee455
Show file tree
Hide file tree
Showing 29 changed files with 108 additions and 132 deletions.
8 changes: 1 addition & 7 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,7 @@
"ignoreList": ["foo"]
}
],
"no-param-reassign": [
"error",
{
"props": true,
"ignorePropertyModificationsFor": ["state"]
}
],
"no-param-reassign": "off",
"formatjs/enforce-default-message": ["error", "literal"],
"formatjs/enforce-description": ["error", "literal"],
"formatjs/no-multiple-whitespaces": [1],
Expand Down
4 changes: 0 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run extract
npm run compile:loc
npm run compile:loc:psuedo
npx lint-staged
git add .

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function isFuncHostTask(task: vscode.Task): boolean {
const commandLine: string | undefined = task.execution && (task.execution as vscode.ShellExecution).commandLine;
if (task.definition.type == 'shell') {
const command = (task.execution as vscode.ShellExecution).command?.toString();
const funcRegex = new RegExp('\\$\\{config:azureLogicAppsStandard\\.funcCoreToolsBinaryPath\\}');
const funcRegex = /\$\{config:azureLogicAppsStandard\.funcCoreToolsBinaryPath\}/;
// check for args?
return funcRegex.test(command);
}
Expand Down
44 changes: 9 additions & 35 deletions apps/vs-code-designer/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@
}
],
"activation": {
"onFetch": [
"microsoft.web/sites"
],
"onResolve": [
"microsoft.web/sites"
]
"onFetch": ["microsoft.web/sites"],
"onResolve": ["microsoft.web/sites"]
}
},
"commands": [
Expand Down Expand Up @@ -723,28 +719,17 @@
"azureLogicAppsStandard.projectRuntime": {
"scope": "resource",
"type": "string",
"enum": [
"~4",
"~3"
],
"enum": ["~4", "~3"],
"description": "The default version of the Azure Functions runtime to use when performing operations like \"Create New Logic App\".",
"enumDescriptions": [
"Azure Functions v4",
"Azure Functions v3 (.NET Core)"
]
"enumDescriptions": ["Azure Functions v4", "Azure Functions v3 (.NET Core)"]
},
"azureLogicAppsStandard.projectLanguage": {
"scope": "resource",
"type": "string",
"enum": [
"JavaScript",
"C#"
],
"enum": ["JavaScript", "C#"],
"readOnly": true,
"description": "The default language to use when performing operations like \"Create New Workflow\".",
"enumDescriptions": [
""
]
"enumDescriptions": [""]
},
"azureLogicAppsStandard.deploySubpath": {
"scope": "resource",
Expand Down Expand Up @@ -856,11 +841,7 @@
},
"azureLogicAppsStandard.projectOpenBehavior": {
"type": "string",
"enum": [
"AddToWorkspace",
"OpenInNewWindow",
"OpenInCurrentWindow"
],
"enum": ["AddToWorkspace", "OpenInNewWindow", "OpenInCurrentWindow"],
"description": "The behavior to use after creating a new project. The options are \"AddToWorkspace\", \"OpenInNewWindow\", or \"OpenInCurrentWindow\"."
},
"azureLogicAppsStandard.show64BitWarning": {
Expand Down Expand Up @@ -989,15 +970,8 @@
},
"homepage": "https://azure.microsoft.com/services/logic-apps/",
"license": "SEE LICENSE IN LICENSE.md",
"categories": [
"Azure"
],
"keywords": [
"Azure",
"Logic App",
"serverless",
"multi-root ready"
],
"categories": ["Azure"],
"keywords": ["Azure", "Logic App", "serverless", "multi-root ready"],
"preview": false,
"publisher": "ms-azuretools",
"icon": "assets/logicapp.png",
Expand Down
30 changes: 29 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,35 @@
"ignore": ["dist/*", "test-results/*", "tmp/*", "playwright-report/*"]
},
"linter": {
"enabled": false
"enabled": true,
"rules": {
"recommended": false,
"performance": {
"all": true,
"noDelete": "off",
"noAccumulatingSpread": "off"
},
"a11y": {
"all": false
},
"complexity": {
"all": false
},
"correctness": {
"all": false
},
"security": {
"all": true
},
"style": {
"all": false
},
"suspicious": {
"all": false
}
},
"include": ["libs/**/*.ts", "libs/**/*.tsx", "apps/**/*.ts", "apps/**/*.tsx"],
"ignore": ["**/__test__/**"]
},
"organizeImports": {
"enabled": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { RootState } from '../../core/state/Store';
import { FileDropdown } from '../fileDropdown/fileDropdown';
import { SchemaType } from '@microsoft/logic-apps-shared';
import React, { useMemo } from 'react';
import { useMemo } from 'react';
import { useIntl } from 'react-intl';
import { useSelector } from 'react-redux';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as React from 'react';

interface AllowDropTargetProps {
fill: string;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as React from 'react';

interface BlockDropTargetProps {
fill: string;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as React from 'react';

interface DotProps {
fill: string;
}
Expand Down
2 changes: 1 addition & 1 deletion libs/designer-ui/src/lib/editor/monaco/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export const MonacoEditor = forwardRef<editor.IStandaloneCodeEditor, MonacoProps
id: 'open-tokenpicker',
label: 'Open TokenPicker',
keybindings: [512 | 85],
run: function (): void | Promise<void> {
run: (): void | Promise<void> => {
openTokenPicker?.();
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { StringEditor } from '../../editor/string';
import type { FloatingActionMenuItem } from '../floatingactionmenubase';
import { FloatingActionMenuBase } from '../floatingactionmenubase';
import { clone, ValidationErrorCode, ValidationException } from '@microsoft/logic-apps-shared';
import React from 'react';
import { useIntl } from 'react-intl';

type DynamicallyAddedParameterOutputsProperties = {
Expand Down
1 change: 1 addition & 0 deletions libs/designer-ui/src/lib/monitoring/values/html.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const HtmlValue: React.FC<ValueProps> = (props) => {
{displayName}
</label>
<div aria-labelledby={id} className="msla-trace-value-text msla-trace-value-html-table">
{/* biome-ignore lint/security/noDangerouslySetInnerHtml: This is needed in this case but we should investigate other ways of doing it */}
<table dangerouslySetInnerHTML={{ __html }} tabIndex={0}></table>
</div>
</section>
Expand Down
2 changes: 1 addition & 1 deletion libs/designer-ui/src/lib/querybuilder/Group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ export const Group = ({
items={[]}
overflowItems={groupMenuItems}
onRenderOverflowButton={onRenderOverflowButton}
onRenderItem={function (_item: IOverflowSetItemProps) {
onRenderItem={(_item: IOverflowSetItemProps) => {
throw new Error('No items in overflowset');
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion libs/designer-ui/src/lib/querybuilder/Row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ export const Row = ({
items={[]}
overflowItems={rowMenuItems}
onRenderOverflowButton={onRenderOverflowButton}
onRenderItem={function (_item: IOverflowSetItemProps) {
onRenderItem={(_item: IOverflowSetItemProps) => {
throw new Error('No items in overflowset');
}}
/>
Expand Down
2 changes: 0 additions & 2 deletions libs/designer-ui/src/lib/recommendation/documentationItem.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as React from 'react';

export type DocLinkClickedEventHandler = () => void;

export interface DocumentationItemProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { SettingToggleProps } from '../settingtoggle';
import { SettingToggle } from '../settingtoggle';
import * as React from 'react';
import * as ReactShallowRenderer from 'react-test-renderer/shallow';

describe('ui/settings/settingtoggle', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import type { EventHandler } from '../../../eventhandler';
import { Label } from '../../../label';
import { useId } from '../../../useId';
import { SimpleDictionaryItem } from './simpledictionaryitem';
import type { SimpleDictionaryRowModel, SimpleDictionaryChangeModel } from './simpledictionaryitem';
Expand Down
1 change: 0 additions & 1 deletion libs/designer-ui/src/lib/tip/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { IButtonProps } from '@fluentui/react';
import { Callout, CommandButton, DirectionalHint } from '@fluentui/react';
import type { ReactNode } from 'react';
import React from 'react';

export const DEFAULT_TIP_GAP_SPACE = 0;
export const DEFAULT_DIRECTIONAL_HINT = DirectionalHint.leftCenter;
Expand Down
2 changes: 1 addition & 1 deletion libs/designer-ui/src/lib/tokenpicker/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { editor } from 'monaco-editor';
import type { ValueSegment } from '../editor';
import { CLOSE_TOKENPICKER } from '../editor/base/plugins/CloseTokenPicker';
import type { ExpressionEditorEvent } from '../expressioneditor';
Expand All @@ -15,7 +16,6 @@ import type { ICalloutContentStyles, ISearchBox, PivotItem } from '@fluentui/rea
import { SearchBox, DirectionalHint, Callout } from '@fluentui/react';
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
import type { LexicalEditor, NodeKey } from 'lexical';
import type { editor } from 'monaco-editor';
import { useEffect, useRef, useState } from 'react';
import { useIntl } from 'react-intl';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { EditOrDeleteButtonProps } from '../workflowparametersButtons';
import { EditOrDeleteButton } from '../workflowparametersButtons';
import * as React from 'react';
import * as ReactShallowRenderer from 'react-test-renderer/shallow';

describe('ui/workflowparameters/workflowparametersButtons', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,7 @@ export const useAllOperationErrors = () => useSelector(createSelector(getOperati

export const useParameterValidationErrors = (nodeId: string) => {
const allParameters = useOperationInputParameters(nodeId);
return useMemo(
() =>
allParameters
.map((parameter) => parameter.validationErrors)
.flat()
.filter((error) => error),
[allParameters]
);
return useMemo(() => allParameters.flatMap((parameter) => parameter.validationErrors).filter((error) => error), [allParameters]);
};

export const useNodesInitialized = () => useSelector(createSelector(getOperationState, (state) => state.loadStatus.nodesInitialized));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as React from 'react';

interface AllowDropTargetProps {
fill: string;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as React from 'react';

interface BlockDropTargetProps {
fill: string;
}
Expand Down
2 changes: 0 additions & 2 deletions libs/designer/src/lib/ui/connections/dynamicsvgs/gripper.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as React from 'react';

interface GripperProps {
fill: string;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as React from 'react';

interface DotProps {
fill: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ export const ConnectorConnectionsCard: React.FC<ConnectorConnectionsCardProps> =
const hasErrors = useMemo(() => {
if (disconnectedNodes?.length > 0) return true;
const nodesWithErrors = Object.keys(allErrors);
const connectorNodeIds = Object.values(connectionRefs)
.map((obj) => obj.nodes)
.flat();
const connectorNodeIds = Object.values(connectionRefs).flatMap((obj) => obj.nodes);
return nodesWithErrors.some((nodeId) => connectorNodeIds.includes(nodeId));
}, [allErrors, connectionRefs, disconnectedNodes?.length]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,17 @@ describe('lib/helpers/functions', () => {
expect(hexToRgbA(hexColor)).toBe('rgba(0,51,255, 1)');
});

it('returns 0 for opacity when opacity is 0', () => {
const hexColor = '#0033FF';
// Note: This actually would have failed before the fix
expect(hexToRgbA(hexColor, 0)).toBe('rgba(0,51,255, 0)');
});

it('returns 0.5 for opacity when opacity is 0', () => {
const hexColor = '#0033FF';
expect(hexToRgbA(hexColor, 0.5)).toBe('rgba(0,51,255, 0.5)');
});

it('returns rgb value for the incomplete hex value', () => {
const hexColor = '#03F';
expect(hexToRgbA(hexColor)).toBe('rgba(0,51,255, 1)');
Expand Down
Loading

0 comments on commit f8ee455

Please sign in to comment.