Skip to content
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
4 changes: 3 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ env:
es2022: true
extends:
- plugin:react/recommended
- plugin:react-hooks/recommended
- plugin:import/recommended
- plugin:prettier/recommended
plugins:
- prefer-arrow
- react-hooks
settings:
react:
version: detect
Expand Down Expand Up @@ -143,8 +143,10 @@ overrides:
- files:
- '*.stories.tsx'
extends:
- 'plugin:react/jsx-runtime'
- 'plugin:storybook/recommended'
rules:
'react/prop-types': 'off' # inline custom components within stories don't need prop types
'@typescript-eslint/no-unused-vars': 'warn' # some samples can include unused vars to show the API / signature
'react/no-unescaped-entities': 'off'
'react-hooks/rules-of-hooks': 'off' # the CSF-3 render() functions are not detected as react components
3 changes: 2 additions & 1 deletion packages/base/src/hooks/useIsomorphicId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function useIsomorphicId(): string {
return Reflect.get(React, 'useId')();
}

const localId = useRef(getRandomId());
// eslint-disable-next-line react-hooks/rules-of-hooks
const localId = useRef(getRandomId()); // React version never changes at runtime
return localId.current;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const columnsDeps = (
) => {
const isLoadingPlaceholder = !data?.length && webComponentsReactProperties.loading;
const hasRows = rows?.length > 0;
// eslint-disable-next-line react-hooks/rules-of-hooks
const colsEqual = useMemo(() => {
return visibleColumns
?.filter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const setFocus = (currentlyFocusedCell, nextElement) => {
}
};

const getTableProps = (tableProps, { instance: { webComponentsReactProperties, data, columns } }) => {
const useGetTableProps = (tableProps, { instance: { webComponentsReactProperties, data, columns } }) => {
const { showOverlay, tableRef } = webComponentsReactProperties;
const currentlyFocusedCell = useRef<HTMLDivElement>(null);
const noData = data.length === 0;
Expand Down Expand Up @@ -294,5 +294,5 @@ const getTableProps = (tableProps, { instance: { webComponentsReactProperties, d
};

export const useKeyboardNavigation = (hooks) => {
hooks.getTableProps.push(getTableProps);
hooks.getTableProps.push(useGetTableProps);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const useSelectionChangeCallback = (hooks) => {
hooks.useControlledState.push((state, { instance }) => {
const { selectedRowPayload, selectedRowIds } = state;
const { rowsById, preFilteredRowsById, webComponentsReactProperties, dispatch, filters } = instance;
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
if (selectedRowPayload?.fired) {
const { event: e, row: selRow } = selectedRowPayload;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useEffect } from 'react';
*/
export const useManualRowSelect = (manualRowSelectedKey = 'isSelected') => {
const instanceAfterData = ({ flatRows, toggleRowSelected }) => {
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
flatRows.forEach(({ id, original }) => {
if (manualRowSelectedKey in original) {
Expand Down
Loading