Skip to content

Commit

Permalink
Fix coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
emonkak committed May 30, 2016
1 parent 357b730 commit d6b6d55
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 27 deletions.
13 changes: 0 additions & 13 deletions .eslintrc

This file was deleted.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "tsc --declaration --rootDir src --outDir dist && cp LICENSE README.md package.json dist/",
"clean": "rm -fr coverage dist",
"cover": "isparta cover --include-all-sources --report lcovonly --report html --report text ./node_modules/mocha/bin/_mocha -- --compilers js:babel-core/register",
"lint": "eslint dist",
"lint": "tslint src/**/*.ts",
"test": "mocha --compilers js:babel-core/register --recursive",
"watch": "tsc --watch --rootDir src --outDir dist"
},
Expand All @@ -20,18 +20,17 @@
"homepage": "https://github.com/emonkak/js-enumerable",
"devDependencies": {
"babel-core": "^6.4.5",
"babel-eslint": "^6.0.2",
"babel-plugin-transform-runtime": "^6.7.5",
"babel-preset-es2015": "^6.6.0",
"babel-preset-stage-0": "^6.3.13",
"babel-runtime": "^6.6.1",
"cash-cp": "^0.2.0",
"cash-rm": "^0.2.0",
"coveralls": "^2.11.9",
"eslint": "^2.4.0",
"isparta": "^4.0.0",
"mocha": "^2.4.5",
"sinon": "^1.17.3",
"tslint": "^3.10.2",
"typescript": "^1.9.0-dev.20160507"
}
}
2 changes: 1 addition & 1 deletion src/Enumerable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class Enumerable<TSource> implements ILiftable<TSource> {
}

static defer<TSource>(iterableFactory: () => Iterable<TSource>): Enumerable<TSource> {
return new Enumerable(defer(iterableFactory))
return new Enumerable(defer(iterableFactory));
}

static generate<TState, TResult>(initialState: TState, condition: (state: TState) => boolean, iterate: (state: TState) => TState, resultSelector: (state: TState) => TResult): Enumerable<TResult> {
Expand Down
2 changes: 1 addition & 1 deletion src/first.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function first<TSource>(this: Iterable<TSource>, predicate?: (ele
if (predicate(element)) return element;
}
} else {
if (this instanceof Partition) return (this as any).first()
if (this instanceof Partition) return (this as any).first();
if (Array.isArray(this)) {
if ((this as any).length > 0) return (this as any)[0];
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/internal/OrderedEnumerable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default class OrderedEnumerable<TElement, TKey> extends Partition<TElemen
result = iterator.next();
}

return value
return value;
}

return defaultValue;
Expand Down Expand Up @@ -232,7 +232,7 @@ export default class OrderedEnumerable<TElement, TKey> extends Partition<TElemen
if (firstKey < secondKey) return this._descending ? 1 : -1;
if (firstKey > secondKey) return this._descending ? -1 : 1;
return next(first, second);
}
};
return this._parent ? this._parent._getComparer(comparer) : comparer;
}
}
2 changes: 1 addition & 1 deletion src/internal/quickSelect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import IComparer from './IComparer';
import pivotPosition from './pivotPosition';

export default function quickSelect<T>(array: Array<T>, comparer: IComparer<T>, left: number, right: number, n: number): T {
for (;;) {
while (true) {
if (left === right) return array[left];

const pivotIndex = left + ((right - left) >> 1);
Expand Down
2 changes: 1 addition & 1 deletion src/memoize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MemoizeIterator<TElement> implements Iterable<TElement> {

*[Symbol.iterator](): Iterator<TElement> {
let index = 0;
for (;;) {
while (true) {
if (index < this._bufferSize) {
yield this._buffer[index];
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/repeat.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function* repeat<TSource>(this: Iterable<TSource>, count?: number): Iterable<TSource> {
if (count == null) {
for (;;) {
while (true) {
yield* this;
}
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/static/range.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { argumentOutOfRange } from '../internal/errors'
import EmptyPartition from '../internal/EmptyPartition'
import Partition from '../internal/Partition'
import { argumentOutOfRange } from '../internal/errors';
import EmptyPartition from '../internal/EmptyPartition';
import Partition from '../internal/Partition';

export default function range(start: number, count: number): Iterable<number> {
return new RangePartition(start, count);
Expand Down
2 changes: 1 addition & 1 deletion src/static/zip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default function* zip<TFirst, TSecond, TResult>(first: Iterable<TFirst>,
const iterator1 = first[Symbol.iterator]();
const iterator2 = second[Symbol.iterator]();

for (;;) {
while (true) {
const result1 = iterator1.next();
const result2 = iterator2.next();
if (result1.done || result2.done) break;
Expand Down
54 changes: 54 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"rules": {
"class-name": true,
"comment-format": [
true,
"check-space"
],
"indent": [
true,
"spaces"
],
"no-duplicate-variable": true,
"no-eval": true,
"no-internal-module": true,
"no-trailing-whitespace": true,
"no-var-keyword": true,
"one-line": [
true,
"check-open-brace",
"check-whitespace"
],
"quotemark": [
true,
"single"
],
"semicolon": [
true,
"always"
],
"triple-equals": false,
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"variable-name": [
true,
"ban-keywords"
],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
]
}
}

0 comments on commit d6b6d55

Please sign in to comment.