mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
Changed tools/lint.py to lint the entire js and tests directories. (#900)
* Changed tools/lint.py to lint the entire js and tests directorys and sub directories, currently it was pointing at tsconfig and would only lint files that were part of js/main.ts or node_modules/typescript/lib/lib.esnext.d.ts and their dependencies * Broke the typescript linting out into separate steps for the main typescript programing and tests. * Fixed linting issues in ts tests.
This commit is contained in:
parent
ce9148943c
commit
6a649012bc
9 changed files with 15 additions and 10 deletions
|
@ -67,7 +67,7 @@ test(function consoleTestStringifyCircular() {
|
||||||
};
|
};
|
||||||
|
|
||||||
nestedObj.o = circularObj;
|
nestedObj.o = circularObj;
|
||||||
|
// tslint:disable-next-line:max-line-length
|
||||||
const nestedObjExpected = `{ num: 1, bool: true, str: "a", method: [Function: method], asyncMethod: [AsyncFunction: asyncMethod], generatorMethod: [GeneratorFunction: generatorMethod], un: undefined, nu: null, arrowFunc: [Function: arrowFunc], extendedClass: Extended { a: 1, b: 2 }, nFunc: [Function], extendedCstr: [Function: Extended], o: { num: 2, bool: false, str: "b", method: [Function: method], un: undefined, nu: null, nested: [Circular], emptyObj: [object], arr: [object], baseClass: [object] } }`;
|
const nestedObjExpected = `{ num: 1, bool: true, str: "a", method: [Function: method], asyncMethod: [AsyncFunction: asyncMethod], generatorMethod: [GeneratorFunction: generatorMethod], un: undefined, nu: null, arrowFunc: [Function: arrowFunc], extendedClass: Extended { a: 1, b: 2 }, nFunc: [Function], extendedCstr: [Function: Extended], o: { num: 2, bool: false, str: "b", method: [Function: method], un: undefined, nu: null, nested: [Circular], emptyObj: [object], arr: [object], baseClass: [object] } }`;
|
||||||
|
|
||||||
assertEqual(stringify(1), "1");
|
assertEqual(stringify(1), "1");
|
||||||
|
@ -88,11 +88,13 @@ test(function consoleTestStringifyCircular() {
|
||||||
assertEqual(stringify(JSON), "{}");
|
assertEqual(stringify(JSON), "{}");
|
||||||
assertEqual(
|
assertEqual(
|
||||||
stringify(console),
|
stringify(console),
|
||||||
|
// tslint:disable-next-line:max-line-length
|
||||||
"Console { printFunc: [Function], log: [Function], debug: [Function], info: [Function], dir: [Function], warn: [Function], error: [Function], assert: [Function] }"
|
"Console { printFunc: [Function], log: [Function], debug: [Function], info: [Function], dir: [Function], warn: [Function], error: [Function], assert: [Function] }"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test(function consoleTestStringifyWithDepth() {
|
test(function consoleTestStringifyWithDepth() {
|
||||||
|
// tslint:disable-next-line:no-any
|
||||||
const nestedObj: any = { a: { b: { c: { d: { e: { f: 42 } } } } } };
|
const nestedObj: any = { a: { b: { c: { d: { e: { f: 42 } } } } } };
|
||||||
assertEqual(
|
assertEqual(
|
||||||
stringifyArgs([nestedObj], { depth: 3 }),
|
stringifyArgs([nestedObj], { depth: 3 }),
|
||||||
|
|
|
@ -6,7 +6,7 @@ testPerm({ write: true }, function makeTempDirSyncSuccess() {
|
||||||
const dir1 = deno.makeTempDirSync({ prefix: "hello", suffix: "world" });
|
const dir1 = deno.makeTempDirSync({ prefix: "hello", suffix: "world" });
|
||||||
const dir2 = deno.makeTempDirSync({ prefix: "hello", suffix: "world" });
|
const dir2 = deno.makeTempDirSync({ prefix: "hello", suffix: "world" });
|
||||||
// Check that both dirs are different.
|
// Check that both dirs are different.
|
||||||
assert(dir1 != dir2);
|
assert(dir1 !== dir2);
|
||||||
for (const dir of [dir1, dir2]) {
|
for (const dir of [dir1, dir2]) {
|
||||||
// Check that the prefix and suffix are applied.
|
// Check that the prefix and suffix are applied.
|
||||||
const lastPart = dir.replace(/^.*[\\\/]/, "");
|
const lastPart = dir.replace(/^.*[\\\/]/, "");
|
||||||
|
@ -44,7 +44,7 @@ testPerm({ write: true }, async function makeTempDirSuccess() {
|
||||||
const dir1 = await deno.makeTempDir({ prefix: "hello", suffix: "world" });
|
const dir1 = await deno.makeTempDir({ prefix: "hello", suffix: "world" });
|
||||||
const dir2 = await deno.makeTempDir({ prefix: "hello", suffix: "world" });
|
const dir2 = await deno.makeTempDir({ prefix: "hello", suffix: "world" });
|
||||||
// Check that both dirs are different.
|
// Check that both dirs are different.
|
||||||
assert(dir1 != dir2);
|
assert(dir1 !== dir2);
|
||||||
for (const dir of [dir1, dir2]) {
|
for (const dir of [dir1, dir2]) {
|
||||||
// Check that the prefix and suffix are applied.
|
// Check that the prefix and suffix are applied.
|
||||||
const lastPart = dir.replace(/^.*[\\\/]/, "");
|
const lastPart = dir.replace(/^.*[\\\/]/, "");
|
||||||
|
|
|
@ -9,7 +9,7 @@ testPerm({ net: true }, function netListenClose() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testPerm({ net: true }, async function netDialListen() {
|
testPerm({ net: true }, async function netDialListen() {
|
||||||
let addr = "127.0.0.1:4500";
|
const addr = "127.0.0.1:4500";
|
||||||
const listener = deno.listen("tcp", addr);
|
const listener = deno.listen("tcp", addr);
|
||||||
listener.accept().then(async conn => {
|
listener.accept().then(async conn => {
|
||||||
await conn.write(new Uint8Array([1, 2, 3]));
|
await conn.write(new Uint8Array([1, 2, 3]));
|
||||||
|
|
|
@ -7,7 +7,7 @@ function assertSameContent(files: FileInfo[]) {
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
|
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if (file.name == "subdir") {
|
if (file.name === "subdir") {
|
||||||
assert(file.isDirectory());
|
assert(file.isDirectory());
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ test(async function timeoutSuccess() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test(async function timeoutArgs() {
|
test(async function timeoutArgs() {
|
||||||
let arg = 1;
|
const arg = 1;
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
setTimeout(
|
setTimeout(
|
||||||
(a, b, c) => {
|
(a, b, c) => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const id = setInterval(function() {
|
const id = setInterval(() => {
|
||||||
console.log("test");
|
console.log("test");
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(() => {
|
||||||
clearInterval(id);
|
clearInterval(id);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
|
@ -2,8 +2,8 @@ import { stdout, open, copy, args } from "deno";
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
for (let i = 1; i < args.length; i++) {
|
for (let i = 1; i < args.length; i++) {
|
||||||
let filename = args[i];
|
const filename = args[i];
|
||||||
let file = await open(filename);
|
const file = await open(filename);
|
||||||
await copy(stdout, file);
|
await copy(stdout, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// TODO Use https://localhost:4555/ but we need more infrastructure to
|
// TODO Use https://localhost:4555/ but we need more infrastructure to
|
||||||
// support verifying self-signed certificates.
|
// support verifying self-signed certificates.
|
||||||
|
// tslint:disable-next-line:max-line-length
|
||||||
import { printHello } from "https://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts";
|
import { printHello } from "https://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts";
|
||||||
|
|
||||||
printHello();
|
printHello();
|
||||||
|
|
|
@ -17,4 +17,6 @@ run([
|
||||||
"python", cpplint, "--filter=-build/include_subdir", "--repository=src",
|
"python", cpplint, "--filter=-build/include_subdir", "--repository=src",
|
||||||
"--extensions=cc,h", "--recursive", "src/."
|
"--extensions=cc,h", "--recursive", "src/."
|
||||||
])
|
])
|
||||||
|
|
||||||
run(["node", tslint, "-p", ".", "--exclude", "**/gen/**/*.ts"])
|
run(["node", tslint, "-p", ".", "--exclude", "**/gen/**/*.ts"])
|
||||||
|
run(["node", tslint, "./js/**/*_test.ts", "./tests/**/*.ts", "--exclude", "**/gen/**/*.ts"])
|
||||||
|
|
Loading…
Add table
Reference in a new issue