Skip to content

Commit

Permalink
chore: upgrade to ESLint v9 with flat config (#1032)
Browse files Browse the repository at this point in the history
* chore: upgrade to ESLint v9 with flat config
  • Loading branch information
ghiscoding authored Jun 19, 2024
1 parent bb90588 commit 4c233dd
Show file tree
Hide file tree
Showing 34 changed files with 2,381 additions and 3,684 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

62 changes: 0 additions & 62 deletions .eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ jobs:
# wait-on: 'http://localhost:8080'
browser: chrome
config-file: cypress/cypress.config.ts
install-command: npm install --legacy-peer-deps
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.esproj
*.sln
.vs*
.eslintcache
node_modules/*
src/models/*.js
src/plugins/*.js
Expand Down
4 changes: 2 additions & 2 deletions cypress/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from 'cypress'
import { defineConfig } from 'cypress';

import plugins from './plugins/index';

Expand All @@ -16,4 +16,4 @@ export default defineConfig({
},
baseUrl: 'http://localhost:8080',
},
})
});
16 changes: 8 additions & 8 deletions cypress/e2e/example-auto-scroll-when-dragging.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('Example - Auto scroll when dragging', { retries: 1 }, () => {
const fullTitles = ['#', 'Title', 'Duration', '% Complete', 'Start', 'Finish', 'Cost', 'Effort Driven'];

for (let i = 0; i < 30; i++) {
fullTitles.push("Mock" + i);
fullTitles.push('Mock' + i);
}

it('should load Example', () => {
Expand All @@ -28,7 +28,7 @@ describe('Example - Auto scroll when dragging', { retries: 1 }, () => {
});

it('should select border shown in cell selection model, and hidden in row selection model when dragging', { scrollBehavior: false }, function () {
cy.getNthCell(0, 1, '', { parentSelector: "#myGrid", rowHeight: cellHeight })
cy.getNthCell(0, 1, '', { parentSelector: '#myGrid', rowHeight: cellHeight })
.as('cell1')
.dragStart();

Expand All @@ -39,7 +39,7 @@ describe('Example - Auto scroll when dragging', { retries: 1 }, () => {
cy.get('#myGrid .slick-range-decorator').should('not.be.exist');
cy.get('#myGrid .slick-cell.selected').should('have.length', 6);

cy.getNthCell(0, 1, '', { parentSelector: "#myGrid2", rowHeight: cellHeight })
cy.getNthCell(0, 1, '', { parentSelector: '#myGrid2', rowHeight: cellHeight })
.as('cell2')
.dragStart();
cy.get('#myGrid2 .slick-range-decorator').should('be.exist').and('have.css', 'border-style').and('equal', 'none');
Expand All @@ -49,12 +49,12 @@ describe('Example - Auto scroll when dragging', { retries: 1 }, () => {
cy.get('#myGrid2 .slick-range-decorator').should('not.be.exist');
cy.get('#myGrid2 .slick-row:nth-child(-n+6)')
.children(':not(.cell-unselectable)')
.each(($child) => expect($child.attr("class")).to.include('selected'));
.each(($child) => expect($child.attr('class')).to.include('selected'));
});

function testScroll() {
return getScrollDistanceWhenDragOutsideGrid("#myGrid", 'topLeft', 'right', 0, 1).then(cellScrollDistance => {
return getScrollDistanceWhenDragOutsideGrid("#myGrid2", 'topLeft', 'bottom', 0, 1).then(rowScrollDistance => {
return getScrollDistanceWhenDragOutsideGrid('#myGrid', 'topLeft', 'right', 0, 1).then(cellScrollDistance => {
return getScrollDistanceWhenDragOutsideGrid('#myGrid2', 'topLeft', 'bottom', 0, 1).then(rowScrollDistance => {
return cy.wrap({
cell: {
scrollBefore: cellScrollDistance.scrollLeftBefore,
Expand Down Expand Up @@ -110,8 +110,8 @@ describe('Example - Auto scroll when dragging', { retries: 1 }, () => {
}

function testInterval(px) {
return getIntervalUntilRow16Displayed("#myGrid", px).then(intervalCell => {
return getIntervalUntilRow16Displayed("#myGrid2", px).then(intervalRow => {
return getIntervalUntilRow16Displayed('#myGrid', px).then(intervalCell => {
return getIntervalUntilRow16Displayed('#myGrid2', px).then(intervalRow => {
return cy.wrap({
cell: intervalCell,
row: intervalRow
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/example-checkbox-header-row.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Example - Checkbox Header Row', () => {
beforeEach(() => {
// create a console.log spy for later use
cy.window().then((win) => {
cy.spy(win.console, "log");
cy.spy(win.console, 'log');
});
});

Expand Down Expand Up @@ -88,9 +88,9 @@ describe('Example - Checkbox Header Row', () => {
.click({ force: true });

cy.get('#selectedRows')
.invoke('text').then((text => {
.invoke('text').then((text => {
expect(text.trim()).to.eq('');
}));
}));

cy.window().then((win) => {
expect(win.console.log).to.have.callCount(2);
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/example-composite-editor-modal-dialog.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('Example - Composite Editor Modal with Create/Edit/Mass-Update/Mass-Sel
beforeEach(() => {
// create a console.log spy for later use
cy.window().then((win) => {
cy.spy(win.console, "log");
cy.spy(win.console, 'log');
});
});

Expand Down
16 changes: 8 additions & 8 deletions cypress/e2e/example-excel-compatible-spreadsheet.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ describe('Example - Excel-compatible spreadsheet and Cell Selection', { retries:
});

it('should click on cell B2, copy value, ArrowDown, paste value, ArrowRight, and expect to be in column C', () => {
cy.getCell(2, 2, '', { parentSelector: "#myGrid", rowHeight: cellHeight })
cy.getCell(2, 2, '', { parentSelector: '#myGrid', rowHeight: cellHeight })
.as('cell_B2')
.click();

cy.get(".slick-cell.active")
.realPress(["Control", "C"]);
cy.get('.slick-cell.active')
.realPress(['Control', 'C']);

cy.get(".slick-cell.active")
cy.get('.slick-cell.active')
.type('{downarrow}');

cy.get(".slick-cell.active")
.realPress(["Control", "V"]);
cy.get('.slick-cell.active')
.realPress(['Control', 'V']);

cy.get(".slick-cell.active")
cy.get('.slick-cell.active')
.type('{rightarrow}');

cy.get('#myGrid .slick-cell.l3.r3.selected')
.should('have.length', 1);

cy.getCell(3, 2, '', { parentSelector: "#myGrid", rowHeight: cellHeight })
cy.getCell(3, 2, '', { parentSelector: '#myGrid', rowHeight: cellHeight })
.should('have.text', '3');
});
});
2 changes: 1 addition & 1 deletion cypress/e2e/example-grid-menu.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Example - Grid Menu', () => {
beforeEach(() => {
// create a console.log spy for later use
cy.window().then((win) => {
cy.spy(win.console, "log");
cy.spy(win.console, 'log');
});
});

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/example-grouping-esm.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('Example - Grouping & Aggregators (ESM)', { retries: 1 }, () => {
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 2}px;"].slick-group-level-2 .slick-group-toggle.collapsed`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 2}px;"].slick-group-level-2 .slick-group-title`).contains(/^% Complete: [0-9]/);

cy.get(`[style="top: ${GRID_ROW_HEIGHT * 3}px;"].slick-group-totals.slick-group-level-2 .slick-cell:nth(3)`).contains(/^avg: [0-9]\%$/);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 3}px;"].slick-group-totals.slick-group-level-2 .slick-cell:nth(3)`).contains(/^avg: [0-9]%$/);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 3}px;"].slick-group-totals.slick-group-level-2`)
.find('.slick-cell:nth(3)').contains('avg: ');
});
Expand Down
128 changes: 64 additions & 64 deletions cypress/e2e/example-grouping.cy.ts
Original file line number Diff line number Diff line change
@@ -1,81 +1,81 @@
describe('Example - Grouping & Aggregators', { retries: 1 }, () => {
// NOTE: everywhere there's a * 2 is because we have a top+bottom (frozen rows) containers even after Unfreeze Columns/Rows
const GRID_ROW_HEIGHT = 25;
const fullTitles = ['#', 'Title', 'Duration', '% Complete', 'Start', 'Finish', 'Cost', 'Effort-Driven'];
for (let i = 0; i < 30; i++) {
fullTitles.push(`Mock${i}`);
}

it('should display Example title', () => {
cy.visit(`${Cypress.config('baseUrl')}/examples/example-grouping.html`);
cy.get('h2').contains('Demonstrates');
cy.get('h2 + ul > li').first().contains('Grouping & Aggregator features');
// NOTE: everywhere there's a * 2 is because we have a top+bottom (frozen rows) containers even after Unfreeze Columns/Rows
const GRID_ROW_HEIGHT = 25;
const fullTitles = ['#', 'Title', 'Duration', '% Complete', 'Start', 'Finish', 'Cost', 'Effort-Driven'];
for (let i = 0; i < 30; i++) {
fullTitles.push(`Mock${i}`);
}

it('should display Example title', () => {
cy.visit(`${Cypress.config('baseUrl')}/examples/example-grouping.html`);
cy.get('h2').contains('Demonstrates');
cy.get('h2 + ul > li').first().contains('Grouping & Aggregator features');
});

it('should have exact column titles on 1st grid', () => {
cy.get('#myGrid')
.find('.slick-header-columns')
.children()
.each(($child, index) => expect($child.text()).to.eq(fullTitles[index]));
});

describe('Grouping Tests', () => {
it('should "Group by Duration & sort groups by value" then Collapse All and expect only group titles', () => {
cy.get('[data-test="add-50k-rows-btn"]').click();
cy.get('[data-test="group-duration-sort-value-btn"]').click();
cy.get('[data-test="collapse-all-btn"]').click();

cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell:nth(0) .slick-group-toggle.collapsed`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 0');

cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"] > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 1');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 2}px;"] > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 2');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 3}px;"] > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 3');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 4}px;"] > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 4');
});

it('should have exact column titles on 1st grid', () => {
cy.get('#myGrid')
.find('.slick-header-columns')
.children()
.each(($child, index) => expect($child.text()).to.eq(fullTitles[index]));
});

describe('Grouping Tests', () => {
it('should "Group by Duration & sort groups by value" then Collapse All and expect only group titles', () => {
cy.get('[data-test="add-50k-rows-btn"]').click();
cy.get('[data-test="group-duration-sort-value-btn"]').click();
cy.get('[data-test="collapse-all-btn"]').click();

cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell:nth(0) .slick-group-toggle.collapsed`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 0');

cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"] > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 1');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 2}px;"] > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 2');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 3}px;"] > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 3');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 4}px;"] > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 4');
});
it('should click on Expand All columns and expect 1st row as grouping title and 2nd row as a regular row', () => {
cy.get('[data-test="add-50k-rows-btn"]').click();
cy.get('[data-test="group-duration-sort-value-btn"]').click();
cy.get('[data-test="expand-all-btn"]').click();

it('should click on Expand All columns and expect 1st row as grouping title and 2nd row as a regular row', () => {
cy.get('[data-test="add-50k-rows-btn"]').click();
cy.get('[data-test="group-duration-sort-value-btn"]').click();
cy.get('[data-test="expand-all-btn"]').click();
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell:nth(0) .slick-group-toggle.expanded`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 0');

cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell:nth(0) .slick-group-toggle.expanded`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 0');

cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"] > .slick-cell:nth(1)`).should('contain', 'Task');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"] > .slick-cell:nth(2)`).should('contain', '0');
});
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"] > .slick-cell:nth(1)`).should('contain', 'Task');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"] > .slick-cell:nth(2)`).should('contain', '0');
});

it('should "Group by Duration then Effort-Driven" and expect 1st row to be expanded, 2nd row to be collapsed and 3rd row to have group totals', () => {
cy.get('[data-test="group-duration-effort-btn"]').click();
it('should "Group by Duration then Effort-Driven" and expect 1st row to be expanded, 2nd row to be collapsed and 3rd row to have group totals', () => {
cy.get('[data-test="group-duration-effort-btn"]').click();

cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"].slick-group-level-0 > .slick-cell:nth(0) .slick-group-toggle.expanded`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"].slick-group-level-0 > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 0');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"].slick-group-level-0 > .slick-cell:nth(0) .slick-group-toggle.expanded`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"].slick-group-level-0 > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 0');

cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"].slick-group-level-1 .slick-group-toggle.collapsed`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"].slick-group-level-1 .slick-group-title`).should('contain', 'Effort-Driven: False');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"].slick-group-level-1 .slick-group-toggle.collapsed`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"].slick-group-level-1 .slick-group-title`).should('contain', 'Effort-Driven: False');

cy.get(`[style="top: ${GRID_ROW_HEIGHT * 2}px;"].slick-group-level-1 .slick-group-toggle.collapsed`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 2}px;"].slick-group-level-1 .slick-group-title`).should('contain', 'Effort-Driven: True');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 2}px;"].slick-group-level-1 .slick-group-toggle.collapsed`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 2}px;"].slick-group-level-1 .slick-group-title`).should('contain', 'Effort-Driven: True');

cy.get(`[style="top: ${GRID_ROW_HEIGHT * 3}px;"].slick-group-totals.slick-group-level-0 .slick-cell:nth(2)`).should('contain', 'total: 0');
});
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 3}px;"].slick-group-totals.slick-group-level-0 .slick-cell:nth(2)`).should('contain', 'total: 0');
});

it('should "Group by Duration then Effort-Driven then Percent" and expect fist 2 rows to be expanded, 3rd row to be collapsed then 4th row to have group total', () => {
cy.get('[data-test="group-duration-effort-percent-btn"]').click();
it('should "Group by Duration then Effort-Driven then Percent" and expect fist 2 rows to be expanded, 3rd row to be collapsed then 4th row to have group total', () => {
cy.get('[data-test="group-duration-effort-percent-btn"]').click();

cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"].slick-group-level-0 > .slick-cell:nth(0) .slick-group-toggle.expanded`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"].slick-group-level-0 > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 0');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"].slick-group-level-0 > .slick-cell:nth(0) .slick-group-toggle.expanded`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"].slick-group-level-0 > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 0');

cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"].slick-group-level-1 .slick-group-toggle.expanded`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"].slick-group-level-1 .slick-group-title`).should('contain', 'Effort-Driven: False');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"].slick-group-level-1 .slick-group-toggle.expanded`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"].slick-group-level-1 .slick-group-title`).should('contain', 'Effort-Driven: False');

cy.get(`[style="top: ${GRID_ROW_HEIGHT * 2}px;"].slick-group-level-2 .slick-group-toggle.collapsed`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 2}px;"].slick-group-level-2 .slick-group-title`).contains(/^% Complete: [0-9]/);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 2}px;"].slick-group-level-2 .slick-group-toggle.collapsed`).should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 2}px;"].slick-group-level-2 .slick-group-title`).contains(/^% Complete: [0-9]/);

cy.get(`[style="top: ${GRID_ROW_HEIGHT * 3}px;"].slick-group-totals.slick-group-level-2 .slick-cell:nth(3)`).contains(/^avg: [0-9]\%$/);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 3}px;"].slick-group-totals.slick-group-level-2`)
.find('.slick-cell:nth(3)').contains('avg: ');
});
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 3}px;"].slick-group-totals.slick-group-level-2 .slick-cell:nth(3)`).contains(/^avg: [0-9]%$/);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 3}px;"].slick-group-totals.slick-group-level-2`)
.find('.slick-cell:nth(3)').contains('avg: ');
});
});
});
Loading

0 comments on commit 4c233dd

Please sign in to comment.