build: no longer run tslint from within gulp task (#35800)

Switches our tslint setup to the standard `tslint.json` linter excludes.
The set of files that need to be linted is specified through a Yarn script.

For IDEs, open files are linted with the closest tslint configuration, if the
tslint IDE extension is set up, and the source file is not excluded.

We cannot use the language service plugin for tslint as we have multiple nested
tsconfig files, and we don't want to add the plugin to each tsconfig. We
could reduce that bloat by just extending from a top-level tsconfig that
defines the language service plugin, but unfortunately the tslint plugin does
not allow the use of tslint configs which are not part of the tsconfig project.

This is problematic since the tslint configuration is at the project root, and we
don't want to copy tslint configurations next to each tsconfig file.

Additionally, linting of `d.ts` files has been re-enabled. This has been
disabled in the past and a TODO has been left. This commit fixes the
lint issues and re-enables linting.

PR Close #35800
This commit is contained in:
Paul Gschwendtner
2020-03-02 18:35:30 +01:00
committed by atscott
parent 5349e46b46
commit 5615928df9
28 changed files with 171 additions and 138 deletions
+2 -2
View File
@@ -37,12 +37,12 @@ var tunnel = new BrowserStackTunnel({
hosts: hosts
});
console.log('Starting tunnel on ports', PORTS.join(', '));
console.info('Starting tunnel on ports', PORTS.join(', '));
tunnel.start(function(error) {
if (error) {
console.error('Can not establish the tunnel', error);
} else {
console.log('Tunnel established.');
console.info('Tunnel established.');
fakeServers.forEach(function(server) {
server.close();
});
+7
View File
@@ -1,4 +1,11 @@
#!/usr/bin/env node
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
'use strict';
const {buildTargetPackages} = require('./package-builder');
+14 -6
View File
@@ -1,4 +1,12 @@
#!/usr/bin/env node
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
'use strict';
const {chmod, cp, mkdir, rm} = require('shelljs');
@@ -22,18 +30,18 @@ buildTargetPackages('dist/packages-dist', false, 'Production');
// copied into the `dist/packages-dist/` directory (despite its source's being inside
// `packages/`), because it is not published to npm under the `@angular` scope (as happens for
// the rest of the packages).
console.log('');
console.log('##############################');
console.log(`${scriptPath}:`);
console.log(' Building zone.js npm package');
console.log('##############################');
console.info('');
console.info('##############################');
console.info(`${scriptPath}:`);
console.info(' Building zone.js npm package');
console.info('##############################');
exec(`${bazelCmd} build //packages/zone.js:npm_package`);
// Copy artifacts to `dist/zone.js-dist/`, so they can be easier persisted on CI.
const buildOutputDir = `${bazelBin}/packages/zone.js/npm_package`;
const distTargetDir = `${baseDir}/dist/zone.js-dist/zone.js`;
console.log(`# Copy artifacts to ${distTargetDir}`);
console.info(`# Copy artifacts to ${distTargetDir}`);
mkdir('-p', distTargetDir);
rm('-rf', distTargetDir);
cp('-R', buildOutputDir, distTargetDir);
+12 -4
View File
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
'use strict';
// Imports
@@ -27,7 +35,7 @@ for (const compressionType in limitSizes) {
failed = true;
// An expected compression type/file combination is missing. Maybe the file was renamed or
// removed. Report it as an error, so the user updates the corresponding limit file.
console.log(
console.error(
`ERROR: Commit ${commit} ${compressionType} ${filename} measurement is missing. ` +
'Maybe the file was renamed or removed.');
} else {
@@ -54,11 +62,11 @@ for (const compressionType in limitSizes) {
}
// Group failure messages separately from success messages so they are easier to find.
successMessages.concat(failureMessages).forEach(message => console.log(message));
successMessages.concat(failureMessages).forEach(message => console.error(message));
if (failed) {
console.log(`If this is a desired change, please update the size limits in file '${limitFile}'.`);
console.info(`If this is a desired change, please update the size limits in file '${limitFile}'.`);
process.exit(1);
} else {
console.log(`Payload size check passed. All diffs are less than 1% or 500 bytes.`);
console.info(`Payload size check passed. All diffs are less than 1% or 500 bytes.`);
}
+12 -4
View File
@@ -1,4 +1,12 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/*
* This script updates a package.json file by replacing all dependencies and devDependencies
* such that all packages from the @angular scope point to the packages-dist directory.
*
@@ -52,12 +60,12 @@ writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
// Log all packages that were updated
if (updated.length > 0) {
console.log(green(`Updated ${packageJsonPath} to packages in ${packagesDistRoot}:`));
console.log(` ${updated.join('\n ')}\n`);
console.info(green(`Updated ${packageJsonPath} to packages in ${packagesDistRoot}:`));
console.info(` ${updated.join('\n ')}\n`);
}
// Log the packages that were skipped, as they were not present in the packages-dist directory
if (skipped.length > 0) {
console.log(yellow(`Did not update packages that were not present in ${packagesDistRoot}:`));
console.log(` ${skipped.join('\n ')}\n`);
console.info(yellow(`Did not update packages that were not present in ${packagesDistRoot}:`));
console.info(` ${skipped.join('\n ')}\n`);
}
+4 -4
View File
@@ -28,7 +28,7 @@ function httpGet(server, path, headers) {
})
.on('error', (e) => reject(e));
});
};
}
let warnNoToken = true;
@@ -47,7 +47,7 @@ async function githubGet(path) {
}
return JSON.parse(await httpGet('api.github.com', '/repos/angular/angular/' + path, headers));
};
}
async function githubPrInfo(prNumber) {
const pr = (await githubGet('pulls/' + prNumber));
@@ -62,7 +62,7 @@ async function githubPrInfo(prNumber) {
},
branch: branch
};
}; // trailing ; so that clang-format is not confused on async function
}
function gitHasLocalModifications() {
return execNoFatal('git diff-index --quiet HEAD --').code != 0;
@@ -92,4 +92,4 @@ exports.githubGet = githubGet;
exports.githubPrInfo = githubPrInfo;
exports.gitHasLocalModifications = gitHasLocalModifications;
exports.execNoFatal = execNoFatal;
exports.getCurrentBranch = getCurrentBranch;
exports.getCurrentBranch = getCurrentBranch;
+10 -2
View File
@@ -1,5 +1,13 @@
#!/usr/bin/env node
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var msg = '';
if (require.main === module) {
@@ -14,7 +22,7 @@ if (require.main === module) {
process.stdin.on('end', () => {
var argv = process.argv.slice(2);
console.log(rewriteMsg(msg, argv[0]));
console.info(rewriteMsg(msg, argv[0]));
});
}
@@ -25,4 +33,4 @@ function rewriteMsg(msg, prNo) {
return lines.join('\n');
}
exports.rewriteMsg = rewriteMsg;
exports.rewriteMsg = rewriteMsg;
+11 -3
View File
@@ -1,5 +1,13 @@
#!/usr/bin/env node
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var json = '';
if (require.main === module) {
@@ -16,8 +24,8 @@ if (require.main === module) {
var obj = JSON.parse(json);
var argv = process.argv.slice(2);
extractPaths(obj, argv).forEach(function(line) {
console.log(line);
})
console.info(line);
});
});
}
@@ -51,4 +59,4 @@ function extractPaths(obj, paths) {
return lines;
}
exports.extractPaths = extractPaths;
exports.extractPaths = extractPaths;
@@ -1,5 +1,13 @@
#!/usr/bin/env node
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var assert = require("assert");
var extractPaths = require('./json_extract').extractPaths;
+14 -6
View File
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
'use strict';
// Build the dist/packages-dist directory in the same fashion as the legacy
@@ -51,11 +59,11 @@ module.exports = {
* @param {string} description Human-readable description of the build.
*/
function buildTargetPackages(destPath, enableIvy, description) {
console.log('##################################');
console.log(`${scriptPath}:`);
console.log(' Building @angular/* npm packages');
console.log(` Mode: ${description}`);
console.log('##################################');
console.info('##################################');
console.info(`${scriptPath}:`);
console.info(' Building @angular/* npm packages');
console.info(` Mode: ${description}`);
console.info('##################################');
// List of targets to build, e.g. core, common, compiler, etc. Note that we want to also remove
// all carriage return (`\r`) characters form the query output, because otherwise the carriage
@@ -79,7 +87,7 @@ function buildTargetPackages(destPath, enableIvy, description) {
const destDir = `${absDestPath}/${pkg}`;
if (test('-d', srcDir)) {
console.log(`# Copy artifacts to ${destDir}`);
console.info(`# Copy artifacts to ${destDir}`);
rm('-rf', destDir);
cp('-R', srcDir, destDir);
chmod('-R', 'u+w', destDir);
+1 -2
View File
@@ -1,6 +1,4 @@
#!/usr/bin/env node
'use strict';
/**
* @license
* Copyright Google Inc. All Rights Reserved.
@@ -8,6 +6,7 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
'use strict';
// Use process.cwd() so that this script is portable and can be used in /aio
// where this will require /aio/node_modules/puppeteer
const puppeteerPkgPath = require.resolve('puppeteer/package.json', {paths: [process.cwd()]});