Skip to content

Commit linting on client and ui#767

Merged
johbaxter merged 5 commits intodevfrom
commit-linting-on-client
Mar 27, 2025
Merged

Commit linting on client and ui#767
johbaxter merged 5 commits intodevfrom
commit-linting-on-client

Conversation

@johbaxter
Copy link
Copy Markdown
Contributor

image

@johbaxter johbaxter requested a review from a team as a code owner March 27, 2025 19:39
@github-actions
Copy link
Copy Markdown

@CodiumAI-Agent /describe

@github-actions
Copy link
Copy Markdown

@CodiumAI-Agent /review

@QodoAI-Agent
Copy link
Copy Markdown

QodoAI-Agent commented Mar 27, 2025

Title

Commit linting on client


User description


PR Type

  • Enhancement

Description

  • Replace let declarations with const for immutability

  • Update UI imports to reference @semoss/ui components

  • Refactor ESLint and package scripts for consistency

  • Minor type and code style improvements across files


Changes walkthrough 📝

Relevant files
Enhancement
20 files
ColourByValue.tsx
Replace mutable variables with const declarations               
+32/-31 
StackChart.tsx
Convert let to const and update data processing variables
+21/-20 
EditYAxisScatterPlot.tsx
Update variable declarations for Y-axis settings                 
+8/-8     
EditYAxisStackChart.tsx
Replace let with const in Y-axis stack settings                   
+8/-8     
EditXAxisScatterPlot.tsx
Use const for x-axis update functions                                       
+9/-9     
EditXAxisStackChart.tsx
Refactor X-axis update using const declarations                   
+9/-9     
FrameOperations.tsx
Replace mutable variables with const in frame operations 
+18/-17 
Line.tsx
Use const in line chart data formatting and tooltip logic
+11/-11 
Bar.tsx
Update Bar chart variable declarations and context handlers
+14/-14 
ScatterPlotBlockSettings.tsx
Refactor scatter plot settings with const updates               
+8/-8     
ToggleTrendline.tsx
Use const for trendline toggle and series filtering updates
+10/-10 
Edit-Y-Axis.tsx
Update Y-axis editing with immutable declarations               
+7/-7     
ValueLabelScatterPlot.tsx
Refactor value label update functions using const               
+5/-5     
StackChartBlockSettings.tsx
Use const for stack chart block settings and option parsing
+6/-6     
LineValueLabel.tsx
Replace let with const in line value label logic                 
+12/-10 
YAxisStyling.tsx
Update Y-axis styling with const and improved parsing       
+6/-6     
Pie.tsx
Refactor Pie chart option parsing and tooltip handling     
+6/-6     
ScatterPlot.tsx
Use const in scatter plot brush and context menu functions
+5/-5     
JobTypesSendEmailBuilder.tsx
Update email builder to use AutocompleteTwo component       
+11/-6   
.eslintrc.json
Add rule to enforce imports from @semoss/ui over @mui/material
+69/-0   
Additional files
71 files
pre-commit +21/-2   
package.json +1/-1     
VisualizationBlock.tsx +4/-4     
ChartContextMenu.tsx +4/-4     
ChartStyling.tsx +2/-1     
CustomizeValueLabels.tsx +12/-10 
Edit-X-Axis.tsx +4/-4     
Legend.tsx +2/-1     
UpgradedVisualizationTool.tsx +3/-3     
VisualizationStyles.tsx +5/-5     
Fields.tsx +4/-4     
FrameOperationsLine.tsx +1/-1     
LineLegend.tsx +1/-1     
LineStyling.tsx +1/-1     
LineTitle.tsx +2/-2     
LineTooltip.tsx +1/-1     
XAxisStyling.tsx +1/-1     
ColorByValue.tsx +7/-7     
CustomTooltip.tsx +1/-1     
FrameOperationsPie.tsx +5/-5     
PieLegend.tsx +1/-1     
PieTitle.tsx +2/-2     
PieValueLabel.tsx +2/-2     
ToggleDonut.tsx +1/-1     
ScatterPlotChartTitle.tsx +1/-1     
ScatterPlotSymbol.tsx +2/-2     
TooltipScatterPlot.tsx +1/-1     
chart-utility.ts +1/-1     
LegendStackChart.tsx +1/-1     
StackChartBarStyle.tsx +2/-2     
ValueLabelStackChart.tsx +5/-5     
OptionsSettings.tsx +1/-1     
AIGenerationSettings.tsx +2/-2     
ColorPalatteSettings.tsx +5/-5     
ColorPickerSettings.tsx +1/-1     
.eslintrc.json +3/-2     
package.json +1/-1     
index.ts +3/-0     
Badge.tsx +15/-2   
Popover.tsx +15/-0   
Search.tsx +1/-1     
index.ts +4/-0     
index.ts +3/-1     
index.ts +28/-0   
package.json +6/-1     
.eslintrc--old.js +7/-0     
package.json +1/-1     
DependencyTable.tsx +9/-2     
EditDependenciesModal.tsx +8/-6     
EditDetailsModal.tsx +7/-5     
SaveAppModal.tsx +1/-1     
BlocksMenuPanel.tsx +2/-2     
BlocksMenuPanelFilterMenu.tsx +10/-6   
TextSettingsMask.tsx +2/-3     
PromptBuilderContextStep.tsx +14/-4   
PromptBuilderInputTypeSelection.tsx +9/-7     
prompt.styled.tsx +9/-4     
PromptHoverToken.tsx +3/-2     
MembersAddOverlay.tsx +8/-7     
UserAddOverlay.tsx +1/-1     
TeamTileCard.tsx +4/-3     
Tour.tsx +4/-2     
ImportConnectionPage.tsx +2/-2     
HistoryRow.tsx +6/-4     
JobBuilderModal.tsx +9/-7     
JobStandardFrequencyBuilder.tsx +6/-5     
JobTypesBuilder.tsx +4/-5     
JobTypesCustomJobBuilder.tsx +8/-3     
JobsPage.tsx +1/-1     
general.ts +4/-2     
webpack.config.js +0/-5     

Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @github-actions
    Copy link
    Copy Markdown

    @CodiumAI-Agent /improve

    @QodoAI-Agent
    Copy link
    Copy Markdown

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    JSON Parsing

    New code introduces numerous JSON.parse calls without any error handling. If the input string is not valid JSON, it could lead to runtime errors. Ensure that these calls are wrapped with try/catch or validated beforehand.

    const functionCallReference = useRef({
        valuesResetCheck: false,
        assignedRules: [],
        applyRulesToChart: false,
    });
    const columnData = data.columns || [];
    // get the value of the input (wrapped in usememo because of path prop)
    const computedValue = useMemo(() => {
        return computed(() => {
            if (!data) {
                return "";
            }
            const v = getValueByPath(data, path);
            if (typeof v === "undefined") {
                return "";
            } else if (typeof v === "string") {
                return v;
            }
            return JSON.stringify(v, null, 2);
        });
    }, [data, path]).get();
    //initial setting of state data based on the json value
    useEffect(() => {
        functionCallReference.current.applyRulesToChart = false;
        const option =
            typeof computedValue === "string"
                ? JSON.parse(computedValue)
                : computedValue;
        if (
            option.hasOwnProperty("customSettings") &&
            option["customSettings"].hasOwnProperty("appliedColourByValue")
        ) {
            const appliedRules =
                option["customSettings"]["appliedColourByValue"];
            setAppliedRules(appliedRules);
        }
    }, []);
    //whenever a computed value is changed, then respective change for colour by value component is
    useEffect(() => {
        setValue(computedValue);
    }, [computedValue]);
    useEffect(() => {
        if (functionCallReference.current.applyRulesToChart) {
            const option =
                typeof value === "string" ? JSON.parse(value) : value;
            let colourObj = {};
            let optionUpdated = option;
            appliedRules.forEach((appliedItem, index) => {
                const xAxisPosition = getXAxisPositions(appliedItem);
                //take all the series indexes to update the data
                const filteredSeriesIndex = getFilteredSeriesIndex();
                if (xAxisPosition.length) {
                    filteredSeriesIndex.forEach((item, index) => {
                        const seriesIndexData = item;
                        if (seriesIndexData > -1) {
                            const data =
                                option["series"][seriesIndexData]["data"];
                            data.forEach((item, dataindex) => {
                                colourObj = {
                                    ...colourObj,
                                    [dataindex]: xAxisPosition.includes(
                                        dataindex,
                                    )
                                        ? appliedItem.columnColour
                                        : colourObj.hasOwnProperty(
                                              dataindex,
                                          )
                                        ? colourObj[dataindex]
                                        : ECHART_BAR_COLOUR,
                                };
                            });
                            setValuesColourMapping((prevColour) => {
                                return {
                                    ...prevColour,
                                    ...colourObj,
                                };
                            });
                            if (
                                option["series"][
                                    seriesIndexData
                                ].hasOwnProperty("itemStyle")
                            ) {
                                option["series"][seriesIndexData][
                                    "itemStyle"
    Consistency & Performance

    Many components now repeatedly parse the same JSON string (via JSON.parse) in event handlers and render logic. Consider caching parsed data to improve performance and check that naming conventions remain consistent across similar modules.

    const formatDataPoints = useCallback(
        (resultData: unknown) => {
            if (frame.data.values.length > 0) {
                const valuesDataSet = JSON.parse(
                    JSON.stringify(frame.data.values),
                );
                let headersDataSet: string[] = JSON.parse(
                    JSON.stringify(frame.data.headers),
                );
                headersDataSet = headersDataSet.map((header: string) =>
                    header.replace("Average_", ""),
                );
                //format the data points to match the echart specification
                resultData["xAxis"]["data"] = valuesDataSet.map((x) => x[0]);
                valuesDataSet.map((x) => x.shift());
                headersDataSet.shift();
                const yAxisListLength = resultData["yAxis"]["name"].length;
                for (let index = 0; index < yAxisListLength; index++) {
                    resultData["series"][index]["data"] = valuesDataSet.map(
                        (x) => {
                            return x[index];
                        },
                    );

    @QodoAI-Agent
    Copy link
    Copy Markdown

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @johbaxter johbaxter changed the title Commit linting on client Commit linting on client and ui Mar 27, 2025
    @johbaxter johbaxter merged commit a50af00 into dev Mar 27, 2025
    3 checks passed
    @johbaxter johbaxter deleted the commit-linting-on-client branch March 27, 2025 20:34
    @github-actions
    Copy link
    Copy Markdown

    @CodiumAI-Agent /update_changelog

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    None yet

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    2 participants