Skip to content

Commit 9b71c44

Browse files
committed
Update linting
1 parent e1c15ab commit 9b71c44

File tree

12 files changed

+86
-81
lines changed

12 files changed

+86
-81
lines changed

.eslintrc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
"node": true
77
},
88
"rules": {
9-
"react/prefer-es6-class": 0,
10-
"react/prefer-stateless-function": 0,
11-
"no-plusplus": 0,
9+
"no-plusplus": "off",
10+
"react/require-default-props": "off",
1211
"react/jsx-filename-extension": ["error", { "extensions": [".js"] }],
13-
"react/forbid-prop-types": 0,
14-
"react/sort-comp": 0,
15-
"jsx-a11y/no-static-element-interactions": 0,
12+
"react/forbid-prop-types": "off",
13+
"react/sort-comp": "off",
14+
"jsx-a11y/no-static-element-interactions": "off",
1615
"import/no-extraneous-dependencies": ["error", {
1716
"devDependencies": ["**/__tests__/*-test.js"],
1817
"optionalDependencies": false

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@
5252
"cross-env": "^4.0.0",
5353
"enzyme": "^2.3.0",
5454
"eslint": "^3.5.0",
55-
"eslint-config-airbnb": "^12.0.0",
56-
"eslint-plugin-import": "^1.8.0",
57-
"eslint-plugin-jsx-a11y": "^2.2.2",
55+
"eslint-config-airbnb": "^14.1.0",
56+
"eslint-plugin-import": "^2.2.0",
57+
"eslint-plugin-jsx-a11y": "^4.0.0",
5858
"eslint-plugin-react": "^6.2.1",
5959
"jest-cli": "^19.0.2",
6060
"react": "^15.0.0",

src/components/Tab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default class Tab extends Component {
6767
{
6868
[activeTabClassName]: selected,
6969
[disabledTabClassName]: disabled,
70-
}
70+
},
7171
)}
7272
ref={(node) => { this.node = node; if (tabRef) tabRef(node); }}
7373
role="tab"

src/components/TabList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default class TabList extends Component {
5050
{...attributes}
5151
className={cx(
5252
'ReactTabs__TabList',
53-
className
53+
className,
5454
)}
5555
role="tablist"
5656
>

src/components/TabPanel.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ export default class TabPanel extends Component {
1515
};
1616

1717
static propTypes = {
18-
children: PropTypes.oneOfType([
19-
PropTypes.array,
20-
PropTypes.object,
21-
PropTypes.string,
22-
]),
18+
children: PropTypes.node,
2319
className: PropTypes.string,
2420
id: PropTypes.string,
2521
selected: PropTypes.bool,
@@ -45,7 +41,7 @@ export default class TabPanel extends Component {
4541
className,
4642
{
4743
'ReactTabs__TabPanel--selected': selected,
48-
}
44+
},
4945
)}
5046
role="tabpanel"
5147
id={id}

src/components/Tabs.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,16 @@ export default class Tabs extends Component {
141141
let count = 0;
142142
const children = this.props.children;
143143
const state = this.state;
144-
const tabIds = this.tabIds = this.tabIds || [];
145-
const panelIds = this.panelIds = this.panelIds || [];
144+
this.tabIds = this.tabIds || [];
145+
this.panelIds = this.panelIds || [];
146146
let diff = this.tabIds.length - this.getTabsCount();
147147

148148
// Add ids if new tabs have been added
149149
// Don't bother removing ids, just keep them in case they are added again
150150
// This is more efficient, and keeps the uuid counter under control
151151
while (diff++ < 0) {
152-
tabIds.push(uuid());
153-
panelIds.push(uuid());
152+
this.tabIds.push(uuid());
153+
this.panelIds.push(uuid());
154154
}
155155

156156
// Map children to dynamically setup refs
@@ -175,8 +175,8 @@ export default class Tabs extends Component {
175175
}
176176

177177
const tabRef = (node) => { this.tabNodes[`tabs-${index}`] = node; };
178-
const id = tabIds[index];
179-
const panelId = panelIds[index];
178+
const id = this.tabIds[index];
179+
const panelId = this.panelIds[index];
180180
const selected = state.selectedIndex === index;
181181
const focus = selected && state.focus;
182182

@@ -199,8 +199,8 @@ export default class Tabs extends Component {
199199
// Reset index for panels
200200
index = 0;
201201
} else {
202-
const id = panelIds[index];
203-
const tabId = tabIds[index];
202+
const id = this.panelIds[index];
203+
const tabId = this.tabIds[index];
204204
const selected = state.selectedIndex === index;
205205

206206
index++;
@@ -343,7 +343,7 @@ export default class Tabs extends Component {
343343
className={cx(
344344
'ReactTabs',
345345
'react-tabs',
346-
className
346+
className,
347347
)}
348348
onClick={this.handleClick}
349349
onKeyDown={this.handleKeyDown}

src/components/__tests__/Tab-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Tab from '../Tab';
55

66
describe('<Tab />', () => {
77
beforeAll(() => {
8+
// eslint-disable-next-line no-console
89
console.error = (error) => {
910
throw new Error(error);
1011
};

src/components/__tests__/TabList-test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function hasClassAt(wrapper, index, className) {
1212

1313
describe('<TabList />', () => {
1414
beforeAll(() => {
15+
// eslint-disable-next-line no-console
1516
console.error = (error) => {
1617
throw new Error(error);
1718
};
@@ -53,7 +54,7 @@ describe('<TabList />', () => {
5354
</TabList>
5455
<TabPanel>Foo</TabPanel>
5556
<TabPanel>Bar</TabPanel>
56-
</Tabs>
57+
</Tabs>,
5758
);
5859

5960
const tabsList = wrapper.childAt(0);
@@ -70,7 +71,7 @@ describe('<TabList />', () => {
7071
</TabList>
7172
<TabPanel>Foo</TabPanel>
7273
<TabPanel>Bar</TabPanel>
73-
</Tabs>
74+
</Tabs>,
7475
);
7576

7677
const tabsList = wrapper.childAt(0);

src/components/__tests__/TabPanel-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import TabPanel from '../TabPanel';
55

66
describe('<TabPanel />', () => {
77
beforeAll(() => {
8+
// eslint-disable-next-line no-console
89
console.error = (error) => {
910
throw new Error(error);
1011
};

src/components/__tests__/Tabs-test.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ function assertTabSelected(wrapper, index) {
4040

4141
describe('<Tabs />', () => {
4242
beforeAll(() => {
43+
// eslint-disable-next-line no-console
4344
console.error = (error) => {
4445
throw new Error(error);
4546
};
@@ -224,7 +225,7 @@ describe('<Tabs />', () => {
224225
<TabList>
225226
<Tab>Foo</Tab>
226227
</TabList>
227-
</Tabs>
228+
</Tabs>,
228229
);
229230
console.error = oldConsoleError; // eslint-disable-line no-console
230231

@@ -245,7 +246,7 @@ describe('<Tabs />', () => {
245246

246247
<TabPanel>Hello Foo</TabPanel>
247248
<TabPanel>Hello Bar</TabPanel>
248-
</Tabs>
249+
</Tabs>,
249250
);
250251
console.error = oldConsoleError; // eslint-disable-line no-console
251252

@@ -261,7 +262,7 @@ describe('<Tabs />', () => {
261262
<div />
262263
</TabList>
263264
<TabPanel />
264-
</Tabs>
265+
</Tabs>,
265266
);
266267

267268
const result = Tabs.propTypes.children(wrapper.props(), 'children', 'Tabs');
@@ -276,7 +277,7 @@ describe('<Tabs />', () => {
276277
expect(() => shallow(
277278
<Tabs>
278279
<TabList />
279-
</Tabs>
280+
</Tabs>,
280281
)).not.toThrow();
281282
});
282283

@@ -289,7 +290,7 @@ describe('<Tabs />', () => {
289290
</TabList>
290291
<TabPanel>Content A</TabPanel>
291292
{false && <TabPanel>Content B</TabPanel>}
292-
</Tabs>
293+
</Tabs>,
293294
)).not.toThrow();
294295
});
295296

@@ -311,7 +312,7 @@ describe('<Tabs />', () => {
311312
</Tabs>
312313
</TabPanel>
313314
<TabPanel />
314-
</Tabs>
315+
</Tabs>,
315316
);
316317

317318
const innerTabs = wrapper.childAt(1).childAt(0);

0 commit comments

Comments
 (0)