Skip to content

Commit dc93dd2

Browse files
clydinBrocco
authored andcommitted
fix(@angular/cli): allow reading UTF8 files with BOM when linting
1 parent 2ca44e8 commit dc93dd2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

packages/@angular/cli/tasks/lint.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as ts from 'typescript';
99
// @ignoreDep tslint - used only for type information
1010
import * as tslint from 'tslint';
1111
import { requireProjectModule } from '../utilities/require-project-module';
12+
import { stripBom } from '../utilities/strip-bom';
1213

1314
const SilentError = require('silent-error');
1415
const Task = require('../ember-cli/lib/models/task');
@@ -167,14 +168,10 @@ function getFilesToLint(
167168
}
168169

169170
function getFileContents(file: string): string {
170-
let contents: string;
171-
172171
// NOTE: The tslint CLI checks for and excludes MPEG transport streams; this does not.
173172
try {
174-
contents = fs.readFileSync(file, 'utf8');
173+
return stripBom(fs.readFileSync(file, 'utf-8'));
175174
} catch (e) {
176175
throw new SilentError(`Could not read file "${file}".`);
177176
}
178-
179-
return contents;
180177
}

0 commit comments

Comments
 (0)