Skip to content
Closed
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
2 changes: 1 addition & 1 deletion packages/eslint-config-airbnb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"devDependencies": {
"babel-eslint": "4.0.10",
"babel-tape-runner": "1.2.0",
"eslint": "1.1.0",
"eslint": "^1.4.3",
"eslint-plugin-react": "3.2.3",
"react": "0.13.3",
"tape": "4.2.0"
Expand Down
8 changes: 4 additions & 4 deletions packages/eslint-config-airbnb/test/test-base.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import test from 'tape';
import base from '../base';

test('base: does not reference react', t => {
t.plan(2);
test('base: does not reference react', tst => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh this type of change to me is an indicator that perhaps we don't wan't id-length in the first place - t is the conventional argument name here for tape, and using an abbreviated "test" seems hacky.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah - but in that case we should ammend the styleguide as well to say 1-letter vars are ok in some cases

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they always make sense as iteration variables in loops, and in tape tests, to begin with.

tst.plan(2);

t.notOk(base.plugins, 'plugins is unspecified');
tst.notOk(base.plugins, 'plugins is unspecified');

// scan rules for react/ and fail if any exist
const reactRuleIds = Object.keys(base.rules)
.filter(ruleId => ruleId.indexOf('react/') === 0);
t.deepEquals(reactRuleIds, [], 'there are no react/ rules');
tst.deepEquals(reactRuleIds, [], 'there are no react/ rules');
});
36 changes: 18 additions & 18 deletions packages/eslint-config-airbnb/test/test-react-order.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ ${body}
`;
}

test('validate react prop order', t => {
t.test('make sure our eslintrc has React linting dependencies', t => {
t.plan(2);
t.equal(eslintrc.parser, 'babel-eslint', 'uses babel-eslint');
t.equal(eslintrc.plugins[0], 'react', 'uses eslint-plugin-react');
test('validate react prop order', tst => {
tst.test('make sure our eslintrc has React linting dependencies', tst => {
tst.plan(2);
tst.equal(eslintrc.parser, 'babel-eslint', 'uses babel-eslint');
tst.equal(eslintrc.plugins[0], 'react', 'uses eslint-plugin-react');
});

t.test('passes a good component', t => {
t.plan(3);
tst.test('passes a good component', tst => {
tst.plan(3);
const result = lint(wrapComponent(`
componentWillMount() { }
componentDidMount() { }
Expand All @@ -42,13 +42,13 @@ test('validate react prop order', t => {
render() { return <div />; }
`));

t.notOk(result.warningCount, 'no warnings');
t.notOk(result.errorCount, 'no errors');
t.deepEquals(result.messages, [], 'no messages in results');
tst.notOk(result.warningCount, 'no warnings');
tst.notOk(result.errorCount, 'no errors');
tst.deepEquals(result.messages, [], 'no messages in results');
});

t.test('order: when random method is first', t => {
t.plan(2);
tst.test('order: when random method is first', tst => {
tst.plan(2);
const result = lint(wrapComponent(`
someMethod() { }
componentWillMount() { }
Expand All @@ -60,12 +60,12 @@ test('validate react prop order', t => {
render() { return <div />; }
`));

t.ok(result.errorCount, 'fails');
t.equal(result.messages[0].ruleId, 'react/sort-comp', 'fails due to sort');
tst.ok(result.errorCount, 'fails');
tst.equal(result.messages[0].ruleId, 'react/sort-comp', 'fails due to sort');
});

t.test('order: when random method after lifecycle methods', t => {
t.plan(2);
tst.test('order: when random method after lifecycle methods', tst => {
tst.plan(2);
const result = lint(wrapComponent(`
componentWillMount() { }
componentDidMount() { }
Expand All @@ -77,7 +77,7 @@ test('validate react prop order', t => {
render() { return <div />; }
`));

t.ok(result.errorCount, 'fails');
t.equal(result.messages[0].ruleId, 'react/sort-comp', 'fails due to sort');
tst.ok(result.errorCount, 'fails');
tst.equal(result.messages[0].ruleId, 'react/sort-comp', 'fails due to sort');
});
});