Skip to content
This repository has been archived by the owner on May 22, 2021. It is now read-only.

Commit

Permalink
disable no-use-before-define rule
Browse files Browse the repository at this point in the history
This rule has been disabled because it is common in hapi modules
to call a function that hasn't been defined yet. The rule has an
option to allow this with functions, but it does not apply to
functions that are assigned to variables, as done in the hapi
ecosystem.
  • Loading branch information
cjihrig committed Nov 5, 2015
1 parent 40d0311 commit 9390aca
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 42 deletions.
1 change: 0 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ module.exports = {
'no-new-object': 2,
'no-spaced-func': 2,
'no-mixed-spaces-and-tabs': 2,
'no-use-before-define': 2,
'space-after-keywords': 2,
'semi': [2, 'always'],
'semi-spacing': [2, { 'before': false, 'after': true }],
Expand Down
9 changes: 0 additions & 9 deletions test/fixtures/no-use-before-define.js

This file was deleted.

32 changes: 0 additions & 32 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,38 +282,6 @@ describe('eslint-config-hapi', function () {
done();
});

it('enforces no-use-before-define rule', function (done) {
var output = lintFile('fixtures/no-use-before-define.js');
var results = output.results[0];

expect(output.errorCount).to.equal(2);
expect(output.warningCount).to.equal(0);
expect(results.errorCount).to.equal(2);
expect(results.warningCount).to.equal(0);

var msg = results.messages[0];

expect(msg.ruleId).to.equal('no-use-before-define');
expect(msg.severity).to.equal(2);
expect(msg.message).to.equal('foo was used before it was defined');
expect(msg.line).to.equal(3);
expect(msg.column).to.equal(1);
expect(msg.nodeType).to.equal('Identifier');
expect(msg.source).to.equal('foo();');

msg = results.messages[1];

expect(msg.ruleId).to.equal('no-use-before-define');
expect(msg.severity).to.equal(2);
expect(msg.message).to.equal('bar was used before it was defined');
expect(msg.line).to.equal(4);
expect(msg.column).to.equal(1);
expect(msg.nodeType).to.equal('Identifier');
expect(msg.source).to.equal('bar = 5;');

done();
});

it('enforces prefer-const', function (done) {
var output = lintFile('fixtures/prefer-const.js');
var results = output.results[0];
Expand Down

0 comments on commit 9390aca

Please sign in to comment.