Files
azuredatastudio/build/lib/eslint/code-translation-remind.js
Karl Burtram 31e9c21c06 Fix regressions in web build (#15920)
* Update build for web issues

* Fix remote\web package.json

* Remove extension activate test

* Add terminal entry point

* Bump distro

* Update docker files and pipelines

* Add linux task

* Update build pool

* Correct image name

* Update pipelines

* Fix indention

* Update sql-web-build.yml for Azure Pipelines

Add new build variable

* Update sql-web-build.yml for Azure Pipelines

Revert previous commit

* Disable sourcemaps upload

* Remove compile step

* Fix yaml typo

* Fix dependson error

* Update yaml

* Add notebook parameters

* Remove web from desktop builds

* Add web createDrop script

* Bump distro

* Change execution mode on createDrop script

* Code review feedback

* Update CI hygiene cache key

* Bump distro

* Fix merge conflicts

* Revert "Fix merge conflicts"

This reverts commit 06f7a58b6e0a065520b7686e8469e4e7682e157a.

* Bump distro to before smoke test update
2021-06-29 12:12:27 -07:00

58 lines
2.4 KiB
JavaScript

"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var _a;
const fs_1 = require("fs");
const utils_1 = require("./utils");
module.exports = new (_a = class TranslationRemind {
constructor() {
this.meta = {
messages: {
missing: 'Please add \'{{resource}}\' to ./build/lib/i18n.resources.json file to use translations here.'
}
};
}
create(context) {
return (0, utils_1.createImportRuleListener)((node, path) => this._checkImport(context, node, path));
}
_checkImport(context, node, path) {
if (path !== TranslationRemind.NLS_MODULE) {
return;
}
const currentFile = context.getFilename();
const matchService = currentFile.match(/vs\/workbench\/services\/\w+/);
const matchPart = currentFile.match(/vs\/workbench\/contrib\/\w+/);
if (!matchService && !matchPart) {
return;
}
const resource = matchService ? matchService[0] : matchPart[0];
let resourceDefined = false;
let json;
try {
json = (0, fs_1.readFileSync)('./build/lib/i18n.resources.json', 'utf8');
}
catch (e) {
console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.');
return;
}
const workbenchResources = JSON.parse(json).workbench;
workbenchResources.forEach((existingResource) => {
if (existingResource.name === resource) {
resourceDefined = true;
return;
}
});
if (!resourceDefined) {
context.report({
loc: node.loc,
messageId: 'missing',
data: { resource }
});
}
}
},
_a.NLS_MODULE = 'vs/nls',
_a);