{
let cellContent;
try {
- let render = column.onRender || onRenderItemColumn;
+ const render = column.onRender || onRenderItemColumn;
cellContent = render ? render(item, itemIndex, column) : this._getCellText(item, column);
} catch (e) { /* no-op */ }
diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Advanced.Example.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Advanced.Example.tsx
index b350a86bfbac66..c232112266b74c 100644
--- a/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Advanced.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Advanced.Example.tsx
@@ -86,7 +86,7 @@ export class DetailsListAdvancedExample extends React.Component<{}, IDetailsList
}
public render() {
- let {
+ const {
checkboxVisibility,
columns,
constrainMode,
@@ -99,8 +99,8 @@ export class DetailsListAdvancedExample extends React.Component<{}, IDetailsList
selectionMode
} = this.state;
- let isGrouped = groups && groups.length > 0;
- let groupProps = {
+ const isGrouped = groups && groups.length > 0;
+ const groupProps = {
getGroupItemLimit: (group: IGroup) => {
if (group) {
return group.isShowingAll ? group.count : Math.min(group.count, groupItemLimit as number);
@@ -159,7 +159,7 @@ export class DetailsListAdvancedExample extends React.Component<{}, IDetailsList
setTimeout(() => {
this._isFetchingItems = false;
- let itemsCopy = ([] as any[]).concat(this.state.items);
+ const itemsCopy = ([] as any[]).concat(this.state.items);
itemsCopy.splice.apply(itemsCopy, [index, PAGING_SIZE].concat(_items.slice(index, index + PAGING_SIZE)));
@@ -190,7 +190,8 @@ export class DetailsListAdvancedExample extends React.Component<{}, IDetailsList
@autobind
private _onToggleResizing() {
- let { items, canResizeColumns, sortedColumnKey, isSortedDescending } = this.state;
+ const { items, sortedColumnKey, isSortedDescending } = this.state;
+ let { canResizeColumns } = this.state;
canResizeColumns = !canResizeColumns;
@@ -233,7 +234,7 @@ export class DetailsListAdvancedExample extends React.Component<{}, IDetailsList
}
private _getCommandItems(): IContextualMenuItem[] {
- let {
+ const {
canResizeColumns,
checkboxVisibility,
constrainMode,
@@ -404,7 +405,7 @@ export class DetailsListAdvancedExample extends React.Component<{}, IDetailsList
}
private _getContextualMenuProps(ev: React.MouseEvent
, column: IColumn): IContextualMenuProps {
- let items = [
+ const items = [
{
key: 'aToZ',
name: 'A to Z',
@@ -482,7 +483,7 @@ export class DetailsListAdvancedExample extends React.Component<{}, IDetailsList
@autobind
private _onSortColumn(key: string, isSortedDescending: boolean) {
- let sortedItems = _items.slice(0).sort((a: any, b: any) => (isSortedDescending ? a[key] < b[key] : a[key] > b[key]) ? 1 : -1);
+ const sortedItems = _items.slice(0).sort((a: any, b: any) => (isSortedDescending ? a[key] < b[key] : a[key] > b[key]) ? 1 : -1);
this.setState({
items: sortedItems,
@@ -502,8 +503,8 @@ export class DetailsListAdvancedExample extends React.Component<{}, IDetailsList
@autobind
private _onGroupByColumn(column: IColumn) {
- let { key, isGrouped } = column;
- let { sortedColumnKey, isSortedDescending, groups, items, columns } = this.state;
+ const { key, isGrouped } = column;
+ const { sortedColumnKey, isSortedDescending, groups, items, columns } = this.state;
if (isGrouped) { // ungroup
this._onSortColumn(sortedColumnKey as string, !!isSortedDescending);
@@ -518,7 +519,7 @@ export class DetailsListAdvancedExample extends React.Component<{}, IDetailsList
newGroups = this._getGroups(groupedItems, key);
}
- let newColumns = columns as IColumn[];
+ const newColumns = columns as IColumn[];
newColumns.filter(matchColumn => matchColumn.key === key).forEach((groupedColumn: IColumn) => {
groupedColumn.isGrouped = true;
});
@@ -535,11 +536,11 @@ export class DetailsListAdvancedExample extends React.Component<{}, IDetailsList
if (groups) {
groups.forEach((group: IGroup) => {
if (group.children && group.children.length > 0) {
- let childGroupedItems = this._groupByKey(group.children, items, key);
+ const childGroupedItems = this._groupByKey(group.children, items, key);
groupedItems = groupedItems.concat(childGroupedItems);
} else {
- let itemsInGroup = items.slice(group.startIndex, group.startIndex + group.count);
- let nextLevelGroupedItems = this._groupItems(itemsInGroup, key);
+ const itemsInGroup = items.slice(group.startIndex, group.startIndex + group.count);
+ const nextLevelGroupedItems = this._groupItems(itemsInGroup, key);
groupedItems = groupedItems.concat(nextLevelGroupedItems);
group.children = this._getGroups(nextLevelGroupedItems, key, group);
}
@@ -553,9 +554,9 @@ export class DetailsListAdvancedExample extends React.Component<{}, IDetailsList
}
private _getGroups(groupedItems: any[], key: string, parentGroup?: IGroup): IGroup[] {
- let separator = '-';
- let groups = groupedItems.reduce((current, item, index) => {
- let currentGroup = current[current.length - 1];
+ const separator = '-';
+ const groups = groupedItems.reduce((current, item, index) => {
+ const currentGroup = current[current.length - 1];
if (!currentGroup || (this._getLeafGroupKey(currentGroup.key, separator) !== item[key])) {
current.push({
@@ -577,7 +578,7 @@ export class DetailsListAdvancedExample extends React.Component<{}, IDetailsList
private _getLeafGroupKey(key: string, separator: string): string {
let leafKey = key;
if (key.indexOf(separator) !== -1) {
- let arrKeys = key.split(separator);
+ const arrKeys = key.split(separator);
leafKey = arrKeys[arrKeys.length - 1];
}
return leafKey;
@@ -605,7 +606,7 @@ export class DetailsListAdvancedExample extends React.Component<{}, IDetailsList
isSortedDescending?: boolean,
groupedColumnKey?: string,
onColumnContextMenu?: (column: IColumn, ev: React.MouseEvent) => any) {
- let columns = buildColumns(items, canResizeColumns, onColumnClick, sortedColumnKey, isSortedDescending, groupedColumnKey);
+ const columns = buildColumns(items, canResizeColumns, onColumnClick, sortedColumnKey, isSortedDescending, groupedColumnKey);
columns.forEach(column => {
column.onColumnContextMenu = onColumnContextMenu;
diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Basic.Example.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Basic.Example.tsx
index f121a24db19081..593a874f99882e 100644
--- a/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Basic.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Basic.Example.tsx
@@ -11,9 +11,9 @@ import {
import { MarqueeSelection } from 'office-ui-fabric-react/lib/MarqueeSelection';
import { autobind } from 'office-ui-fabric-react/lib/Utilities';
-let _items: any[] = [];
+const _items: any[] = [];
-let _columns: IColumn[] = [
+const _columns: IColumn[] = [
{
key: 'column1',
name: 'Name',
@@ -65,7 +65,7 @@ export class DetailsListBasicExample extends React.Component<{}, {
}
public render() {
- let { items, selectionDetails } = this.state;
+ const { items, selectionDetails } = this.state;
return (
@@ -92,7 +92,7 @@ export class DetailsListBasicExample extends React.Component<{}, {
}
private _getSelectionDetails(): string {
- let selectionCount = this._selection.getSelectedCount();
+ const selectionCount = this._selection.getSelectedCount();
switch (selectionCount) {
case 0:
diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Compact.Example.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Compact.Example.tsx
index 26c9b2f1fe04e7..b47e35d658b9a3 100644
--- a/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Compact.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Compact.Example.tsx
@@ -10,13 +10,13 @@ import {
import { MarqueeSelection } from 'office-ui-fabric-react/lib/MarqueeSelection';
import { autobind } from 'office-ui-fabric-react/lib/Utilities';
-let _items: {
+const _items: {
key: number,
name: string,
value: number
}[] = [];
-let _columns = [
+const _columns = [
{
key: 'column1',
name: 'Name',
@@ -66,7 +66,7 @@ export class DetailsListCompactExample extends React.Component<{}, {
}
public render() {
- let { items, selectionDetails } = this.state;
+ const { items, selectionDetails } = this.state;
return (
@@ -92,7 +92,7 @@ export class DetailsListCompactExample extends React.Component<{}, {
}
private _getSelectionDetails(): string {
- let selectionCount = this._selection.getSelectedCount();
+ const selectionCount = this._selection.getSelectedCount();
switch (selectionCount) {
case 0:
diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.CustomColumns.Example.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.CustomColumns.Example.tsx
index a798064e9bdc63..ad411d2bca0480 100644
--- a/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.CustomColumns.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.CustomColumns.Example.tsx
@@ -32,7 +32,7 @@ export class DetailsListCustomColumnsExample extends React.Component<{}, IDetail
}
public render() {
- let { sortedItems, columns } = this.state;
+ const { sortedItems, columns } = this.state;
return (
, column: IColumn) {
- let { sortedItems, columns } = this.state;
+ const { columns } = this.state;
+ let { sortedItems } = this.state;
let isSortedDescending = column.isSortedDescending;
// If we've sorted this column, flip it.
@@ -59,8 +60,8 @@ export class DetailsListCustomColumnsExample extends React.Component<{}, IDetail
// Sort the items.
sortedItems = sortedItems!.concat([]).sort((a, b) => {
- let firstValue = a[column.fieldName];
- let secondValue = b[column.fieldName];
+ const firstValue = a[column.fieldName];
+ const secondValue = b[column.fieldName];
if (isSortedDescending) {
return firstValue > secondValue ? -1 : 1;
@@ -94,9 +95,9 @@ export class DetailsListCustomColumnsExample extends React.Component<{}, IDetail
}
function _buildColumns() {
- let columns = buildColumns(_items);
+ const columns = buildColumns(_items);
- let thumbnailColumn = columns.filter(column => column.name === 'thumbnail')[0];
+ const thumbnailColumn = columns.filter(column => column.name === 'thumbnail')[0];
// Special case one column's definition.
thumbnailColumn.name = '';
@@ -106,7 +107,7 @@ function _buildColumns() {
}
function _renderItemColumn(item: any, index: number, column: IColumn) {
- let fieldContent = item[column.fieldName];
+ const fieldContent = item[column.fieldName];
switch (column.key) {
case 'thumbnail':
diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Documents.Example.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Documents.Example.tsx
index 051671e1bce062..3be99fc94d1d30 100644
--- a/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Documents.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Documents.Example.tsx
@@ -204,7 +204,7 @@ export class DetailsListDocumentsExample extends React.Component
@@ -297,7 +297,7 @@ export class DetailsListDocumentsExample extends React.Component, column: IColumn) {
const { columns, items } = this.state;
let newItems: IDocument[] = items.slice();
- let newColumns: IColumn[] = columns.slice();
- let currColumn: IColumn = newColumns.filter((currCol: IColumn, idx: number) => {
+ const newColumns: IColumn[] = columns.slice();
+ const currColumn: IColumn = newColumns.filter((currCol: IColumn, idx: number) => {
return column.key === currCol.key;
})[0];
newColumns.forEach((newCol: IColumn) => {
diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.DragDrop.Example.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.DragDrop.Example.tsx
index 71ae50aadd449f..1322754b5bd7d6 100644
--- a/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.DragDrop.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.DragDrop.Example.tsx
@@ -34,7 +34,7 @@ export class DetailsListDragDropExample extends React.Component<{}, {
}
public render() {
- let { items, selectionDetails } = this.state;
+ const { items, selectionDetails } = this.state;
return (
@@ -89,9 +89,9 @@ export class DetailsListDragDropExample extends React.Component<{}, {
}
private _insertBeforeItem(item: any) {
- let draggedItems = this._selection.isIndexSelected(_draggedIndex) ? this._selection.getSelection() : [_draggedItem];
+ const draggedItems = this._selection.isIndexSelected(_draggedIndex) ? this._selection.getSelection() : [_draggedItem];
- let items: any[] = this.state.items.filter((i: number) => draggedItems.indexOf(i) === -1);
+ const items: any[] = this.state.items.filter((i: number) => draggedItems.indexOf(i) === -1);
let insertIndex = items.indexOf(item);
// if dragging/dropping on itself, index will be 0.
diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Grouped.Example.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Grouped.Example.tsx
index c68af796cf07e3..4bd594fa936f14 100644
--- a/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Grouped.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.Grouped.Example.tsx
@@ -5,7 +5,7 @@ import { DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { Fabric } from 'office-ui-fabric-react/lib/Fabric';
import { DetailsList } from 'office-ui-fabric-react/lib/DetailsList';
-let _columns = [
+const _columns = [
{
key: 'name',
name: 'Name',
@@ -22,7 +22,7 @@ let _columns = [
maxWidth: 200
}
];
-let _items = [
+const _items = [
{
key: 'a',
name: 'a',
@@ -62,7 +62,7 @@ export class DetailsListGroupedExample extends React.Component<{}, {
}
public render() {
- let { items } = this.state;
+ const { items } = this.state;
return (
@@ -104,7 +104,7 @@ export class DetailsListGroupedExample extends React.Component<{}, {
}
private _addItem() {
- let items = this.state.items;
+ const items = this.state.items;
this.setState({
items: items.concat([{
diff --git a/packages/office-ui-fabric-react/src/components/Dialog/Dialog.test.tsx b/packages/office-ui-fabric-react/src/components/Dialog/Dialog.test.tsx
index 03ba9f6bdd4c09..5c2e5ac89d2b0e 100644
--- a/packages/office-ui-fabric-react/src/components/Dialog/Dialog.test.tsx
+++ b/packages/office-ui-fabric-react/src/components/Dialog/Dialog.test.tsx
@@ -14,7 +14,7 @@ import { DialogType } from './DialogContent.types';
describe('Dialog', () => {
it('renders Dialog correctly', () => {
const component = renderer.create();
- let tree = component.toJSON();
+ const tree = component.toJSON();
expect(tree).toMatchSnapshot();
});
diff --git a/packages/office-ui-fabric-react/src/components/Dialog/Dialog.tsx b/packages/office-ui-fabric-react/src/components/Dialog/Dialog.tsx
index 3e5f14f800c77f..c1df3309491007 100644
--- a/packages/office-ui-fabric-react/src/components/Dialog/Dialog.tsx
+++ b/packages/office-ui-fabric-react/src/components/Dialog/Dialog.tsx
@@ -59,7 +59,7 @@ export class Dialog extends BaseComponent {
}
public render() {
- let {
+ const {
elementToFocusOnDismiss,
firstFocusableSelector,
forceFocusInsideTrap,
@@ -123,7 +123,7 @@ export class Dialog extends BaseComponent {
}
private _getSubTextId = (): string | undefined => {
- let { ariaDescribedById, modalProps, dialogContentProps, subText } = this.props;
+ const { ariaDescribedById, modalProps, dialogContentProps, subText } = this.props;
let id = ariaDescribedById || (modalProps && modalProps.subtitleAriaId);
if (!id) {
@@ -134,7 +134,7 @@ export class Dialog extends BaseComponent {
}
private _getTitleTextId = (): string | undefined => {
- let { ariaLabelledById, modalProps, dialogContentProps, title } = this.props;
+ const { ariaLabelledById, modalProps, dialogContentProps, title } = this.props;
let id = ariaLabelledById || (modalProps && modalProps.titleAriaId);
if (!id) {
diff --git a/packages/office-ui-fabric-react/src/components/Dialog/DialogContent.tsx b/packages/office-ui-fabric-react/src/components/Dialog/DialogContent.tsx
index 321c696b7f7f44..59aa872b81f143 100644
--- a/packages/office-ui-fabric-react/src/components/Dialog/DialogContent.tsx
+++ b/packages/office-ui-fabric-react/src/components/Dialog/DialogContent.tsx
@@ -25,7 +25,7 @@ export class DialogContent extends BaseComponent {
}
public render() {
- let {
+ const {
showCloseButton,
closeButtonAriaLabel,
onDismiss,
@@ -36,7 +36,7 @@ export class DialogContent extends BaseComponent {
type
} = this.props;
- let groupings = this._groupChildren();
+ const groupings = this._groupChildren();
let subTextContent;
if (subText) {
subTextContent = { subText }
;
@@ -84,7 +84,7 @@ export class DialogContent extends BaseComponent {
// "Neither type 'ReactElement' nor type 'DialogFooter' is assignable to the other."
private _groupChildren(): { footers: any[]; contents: any[]; } {
- let groupings: { footers: any[]; contents: any[]; } = {
+ const groupings: { footers: any[]; contents: any[]; } = {
footers: [],
contents: []
};
diff --git a/packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.test.tsx b/packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.test.tsx
index 391ba31a71bf3f..b8955e180c98bb 100644
--- a/packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.test.tsx
+++ b/packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.test.tsx
@@ -23,7 +23,7 @@ describe('DocumentCard', () => {
}
/>
);
- let tree = component.toJSON();
+ const tree = component.toJSON();
expect(tree).toMatchSnapshot();
});
});
\ No newline at end of file
diff --git a/packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.tsx b/packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.tsx
index dd381c1aa22caa..f04eaa7838f4a1 100644
--- a/packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.tsx
+++ b/packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.tsx
@@ -23,8 +23,8 @@ export class DocumentCard extends BaseComponent {
}
public render() {
- let { onClick, onClickHref, children, className, type, accentColor } = this.props;
- let actionable = (onClick || onClickHref) ? true : false;
+ const { onClick, onClickHref, children, className, type, accentColor } = this.props;
+ const actionable = (onClick || onClickHref) ? true : false;
// Override the border color if an accent color was provided (compact card only)
let style;
@@ -35,8 +35,8 @@ export class DocumentCard extends BaseComponent {
}
// if this element is actionable it should have an aria role
- let role = actionable ? (onClick ? 'button' : 'link') : undefined;
- let tabIndex = actionable ? 0 : undefined;
+ const role = actionable ? (onClick ? 'button' : 'link') : undefined;
+ const tabIndex = actionable ? 0 : undefined;
return (