From 363723fc84f7b8477592e0105aeb331ec9a017af Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 14 Aug 2017 05:01:11 +0200 Subject: node_modules --- node_modules/tslint/lib/rules/encodingRule.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'node_modules/tslint/lib/rules/encodingRule.js') diff --git a/node_modules/tslint/lib/rules/encodingRule.js b/node_modules/tslint/lib/rules/encodingRule.js index 776bfc4fe..eda50bfa6 100644 --- a/node_modules/tslint/lib/rules/encodingRule.js +++ b/node_modules/tslint/lib/rules/encodingRule.js @@ -32,18 +32,18 @@ var Rule = (function (_super) { Rule.prototype.apply = function (sourceFile) { return this.applyWithFunction(sourceFile, walk); }; + /* tslint:disable:object-literal-sort-keys */ + Rule.metadata = { + ruleName: "encoding", + description: "Enforces UTF-8 file encoding.", + optionsDescription: "Not configurable.", + options: null, + optionExamples: ["true"], + type: "style", + typescriptOnly: false, + }; return Rule; }(Lint.Rules.AbstractRule)); -/* tslint:disable:object-literal-sort-keys */ -Rule.metadata = { - ruleName: "encoding", - description: "Enforces UTF-8 file encoding.", - optionsDescription: "Not configurable.", - options: null, - optionExamples: ["true"], - type: "style", - typescriptOnly: false, -}; exports.Rule = Rule; function walk(ctx) { var encoding = detectEncoding(ctx.sourceFile.fileName); @@ -68,5 +68,6 @@ function detectEncoding(fileName) { var maxBytesRead = 3; // Only need 3 bytes to detect the encoding. var buffer = new Buffer(maxBytesRead); var bytesRead = fs.readSync(fd, buffer, /*offset*/ 0, /*length*/ maxBytesRead, /*position*/ 0); + fs.closeSync(fd); return utils_1.detectBufferEncoding(buffer, bytesRead); } -- cgit v1.2.3