Skip to content

Commit

Permalink
refactor: always add trailing comma when multiline (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
popomore committed Oct 9, 2018
1 parent 8e6cad8 commit 3835423
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 14 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
sudo: false
language: node_js
node_js:
- '6'
- '8'
- '10'
install:
Expand Down
1 change: 0 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
environment:
matrix:
- nodejs_version: '6'
- nodejs_version: '8'
- nodejs_version: '10'

Expand Down
7 changes: 1 addition & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,7 @@ module.exports = {

// eslint eslint#comma-dangle
'trailing-comma': [ true, {
multiline: {
objects: 'always',
arrays: 'always',
functions: 'never',
typeLiterals: 'ignore',
},
multiline: 'always',
}],

// eslint#no-cond-assign
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"homepage": "https://github.com/eggjs/tslint-config-egg",
"author": "whxaxes <whxaxes@gmail.com>",
"engines": {
"node": ">=6.0.0"
"node": ">=8.0.0"
},
"ci": {
"version": "6, 8, 10"
"version": "8, 10"
}
}
2 changes: 1 addition & 1 deletion test/fixtures/align/parameters.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function bar(
a: string,
b: string
b: string,
) {}
17 changes: 16 additions & 1 deletion test/fixtures/comma/trailing-comma-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,24 @@ export const foo = {
b: 2
};

export const bar = [
1,
2
];

function foo2(
a: string,
b: string,
b: string
) {
console.info(a + b);
}

import {
a,
b
} from 'egg';

export {
a,
b
} from 'egg';
17 changes: 16 additions & 1 deletion test/fixtures/comma/trailing-comma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,24 @@ export const foo = {
b: 2,
};

export const bar = [
1,
2,
];

function foo2(
a: string,
b: string
b: string,
) {
console.info(a + b);
}

import {
a,
b,
} from 'egg';

export {
a,
b,
} from 'egg';
1 change: 0 additions & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('test/index.test.js', () => {
return coffee.spawn('tslint', [ path.resolve(cwd, './trailing-comma-error.ts') ])
// .debug()
.expect('stdout', /Missing trailing comma/)
.expect('stdout', /Unnecessary trailing comma/)
.expect('code', 2)
.end();
});
Expand Down

0 comments on commit 3835423

Please sign in to comment.