Skip to content

Commit

Permalink
chore(react-virtualized-extension): resolved linter errors (patternfl…
Browse files Browse the repository at this point in the history
…y#3726)

* chore(react-virtualized-extension): resolved linter errors

* updated circleci caching

* resolved PR feedback

* removed no-var-requires and no-use-before-define inline comments
  • Loading branch information
evwilkin authored Feb 17, 2020
1 parent 00ea696 commit ed6e1d1
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ references:
build_cache_key: &build_cache_key
build-cache-v{{.Environment.CACHE_VERSION}}-{{checksum "yarn.lock"}}
lint_cache_key: &lint_cache_key
lint-cache-v{{.Environment.CACHE_VERSION}}
lint-cache-v{{.Environment.CACHE_VERSION}}-{{checksum "package.json"}}
attach_workspace: &attach_workspace
attach_workspace:
at: ~/project
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"generate": "yarn plop",
"lint:md": "yarn eslint packages/patternfly-4 --ext md --no-eslintrc --config .eslintrc-md.json --cache",
"lint:style": "stylelint \"**/sass/**/*.scss\" \"!**/dist/**/*.scss\"",
"lint:ts": "node --max-old-space-size=4096 node_modules/.bin/eslint packages/patternfly-4/react-core packages/patternfly-4/react-table packages/patternfly-4/react-topology packages/patternfly-4/react-catalog-view-extension packages/patternfly-4/react-docs packages/patternfly-4/react-inline-edit-extension packages/patternfly-4/react-charts packages/patternfly-4/react-integration packages/patternfly-4/react-styled-system packages/patternfly-4/react-styles packages/patternfly-4/react-tokens --ext js,jsx,ts,tsx --cache",
"lint:ts": "node --max-old-space-size=4096 node_modules/.bin/eslint packages/patternfly-4/react-core packages/patternfly-4/react-table packages/patternfly-4/react-topology packages/patternfly-4/react-catalog-view-extension packages/patternfly-4/react-docs packages/patternfly-4/react-inline-edit-extension packages/patternfly-4/react-charts packages/patternfly-4/react-integration packages/patternfly-4/react-styled-system packages/patternfly-4/react-styles packages/patternfly-4/react-tokens packages/patternfly-4/react-virtualized-extension --ext js,jsx,ts,tsx --cache",
"lint:versions": "node ./packages/patternfly-4/verifyCoreVersions.js",
"prettier": "node node_modules/.bin/prettier --write \"storybook/**/*.{js,ts,tsx}\" \"packages/**/*.{js,ts,tsx}\" \"scripts/**/*.{js,ts,tsx}\"",
"serve:docs": "lerna run serve",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import * as React from 'react';
import clsx from 'clsx';
import { mount } from 'enzyme';
import {
Table,
TableHeader,
sortable
} from '@patternfly/react-table';
import { Table, TableHeader, sortable } from '@patternfly/react-table';
import { VirtualTableBody } from './index';
import { rows, columns, actions } from '@patternfly/react-table/src/test-helpers/data-sets';
import { CellMeasurerCache, CellMeasurer } from 'react-virtualized';
import { CellMeasurerCache } from 'react-virtualized';

const measurementCache = new CellMeasurerCache({
fixedWidth: true,
Expand All @@ -17,7 +14,7 @@ const measurementCache = new CellMeasurerCache({
});

describe('Simple virtualized table', () => {
const rowRenderer = ( index: number , isVisible: boolean ) => {
const rowRenderer = (index: number, isVisible: boolean) => {
const text = rows[index].cells[0];

const className = clsx({
Expand Down Expand Up @@ -67,7 +64,7 @@ describe('Simple virtualized table', () => {
});

test('Sortable Virtualized Table', () => {
const rowRenderer = ( index: number , isVisible: boolean ) => {
const rowRenderer = (index: number, isVisible: boolean) => {
const text = rows[index].cells[0];

const className = clsx({
Expand Down Expand Up @@ -96,7 +93,7 @@ test('Sortable Virtualized Table', () => {
});

test('Simple Actions table', () => {
const rowRenderer = ( index: number , isVisible: boolean ) => {
const rowRenderer = (index: number, isVisible: boolean) => {
const text = rows[index].cells[0];

const className = clsx({
Expand Down Expand Up @@ -133,7 +130,7 @@ test('Simple Actions table', () => {
});

test('Actions virtualized table', () => {
const rowRenderer = ( index: number , isVisible: boolean ) => {
const rowRenderer = (index: number, isVisible: boolean) => {
const text = rows[index].cells[0];

const className = clsx({
Expand Down Expand Up @@ -168,7 +165,7 @@ test('Actions virtualized table', () => {
});

test('Selectable virtualized table', () => {
const rowRenderer = ( index: number , isVisible: boolean ) => {
const rowRenderer = (index: number, isVisible: boolean) => {
const text = rows[index].cells[0];

const className = clsx({
Expand All @@ -180,7 +177,7 @@ test('Selectable virtualized table', () => {
const view = mount(
<Table aria-label="Aria labeled" onSelect={onSelect} cells={columns} rows={rows}>
<TableHeader />
{( width: number ) => (
{(width: number) => (
<VirtualTableBody
height={400}
rowCount={rows.length}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export const SCROLL_DIRECTION_VERTICAL = 'vertical';
* This function ensures that overscanning doesn't exceed the available cells.
*/

/**
*
*/
export default function defaultOverscanIndicesGetter({
cellCount,
overscanCellsCount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export const SCROLL_DIRECTION_VERTICAL = 'vertical';
* This function ensures that overscanning doesn't exceed the available cells.
*/

/**
*
*/
export default function defaultOverscanIndicesGetter({
cellCount,
overscanCellsCount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ interface Params<T> {
updateScrollOffsetForScrollToIndex: () => void;
}

/**
*
*/
export default function calculateSizeAndPositionDataAndUpdateScrollOffset({
cellCount,
cellSize,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/**
* Helper utility that updates the specified callback whenever any of the specified indices have changed.
*
* @param {boolean} requireAllKeys - Require all keys
*/
export default function createCallbackMemoizer(requireAllKeys = true) {
let cachedIndices: any = {};

return ({callback, indices }: { callback: any, indices: any}) => {
return ({ callback, indices }: { callback: any; indices: any }) => {
const keys = Object.keys(indices);
const allInitialized =
!requireAllKeys ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ export const cancelAnimationTimeout: any = (frame: { id: any }) => caf(frame.id)
* When the delay time has been reached the function you're timing out will be called.
*
* Credit: Joe Lambert (https://gist.github.com/joelambert/1002116#file-requesttimeout-js)
*
* @param {any} callback - callback
* @param {number} delay - delay number
*/
export const requestAnimationTimeout = (callback: any, delay: number) => {
let start: any;
// wait for end of processing current event handler, because event handler may be long
// eslint-disable-next-line no-undef
Promise.resolve().then(() => {
start = Date.now();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ interface Params {
updateScrollIndexCallback: (index: number) => void;
}

/**
*
*/
export default function updateScrollIndexHelper({
cellSize,
cellSizeAndPositionManager,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
declare module 'linear-layout-vector';
declare module 'linear-layout-vector';

0 comments on commit ed6e1d1

Please sign in to comment.