Skip to content

Commit

Permalink
#290 ESLint: Fix react/no-array-index-key error
Browse files Browse the repository at this point in the history
  • Loading branch information
zaki-yama committed Mar 19, 2019
1 parent 78ed1bf commit 643ea60
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = {
'react/require-default-props': 1,
'react/destructuring-assignment': 0,
'react/no-find-dom-node': 1,
'react/no-array-index-key': 1,
'react/no-array-index-key': 2,
'react/button-has-type': 1,
'jsx-a11y/click-events-have-key-events': 1,
'jsx-a11y/no-noninteractive-tabindex': 1,
Expand Down
3 changes: 3 additions & 0 deletions src/scripts/AutoAlign.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export default function autoAlign(options) {
} catch (e) {
targetEl = null;
}
// eslint-disable-next-line react/destructuring-assignment
const oldTriggerRect = this.state.triggerRect;
if (targetEl) {
const {
Expand Down Expand Up @@ -232,7 +233,9 @@ export default function autoAlign(options) {
render() {
const { triggerRect } = this.state;
const {
// eslint-disable-next-line react/destructuring-assignment
align = this.state.horizAlign,
// eslint-disable-next-line react/destructuring-assignment
vertAlign = this.state.vertAlign,
portalClassName: additionalPortalClassName,
portalStyle: additionalPortalStyle = {},
Expand Down
2 changes: 2 additions & 0 deletions src/scripts/Datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ export default class Datepicker extends Component {
<thead>
<tr>
{moment.weekdaysMin(true).map((wd, i) => (
// eslint-disable-next-line react/no-array-index-key
<th key={i}>
<abbr title={moment.weekdays(true, i)}>{wd}</abbr>
</th>
Expand All @@ -258,6 +259,7 @@ export default class Datepicker extends Component {
</thead>
<tbody>
{cal.weeks.map((days, i) => (
// eslint-disable-next-line react/no-array-index-key
<tr key={i}>
{days.map(this.renderDate.bind(this, cal, selectedDate, today))}
</tr>
Expand Down
1 change: 1 addition & 0 deletions src/scripts/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class TableHeader extends Component {
const childSortable = child.props.sortable;
nextChildren.push(
React.cloneElement(child, {
// eslint-disable-next-line react/no-array-index-key
key: index,
sortable:
typeof childSortable === 'undefined' ? sortable : childSortable,
Expand Down
1 change: 1 addition & 0 deletions stories/IconStories.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react/no-array-index-key */
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
Expand Down
1 change: 1 addition & 0 deletions stories/ModalStories.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ storiesOf('Modal', module)
<PicklistItem
value={i + 1}
label={`Item #${i + 1}`}
// eslint-disable-next-line react/no-array-index-key
key={i}
/>
))}
Expand Down
1 change: 1 addition & 0 deletions test/breadcrumbs-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe('BreadCrumbs', () => {
const wrapper = shallow(
<BreadCrumbs>
{items.map((item, index) => (
// eslint-disable-next-line react/no-array-index-key
<Crumb key={index} href={item.href}>
{item.label}
</Crumb>
Expand Down

0 comments on commit 643ea60

Please sign in to comment.