Skip to content

Commit

Permalink
Merge branch 'main' into react19
Browse files Browse the repository at this point in the history
  • Loading branch information
amanmahajan7 authored Oct 8, 2024
2 parents 6954550 + 4c4af3d commit 97c7af2
Show file tree
Hide file tree
Showing 14 changed files with 77 additions and 25 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.js
*.json
*.css
/website/routeTree.gen.ts
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"[javascript][json][jsonc]": {
"[javascript][json][jsonc][css]": {
"editor.defaultFormatter": "biomejs.biome"
},
"typescript.enablePromptUseWorkspaceTsdk": true,
Expand Down
65 changes: 57 additions & 8 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@
}
},
"css": {
"linter": {
"enabled": false
},
"formatter": {
"enabled": false,
"indentStyle": "space"
"quoteStyle": "single"
}
},
"linter": {
Expand All @@ -48,6 +44,7 @@
"noDistractingElements": "warn",
"noHeaderScope": "warn",
"noInteractiveElementToNoninteractiveRole": "warn",
"noLabelWithoutControl": "off",
"noNoninteractiveElementToInteractiveRole": "warn",
"noNoninteractiveTabindex": "warn",
"noPositiveTabindex": "warn",
Expand All @@ -59,12 +56,15 @@
"useAriaActivedescendantWithTabindex": "warn",
"useAriaPropsForRole": "warn",
"useButtonType": "warn",
"useFocusableInteractive": "off",
"useGenericFontNames": "warn",
"useHeadingContent": "warn",
"useHtmlLang": "warn",
"useIframeTitle": "warn",
"useKeyWithClickEvents": "off",
"useKeyWithMouseEvents": "warn",
"useMediaCaption": "off",
"useSemanticElements": "off",
"useValidAnchor": "warn",
"useValidAriaProps": "warn",
"useValidAriaRole": "warn",
Expand All @@ -88,13 +88,16 @@
"noUselessLabel": "warn",
"noUselessLoneBlockStatements": "warn",
"noUselessRename": "warn",
"noUselessStringConcat": "warn",
"noUselessSwitchCase": "warn",
"noUselessTernary": "warn",
"noUselessThisAlias": "warn",
"noUselessTypeConstraint": "warn",
"noUselessUndefinedInitialization": "warn",
"noVoid": "warn",
"noWith": "warn",
"useArrowFunction": "warn",
"useDateNow": "warn",
"useFlatMap": "warn",
"useLiteralKeys": "warn",
"useOptionalChain": "warn",
Expand All @@ -113,24 +116,35 @@
"noFlatMapIdentity": "warn",
"noGlobalObjectCalls": "warn",
"noInnerDeclarations": "warn",
"noInvalidBuiltinInstantiation": "warn",
"noInvalidConstructorSuper": "warn",
"noInvalidDirectionInLinearGradient": "warn",
"noInvalidGridAreas": "warn",
"noInvalidNewBuiltin": "warn",
"noInvalidPositionAtImportRule": "warn",
"noInvalidUseBeforeDeclaration": "warn",
"noNewSymbol": "warn",
"noNodejsModules": "off",
"noNodejsModules": "warn",
"noNonoctalDecimalEscape": "warn",
"noPrecisionLoss": "warn",
"noRenderReturnValue": "warn",
"noSelfAssign": "warn",
"noSetterReturn": "warn",
"noStringCaseMismatch": "warn",
"noSwitchDeclarations": "warn",
"noUndeclaredDependencies": "warn",
"noUndeclaredVariables": "off",
"noUnknownFunction": "warn",
"noUnknownMediaFeatureName": "warn",
"noUnknownProperty": "warn",
"noUnknownUnit": "warn",
"noUnmatchableAnbSelector": "warn",
"noUnnecessaryContinue": "warn",
"noUnreachable": "warn",
"noUnreachableSuper": "warn",
"noUnsafeFinally": "warn",
"noUnsafeOptionalChaining": "warn",
"noUnusedFunctionParameters": "off",
"noUnusedImports": "warn",
"noUnusedLabels": "warn",
"noUnusedPrivateClassMembers": "warn",
Expand All @@ -140,6 +154,7 @@
"useArrayLiterals": "warn",
"useExhaustiveDependencies": "off",
"useHookAtTopLevel": "warn",
"useImportExtensions": "off",
"useIsNan": "warn",
"useJsxKeyInIterable": "off",
"useValidForDirection": "warn",
Expand All @@ -149,7 +164,8 @@
"noAccumulatingSpread": "warn",
"noBarrelFile": "off",
"noDelete": "warn",
"noReExportAll": "off"
"noReExportAll": "off",
"useTopLevelRegex": "warn"
},
"security": {
"noDangerouslySetInnerHtml": "warn",
Expand All @@ -160,6 +176,7 @@
"noArguments": "warn",
"noCommaOperator": "warn",
"noDefaultExport": "off",
"noDoneCallback": "warn",
"noImplicitBoolean": "off",
"noInferrableTypes": "warn",
"noNamespace": "warn",
Expand All @@ -173,13 +190,17 @@
"noUnusedTemplateLiteral": "warn",
"noUselessElse": "warn",
"noVar": "warn",
"noYodaExpression": "warn",
"useAsConstAssertion": "warn",
"useBlockStatements": "off",
"useCollapsedElseIf": "warn",
"useConsistentArrayType": "warn",
"useConsistentBuiltinInstantiation": "warn",
"useConst": "warn",
"useDefaultParameterLast": "off",
"useDefaultSwitchClause": "warn",
"useEnumInitializers": "warn",
"useExplicitLengthCheck": "off",
"useExponentiationOperator": "warn",
"useExportType": "warn",
"useFilenamingConvention": "off",
Expand All @@ -199,32 +220,40 @@
"useSingleCaseStatement": "off",
"useSingleVarDeclarator": "warn",
"useTemplate": "warn",
"useThrowNewError": "warn",
"useThrowOnlyError": "warn",
"useWhile": "warn"
},
"suspicious": {
"noApproximativeNumericConstant": "warn",
"noArrayIndexKey": "off",
"noAssignInExpressions": "off",
"noAssignInExpressions": "warn",
"noAsyncPromiseExecutor": "warn",
"noCatchAssign": "warn",
"noClassAssign": "warn",
"noCommentText": "warn",
"noCompareNegZero": "warn",
"noConfusingLabels": "warn",
"noConfusingVoidType": "warn",
"noConsole": "warn",
"noConsoleLog": "warn",
"noConstEnum": "warn",
"noControlCharactersInRegex": "warn",
"noDebugger": "warn",
"noDoubleEquals": "warn",
"noDuplicateAtImportRules": "warn",
"noDuplicateCase": "warn",
"noDuplicateClassMembers": "warn",
"noDuplicateFontNames": "warn",
"noDuplicateJsxProps": "warn",
"noDuplicateObjectKeys": "warn",
"noDuplicateParameters": "warn",
"noDuplicateSelectorsKeyframeBlock": "warn",
"noDuplicateTestHooks": "warn",
"noEmptyBlock": "warn",
"noEmptyBlockStatements": "off",
"noEmptyInterface": "warn",
"noEvolvingTypes": "off",
"noExplicitAny": "off",
"noExportsInTest": "warn",
"noExtraNonNullAssertion": "warn",
Expand All @@ -236,15 +265,19 @@
"noGlobalIsNan": "warn",
"noImplicitAnyLet": "off",
"noImportAssign": "warn",
"noImportantInKeyframe": "warn",
"noLabelVar": "warn",
"noMisleadingCharacterClass": "warn",
"noMisleadingInstantiator": "warn",
"noMisplacedAssertion": "off",
"noMisrefactoredShorthandAssign": "warn",
"noPrototypeBuiltins": "warn",
"noReactSpecificProps": "off",
"noRedeclare": "warn",
"noRedundantUseStrict": "warn",
"noSelfCompare": "warn",
"noShadowRestrictedNames": "warn",
"noShorthandPropertyOverrides": "warn",
"noSkippedTests": "warn",
"noSparseArray": "warn",
"noSuspiciousSemicolonInJsx": "warn",
Expand All @@ -253,9 +286,11 @@
"noUnsafeNegation": "warn",
"useAwait": "warn",
"useDefaultSwitchClauseLast": "warn",
"useErrorMessage": "warn",
"useGetterReturn": "warn",
"useIsArray": "warn",
"useNamespaceKeyword": "warn",
"useNumberToFixedDigitsArgument": "warn",
"useValidTypeof": "warn"
}
}
Expand All @@ -264,11 +299,25 @@
"enabled": false
},
"overrides": [
{
"include": ["**/*.test.*"],
"linter": {
"rules": {
"performance": {
"useTopLevelRegex": "off"
}
}
}
},
{
"include": ["**/*.js"],
"linter": {
"rules": {
"correctness": {
"noNodejsModules": "off"
},
"suspicious": {
"noConsole": "off",
"noConsoleLog": "off"
}
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@babel/runtime": "^7.21.5",
"@biomejs/biome": "1.8.3",
"@biomejs/biome": "1.9.3",
"@eslint/compat": "^1.1.1",
"@faker-js/faker": "^9.0.0",
"@ianvs/prettier-plugin-sort-imports": "^4.0.2",
Expand All @@ -86,6 +86,7 @@
"@wyw-in-js/rollup": "^0.5.0",
"@wyw-in-js/vite": "^0.5.0",
"babel-plugin-optimize-clsx": "^2.6.2",
"browserslist": "^4.24.0",
"eslint": "^9.11.1",
"eslint-plugin-jest-dom": "^5.0.1",
"eslint-plugin-react": "^7.36.1",
Expand Down
3 changes: 2 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import nodeResolve from '@rollup/plugin-node-resolve';
import pkg from './package.json' with { type: 'json' };

const extensions = ['.ts', '.tsx'];
const annotationRegexp = /^[@#]__.+__$/;

export default {
input: './src/index.ts',
Expand Down Expand Up @@ -42,7 +43,7 @@ export default {
// remove all comments except terser annotations
// https://github.com/terser/terser#annotations
// https://babeljs.io/docs/en/options#shouldprintcomment
shouldPrintComment: (comment) => /^[@#]__.+__$/.test(comment)
shouldPrintComment: (comment) => annotationRegexp.test(comment)
}),
nodeResolve({ extensions })
]
Expand Down
2 changes: 1 addition & 1 deletion test/browser/column/colSpan.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('colSpan', () => {
function setupColSpanGrid(colCount = 15) {
type Row = number;
const columns: Column<Row, Row>[] = [];
const rows: readonly Row[] = [...Array(10).keys()];
const rows: readonly Row[] = Array.from({ length: 10 }, (_, i) => i);

for (let i = 0; i < colCount; i++) {
const key = String(i);
Expand Down
8 changes: 4 additions & 4 deletions test/browser/keyboardNavigation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {

type Row = undefined;

const rows: readonly Row[] = Array(100);
const rows: readonly Row[] = new Array(100);
const topSummaryRows: readonly Row[] = [undefined];
const bottomSummaryRows: readonly Row[] = [undefined, undefined];

Expand Down Expand Up @@ -129,7 +129,7 @@ test('arrow and tab navigation', async () => {
});

test('grid enter/exit', async () => {
setup({ columns, rows: Array(5), bottomSummaryRows });
setup({ columns, rows: new Array(5), bottomSummaryRows });

// no initial selection
expect(getSelectedCell()).not.toBeInTheDocument();
Expand Down Expand Up @@ -168,7 +168,7 @@ test('grid enter/exit', async () => {
});

test('navigation with focusable cell renderer', async () => {
setup({ columns, rows: Array(1), bottomSummaryRows });
setup({ columns, rows: new Array(1), bottomSummaryRows });
await userEvent.tab();
await userEvent.keyboard('{arrowdown}');
validateCellPosition(0, 1);
Expand Down Expand Up @@ -209,7 +209,7 @@ test('navigation when header and summary rows have focusable elements', async ()
}
];

setup({ columns, rows: Array(2), bottomSummaryRows });
setup({ columns, rows: new Array(2), bottomSummaryRows });
await userEvent.tab();

// should set focus on the header filter
Expand Down
2 changes: 1 addition & 1 deletion test/browser/rowHeight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type Row = number;

function setupGrid(rowHeight: DataGridProps<Row>['rowHeight']) {
const columns: Column<Row>[] = [];
const rows: readonly Row[] = [...Array(50).keys()];
const rows: readonly Row[] = Array.from({ length: 50 }, (_, i) => i);

for (let i = 0; i < 5; i++) {
const key = String(i);
Expand Down
2 changes: 1 addition & 1 deletion test/browser/scrollToCell.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getGrid } from './utils';

type Row = undefined;

const rows: readonly Row[] = Array(50);
const rows: readonly Row[] = new Array(50);
const summaryRows: readonly Row[] = [undefined, undefined];

const columns: Column<Row, Row>[] = [];
Expand Down
6 changes: 3 additions & 3 deletions test/browser/virtualization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ function setupGrid(
summaryRowCount = 0
) {
const columns: Column<unknown>[] = [];
const rows = Array(rowCount);
const topSummaryRows = Array(summaryRowCount).fill(null);
const bottomSummaryRows = Array(summaryRowCount).fill(null);
const rows = new Array(rowCount);
const topSummaryRows = new Array(summaryRowCount).fill(null);
const bottomSummaryRows = new Array(summaryRowCount).fill(null);

for (let i = 0; i < columnCount; i++) {
const key = String(i);
Expand Down
2 changes: 1 addition & 1 deletion website/routes/ColumnSpanning.lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const Route = createLazyFileRoute('/ColumnSpanning')({
});

type Row = number;
const rows: readonly Row[] = [...Array(100).keys()];
const rows: readonly Row[] = Array.from({ length: 100 }, (_, i) => i);

const colSpanClassname = css`
background-color: #ffb300;
Expand Down
2 changes: 1 addition & 1 deletion website/routes/MillionCells.lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const Route = createLazyFileRoute('/MillionCells')({
});

type Row = number;
const rows: readonly Row[] = [...Array(1000).keys()];
const rows: readonly Row[] = Array.from({ length: 1000 }, (_, i) => i);

function MillionCells() {
const direction = useDirection();
Expand Down
2 changes: 1 addition & 1 deletion website/routes/ResizableGrid.lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const Route = createLazyFileRoute('/ResizableGrid')({
});

type Row = number;
const rows: readonly Row[] = [...Array(100).keys()];
const rows: readonly Row[] = Array.from({ length: 100 }, (_, i) => i);

const columns: Column<Row>[] = [];

Expand Down
2 changes: 1 addition & 1 deletion website/routes/VariableRowHeight.lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const Route = createLazyFileRoute('/VariableRowHeight')({
});

type Row = number;
const rows: readonly Row[] = [...Array(500).keys()];
const rows: readonly Row[] = Array.from({ length: 500 }, (_, i) => i);

function VariableRowHeight() {
const direction = useDirection();
Expand Down

0 comments on commit 97c7af2

Please sign in to comment.