Skip to content

Commit 1a91560

Browse files
committed
Merge branch 'master' into modularize
2 parents 249c7d9 + deee853 commit 1a91560

6 files changed

+29
-21
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ language: node_js
22
node_js:
33
- "0.10"
44
- "0.12"
5+
- "4.1"

appveyor.yml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ environment:
22
matrix:
33
- nodejs_version: "0.10"
44
- nodejs_version: "0.12"
5+
- nodejs_version: "4.1"
56

67
install:
78
- ps: Install-Product node $env:nodejs_version

docs/sample.tslint.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"no-duplicate-variable": true,
4545
"no-empty": true,
4646
"no-eval": true,
47-
"no-inferrable-types": true,
47+
"no-inferrable-types": false,
4848
"no-internal-module": true,
4949
"no-require-imports": true,
5050
"no-string-literal": true,

src/configuration.ts

+20-19
Original file line numberDiff line numberDiff line change
@@ -36,33 +36,34 @@ const DEFAULT_CONFIG = {
3636
};
3737

3838
export function findConfiguration(configFile: string, inputFileLocation: string): any {
39-
if (configFile) {
40-
return JSON.parse(fs.readFileSync(configFile, "utf8"));
41-
}
42-
43-
// first look for package.json from input file location
44-
configFile = findup("package.json", { cwd: inputFileLocation, nocase: true });
39+
if (configFile == null) {
40+
// first look for package.json from input file location
41+
configFile = findup("package.json", { cwd: inputFileLocation, nocase: true });
4542

46-
if (configFile) {
47-
const content = require(configFile);
43+
if (configFile) {
44+
const content = require(configFile);
4845

49-
if (content.tslintConfig) {
50-
return content.tslintConfig;
46+
if (content.tslintConfig) {
47+
return content.tslintConfig;
48+
}
5149
}
52-
}
5350

54-
// next look for tslint.json
55-
const homeDir = getHomeDir();
56-
if (!homeDir) {
57-
return undefined;
58-
}
51+
// next look for tslint.json
52+
const homeDir = getHomeDir();
53+
if (!homeDir) {
54+
return undefined;
55+
}
5956

60-
const defaultPath = path.join(homeDir, CONFIG_FILENAME);
57+
const defaultPath = path.join(homeDir, CONFIG_FILENAME);
6158

62-
configFile = findup(CONFIG_FILENAME, { cwd: inputFileLocation, nocase: true }) || defaultPath;
59+
configFile = findup(CONFIG_FILENAME, { cwd: inputFileLocation, nocase: true }) || defaultPath;
60+
}
6361

6462
if (fs.existsSync(configFile)) {
65-
return JSON.parse(fs.readFileSync(configFile, "utf8"));
63+
let fileData = fs.readFileSync(configFile, "utf8");
64+
// remove BOM if present
65+
fileData = fileData.replace(/^\uFEFF/, "");
66+
return JSON.parse(fileData);
6667
} else {
6768
return DEFAULT_CONFIG;
6869
}

src/rules/noUnusedExpressionRule.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class UnusedExpressionWalker extends Lint.RuleWalker {
4242
if (expressionText === "\"use strict\"" || expressionText === "'use strict'") {
4343
return;
4444
}
45-
} else if (node.expression.kind === ts.SyntaxKind.DeleteExpression) {
45+
} else if (node.expression.kind === ts.SyntaxKind.DeleteExpression || node.expression.kind === ts.SyntaxKind.YieldExpression) {
4646
return;
4747
}
4848

test/files/rules/unused.expression.test.ts

+5
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,8 @@ a => fun2(a);
4848

4949
var obj = {};
5050
delete obj.key;
51+
function* g(): Iterable<number> {
52+
for (let i = 0; i < 100; i++) {
53+
yield i;
54+
}
55+
}

0 commit comments

Comments
 (0)