Skip to content

Commit

Permalink
Fix missing rules in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuno Sousa committed Mar 3, 2017
1 parent a1e60ae commit 737599c
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 30 deletions.
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ module.exports = {
'no-lonely-if': 'error',
'no-loop-func': 'error',
'no-mixed-requires': 'error',
'no-mixed-spaces-and-tabs': 'error',
'no-multi-spaces': 'error',
'no-multi-str': 'error',
'no-multiple-empty-lines': ['error', {
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ function noop() {

// `no-mixed-spaces-and-tabs`.
function noMixedSpacesAndTabs() {
const foo = 'bar';
const foo = 'bar';

noop(foo);
noop(foo);
}

noop(noMixedSpacesAndTabs);
Expand Down
53 changes: 29 additions & 24 deletions test/fixtures/incorrect.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function noop() {
noop([ 'bar', 'foo']);

// `arrow-parens`
noop((foo) => {});
noop((foo) => noop(foo));

// `brace-style`.
try {
Expand All @@ -25,7 +25,7 @@ noop(['bar','foo']);

// `comma-style`.
noop({
bar: 'foo'
bar: 'foo'
, foo: 'bar'
});

Expand All @@ -38,7 +38,7 @@ noop(consistentThis);
let curly = true;

if (curly)
curly = false
curly = false;

// `dot-notation`.
const dotNotation = {};
Expand All @@ -55,6 +55,11 @@ let id_match;

noop(id_match);

// `indent`.
noop({
bar: 'foo'
});

// `key-spacing`.
noop({ foo:'bar' });

Expand All @@ -72,7 +77,8 @@ describe.only('noExclusiveTests', () => {

// `new-cap`.
const cap = require('cap');
const newCap = new cap();

new cap();

// `newline-after-var`.
const newLineAfterVar = 'foo';
Expand Down Expand Up @@ -100,6 +106,8 @@ const noConstAssign = true;

noConstAssign = false;

noop(noConstAssign);

// `no-constant-condition`.
if (true) {
noop(true);
Expand All @@ -124,16 +132,17 @@ try {
} catch (e) {}

// `no-labels`.
noLabels:
while (noLabels) {
break noLabels;
}
noLabels: {
break noLabels;
}

// `no-mixed-spaces-and-tabs`.
const noMixedSpacesAndTabs = {
bar: 'foo',
foo: 'bar'
};
noop({
foo: {
bar: 'foo',
foo: 'bar'
}
});

// `no-multi-spaces`.
noop(['foo', 'bar']);
Expand Down Expand Up @@ -168,18 +177,14 @@ noop(Child);
// `no-underscore-dangle`.
class NoUnderscoreDangle {
constructor() {
this._foo = 'bar';
this._foo();
}
}

const noUnderscoreDangle1 = { _foo: 'bar' };
const noUnderscoreDangle2 = {};

noUnderscoreDangle2._foo = 'bar';
noop(new NoUnderscoreDangle());

noop(NoUnderscoreDangle);
noop(noUnderscoreDangle1);
noop(noUnderscoreDangle2);
// `no-unused-vars`
const foobar = '';

// `object-curly-spacing`.
const objectCurlySpacing = {foo: 'bar'};
Expand All @@ -193,10 +198,10 @@ noop(oneVar1);
noop(oneVar2);

// `one-var-declaration-per-line`.
const oneVar1 = 'foo'; const oneVar2 = 'bar';
const oneVarDeclarationPerLine1 = 'foo'; const oneVarDeclarationPerLine2 = 'bar';

noop(oneVar1);
noop(oneVar2);
noop(oneVarDeclarationPerLine1);
noop(oneVarDeclarationPerLine2);

// `operator-linebreak`.
const operatorLineBreak = 1 +
Expand Down Expand Up @@ -260,7 +265,7 @@ let spaceBeforeBlocks = true;

if (spaceBeforeBlocks){
spaceBeforeBlocks = false;
}else{
} else {
spaceBeforeBlocks = true;
}

Expand Down
14 changes: 10 additions & 4 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,33 @@ describe('eslint-config-seegno', () => {
it('should generate violations for environment-specific rules', () => {
const source = path.join(__dirname, 'fixtures', 'environment.js');

linter.executeOnFiles([source]).results[0].messages.map(violation => violation.ruleId).should.containDeep([
'eol-last',
Array.from(new Set(linter.executeOnFiles([source]).results[0].messages.map(violation => violation.ruleId))).should.eql([
'linebreak-style',
'no-mixed-spaces-and-tabs'
'no-mixed-spaces-and-tabs',
'eol-last'
]);
});

it('should generate violations for incorrect code', () => {
const source = path.join(__dirname, 'fixtures', 'incorrect.js');

linter.executeOnFiles([source]).results[0].messages.map(violation => violation.ruleId).should.containDeep([
Array.from(new Set(linter.executeOnFiles([source]).results[0].messages.map(violation => violation.ruleId))).should.eql([
'array-bracket-spacing',
'arrow-parens',
'brace-style',
'comma-dangle',
'comma-spacing',
'comma-style',
'consistent-this',
'curly',
'dot-notation',
'generator-star-spacing',
'id-match',
'indent',
'key-spacing',
'keyword-spacing',
'mocha/no-exclusive-tests',
'no-new',
'new-cap',
'newline-after-var',
'newline-before-return',
Expand All @@ -55,12 +59,14 @@ describe('eslint-config-seegno', () => {
'no-dupe-class-members',
'no-empty',
'no-labels',
'no-mixed-spaces-and-tabs',
'no-multi-spaces',
'no-multi-str',
'no-multiple-empty-lines',
'no-spaced-func',
'no-this-before-super',
'no-underscore-dangle',
'no-unused-vars',
'object-curly-spacing',
'one-var',
'one-var-declaration-per-line',
Expand Down

0 comments on commit 737599c

Please sign in to comment.