Add double quotes for localize hygiene check (#6492)

* Add localize single quote hygiene task

* Update localize calls

* Update comment

* Fix build failures and remove test code
This commit is contained in:
Charles Gagnon
2019-07-25 10:35:14 -07:00
committed by GitHub
parent 69845b29ef
commit b2b2840990
141 changed files with 651 additions and 630 deletions

View File

@@ -195,6 +195,10 @@ const useStrictFilter = [
'src/**'
];
const sqlFilter = [
'src/sql/**'
];
// {{SQL CARBON EDIT}}
const copyrightHeaderLines = [
'/*---------------------------------------------------------------------------------------------',
@@ -284,6 +288,19 @@ function hygiene(some) {
this.emit('data', file);
});
const localizeDoubleQuotes = es.through(function (file) {
const lines = file.__lines;
lines.forEach((line, i) => {
if (/localize\(['"].*['"],\s'.*'\)/.test(line)) {
console.error(file.relative + '(' + (i + 1) + ',1): Message parameter to localize calls should be double-quotes');
errorCount++;
}
});
this.emit('data', file);
});
// {{SQL CARBON EDIT}} END
const formatting = es.map(function (file, cb) {
@@ -352,7 +369,10 @@ function hygiene(some) {
.pipe(tsl)
// {{SQL CARBON EDIT}}
.pipe(filter(useStrictFilter))
.pipe(useStrict);
.pipe(useStrict)
// Only look at files under the sql folder since we don't want to cause conflicts with VS code
.pipe(filter(sqlFilter))
.pipe(localizeDoubleQuotes);
const javascript = result
.pipe(filter(eslintFilter))