summaryrefslogtreecommitdiff
path: root/cli/rt
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-11-03 16:19:29 +0100
committerGitHub <noreply@github.com>2020-11-03 16:19:29 +0100
commit8e914be7420715620cad74fbb020c5e87ac875a2 (patch)
tree2fefc0111f85533de2bd24e54f70c6c1241e3d3b /cli/rt
parente736d0f60f6cdf38e2d317ee08a7125de9e57d69 (diff)
build: migrate to dlint (#8176)
This commit migrates repository from using "eslint" to "dlint" for linting JavaScript code.
Diffstat (limited to 'cli/rt')
-rw-r--r--cli/rt/02_console.js26
-rw-r--r--cli/rt/11_workers.js1
-rw-r--r--cli/rt/40_compiler_api.js2
-rw-r--r--cli/rt/40_write_file.js4
-rw-r--r--cli/rt/90_deno_ns.js265
5 files changed, 152 insertions, 146 deletions
diff --git a/cli/rt/02_console.js b/cli/rt/02_console.js
index bb2b6ea41..971837bd6 100644
--- a/cli/rt/02_console.js
+++ b/cli/rt/02_console.js
@@ -173,8 +173,6 @@
static kClearScreenDown = "\x1b[0J";
}
- /* eslint-disable @typescript-eslint/no-use-before-define */
-
function getClassInstanceName(instance) {
if (typeof instance != "object") {
return "";
@@ -194,7 +192,9 @@
if (customInspect in value && typeof value[customInspect] === "function") {
try {
return String(value[customInspect]());
- } catch {}
+ } catch {
+ // pass
+ }
}
// Might be Function/AsyncFunction/GeneratorFunction/AsyncGeneratorFunction
let cstrName = Object.getPrototypeOf(value)?.constructor?.name;
@@ -358,7 +358,6 @@
let order = "padStart";
if (value !== undefined) {
for (let i = 0; i < entries.length; i++) {
- /* eslint-disable @typescript-eslint/no-explicit-any */
if (
typeof value[i] !== "number" &&
typeof value[i] !== "bigint"
@@ -366,7 +365,6 @@
order = "padEnd";
break;
}
- /* eslint-enable */
}
}
// Each iteration creates a single line of grouped entries.
@@ -483,6 +481,7 @@
.replace(/\t/g, "\\t")
.replace(/\v/g, "\\v")
.replace(
+ // deno-lint-ignore no-control-regex
/[\x00-\x1f\x7f-\x9f]/g,
(c) => "\\x" + c.charCodeAt(0).toString(16).padStart(2, "0"),
);
@@ -519,11 +518,12 @@
) {
const green = maybeColor(colors.green, inspectOptions);
switch (typeof value) {
- case "string":
+ case "string": {
const trunc = value.length > STR_ABBREVIATE_SIZE
? value.slice(0, STR_ABBREVIATE_SIZE) + "..."
: value;
return green(quoteString(trunc)); // Quoted strings are green
+ }
default:
return inspectValue(value, ctx, level, inspectOptions);
}
@@ -784,7 +784,7 @@
: red(`[Thrown ${error.name}: ${error.message}]`);
entries.push(`${maybeQuoteString(key)}: ${inspectedValue}`);
} else {
- let descriptor = Object.getOwnPropertyDescriptor(value, key);
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
if (descriptor.get !== undefined && descriptor.set !== undefined) {
entries.push(`${maybeQuoteString(key)}: [Getter/Setter]`);
} else if (descriptor.get !== undefined) {
@@ -818,7 +818,7 @@
: red(`Thrown ${error.name}: ${error.message}`);
entries.push(`[${maybeQuoteSymbol(key)}]: ${inspectedValue}`);
} else {
- let descriptor = Object.getOwnPropertyDescriptor(value, key);
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
if (descriptor.get !== undefined && descriptor.set !== undefined) {
entries.push(`[${maybeQuoteSymbol(key)}]: [Getter/Setter]`);
} else if (descriptor.get !== undefined) {
@@ -867,7 +867,9 @@
if (customInspect in value && typeof value[customInspect] === "function") {
try {
return String(value[customInspect]());
- } catch {}
+ } catch {
+ // pass
+ }
}
// This non-unique symbol is used to support op_crates, ie.
// in op_crates/web we don't want to depend on unique "Deno.customInspect"
@@ -880,7 +882,9 @@
) {
try {
return String(value[nonUniqueCustomInspect]());
- } catch {}
+ } catch {
+ // pass
+ }
}
if (value instanceof Error) {
return String(value.stack);
@@ -1158,7 +1162,7 @@
let inValue = false;
let currentKey = null;
let parenthesesDepth = 0;
- currentPart = "";
+ let currentPart = "";
for (let i = 0; i < cssString.length; i++) {
const c = cssString[i];
if (c == "(") {
diff --git a/cli/rt/11_workers.js b/cli/rt/11_workers.js
index dcf98aee6..36a2fd61b 100644
--- a/cli/rt/11_workers.js
+++ b/cli/rt/11_workers.js
@@ -1,5 +1,4 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-/* eslint-disable @typescript-eslint/no-explicit-any */
((window) => {
const core = window.Deno.core;
diff --git a/cli/rt/40_compiler_api.js b/cli/rt/40_compiler_api.js
index db12c857d..ea963b67b 100644
--- a/cli/rt/40_compiler_api.js
+++ b/cli/rt/40_compiler_api.js
@@ -81,7 +81,7 @@
});
/** @type {{ emittedFiles: Record<string, string>, diagnostics: any[] }} */
const result = await opCompile(payload);
- let output = result.emittedFiles["deno:///bundle.js"];
+ const output = result.emittedFiles["deno:///bundle.js"];
util.assert(output);
const maybeDiagnostics = result.diagnostics.length === 0
? undefined
diff --git a/cli/rt/40_write_file.js b/cli/rt/40_write_file.js
index 2f54aa1cf..7a9cb1f40 100644
--- a/cli/rt/40_write_file.js
+++ b/cli/rt/40_write_file.js
@@ -18,7 +18,7 @@
}
}
- const openOptions = !!options.append
+ const openOptions = options.append
? { write: true, create: true, append: true }
: { write: true, create: true, truncate: true };
const file = openSync(path, openOptions);
@@ -48,7 +48,7 @@
}
}
- const openOptions = !!options.append
+ const openOptions = options.append
? { write: true, create: true, append: true }
: { write: true, create: true, truncate: true };
const file = await open(path, openOptions);
diff --git a/cli/rt/90_deno_ns.js b/cli/rt/90_deno_ns.js
index 6a9b9cc0e..9188788ec 100644
--- a/cli/rt/90_deno_ns.js
+++ b/cli/rt/90_deno_ns.js
@@ -1,134 +1,137 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-__bootstrap.denoNs = {
- test: __bootstrap.testing.test,
- metrics: __bootstrap.metrics.metrics,
- Process: __bootstrap.process.Process,
- run: __bootstrap.process.run,
- isatty: __bootstrap.tty.isatty,
- writeFileSync: __bootstrap.writeFile.writeFileSync,
- writeFile: __bootstrap.writeFile.writeFile,
- writeTextFileSync: __bootstrap.writeFile.writeTextFileSync,
- writeTextFile: __bootstrap.writeFile.writeTextFile,
- readTextFile: __bootstrap.readFile.readTextFile,
- readTextFileSync: __bootstrap.readFile.readTextFileSync,
- readFile: __bootstrap.readFile.readFile,
- readFileSync: __bootstrap.readFile.readFileSync,
- watchFs: __bootstrap.fsEvents.watchFs,
- chmodSync: __bootstrap.fs.chmodSync,
- chmod: __bootstrap.fs.chmod,
- chown: __bootstrap.fs.chown,
- chownSync: __bootstrap.fs.chownSync,
- copyFileSync: __bootstrap.fs.copyFileSync,
- cwd: __bootstrap.fs.cwd,
- makeTempDirSync: __bootstrap.fs.makeTempDirSync,
- makeTempDir: __bootstrap.fs.makeTempDir,
- makeTempFileSync: __bootstrap.fs.makeTempFileSync,
- makeTempFile: __bootstrap.fs.makeTempFile,
- mkdirSync: __bootstrap.fs.mkdirSync,
- mkdir: __bootstrap.fs.mkdir,
- chdir: __bootstrap.fs.chdir,
- copyFile: __bootstrap.fs.copyFile,
- readDirSync: __bootstrap.fs.readDirSync,
- readDir: __bootstrap.fs.readDir,
- readLinkSync: __bootstrap.fs.readLinkSync,
- readLink: __bootstrap.fs.readLink,
- realPathSync: __bootstrap.fs.realPathSync,
- realPath: __bootstrap.fs.realPath,
- removeSync: __bootstrap.fs.removeSync,
- remove: __bootstrap.fs.remove,
- renameSync: __bootstrap.fs.renameSync,
- rename: __bootstrap.fs.rename,
- version: __bootstrap.version.version,
- build: __bootstrap.build.build,
- statSync: __bootstrap.fs.statSync,
- lstatSync: __bootstrap.fs.lstatSync,
- stat: __bootstrap.fs.stat,
- lstat: __bootstrap.fs.lstat,
- truncateSync: __bootstrap.fs.truncateSync,
- truncate: __bootstrap.fs.truncate,
- errors: __bootstrap.errors.errors,
- customInspect: __bootstrap.console.customInspect,
- inspect: __bootstrap.console.inspect,
- env: __bootstrap.os.env,
- exit: __bootstrap.os.exit,
- execPath: __bootstrap.os.execPath,
- Buffer: __bootstrap.buffer.Buffer,
- readAll: __bootstrap.buffer.readAll,
- readAllSync: __bootstrap.buffer.readAllSync,
- writeAll: __bootstrap.buffer.writeAll,
- writeAllSync: __bootstrap.buffer.writeAllSync,
- copy: __bootstrap.io.copy,
- iter: __bootstrap.io.iter,
- iterSync: __bootstrap.io.iterSync,
- SeekMode: __bootstrap.io.SeekMode,
- read: __bootstrap.io.read,
- readSync: __bootstrap.io.readSync,
- write: __bootstrap.io.write,
- writeSync: __bootstrap.io.writeSync,
- File: __bootstrap.files.File,
- open: __bootstrap.files.open,
- openSync: __bootstrap.files.openSync,
- create: __bootstrap.files.create,
- createSync: __bootstrap.files.createSync,
- stdin: __bootstrap.files.stdin,
- stdout: __bootstrap.files.stdout,
- stderr: __bootstrap.files.stderr,
- seek: __bootstrap.files.seek,
- seekSync: __bootstrap.files.seekSync,
- connect: __bootstrap.net.connect,
- listen: __bootstrap.net.listen,
- connectTls: __bootstrap.tls.connectTls,
- listenTls: __bootstrap.tls.listenTls,
- sleepSync: __bootstrap.timers.sleepSync,
- fsyncSync: __bootstrap.fs.fsyncSync,
- fsync: __bootstrap.fs.fsync,
- fdatasyncSync: __bootstrap.fs.fdatasyncSync,
- fdatasync: __bootstrap.fs.fdatasync,
-};
+((window) => {
+ const __bootstrap = window.__bootstrap;
+ __bootstrap.denoNs = {
+ test: __bootstrap.testing.test,
+ metrics: __bootstrap.metrics.metrics,
+ Process: __bootstrap.process.Process,
+ run: __bootstrap.process.run,
+ isatty: __bootstrap.tty.isatty,
+ writeFileSync: __bootstrap.writeFile.writeFileSync,
+ writeFile: __bootstrap.writeFile.writeFile,
+ writeTextFileSync: __bootstrap.writeFile.writeTextFileSync,
+ writeTextFile: __bootstrap.writeFile.writeTextFile,
+ readTextFile: __bootstrap.readFile.readTextFile,
+ readTextFileSync: __bootstrap.readFile.readTextFileSync,
+ readFile: __bootstrap.readFile.readFile,
+ readFileSync: __bootstrap.readFile.readFileSync,
+ watchFs: __bootstrap.fsEvents.watchFs,
+ chmodSync: __bootstrap.fs.chmodSync,
+ chmod: __bootstrap.fs.chmod,
+ chown: __bootstrap.fs.chown,
+ chownSync: __bootstrap.fs.chownSync,
+ copyFileSync: __bootstrap.fs.copyFileSync,
+ cwd: __bootstrap.fs.cwd,
+ makeTempDirSync: __bootstrap.fs.makeTempDirSync,
+ makeTempDir: __bootstrap.fs.makeTempDir,
+ makeTempFileSync: __bootstrap.fs.makeTempFileSync,
+ makeTempFile: __bootstrap.fs.makeTempFile,
+ mkdirSync: __bootstrap.fs.mkdirSync,
+ mkdir: __bootstrap.fs.mkdir,
+ chdir: __bootstrap.fs.chdir,
+ copyFile: __bootstrap.fs.copyFile,
+ readDirSync: __bootstrap.fs.readDirSync,
+ readDir: __bootstrap.fs.readDir,
+ readLinkSync: __bootstrap.fs.readLinkSync,
+ readLink: __bootstrap.fs.readLink,
+ realPathSync: __bootstrap.fs.realPathSync,
+ realPath: __bootstrap.fs.realPath,
+ removeSync: __bootstrap.fs.removeSync,
+ remove: __bootstrap.fs.remove,
+ renameSync: __bootstrap.fs.renameSync,
+ rename: __bootstrap.fs.rename,
+ version: __bootstrap.version.version,
+ build: __bootstrap.build.build,
+ statSync: __bootstrap.fs.statSync,
+ lstatSync: __bootstrap.fs.lstatSync,
+ stat: __bootstrap.fs.stat,
+ lstat: __bootstrap.fs.lstat,
+ truncateSync: __bootstrap.fs.truncateSync,
+ truncate: __bootstrap.fs.truncate,
+ errors: __bootstrap.errors.errors,
+ customInspect: __bootstrap.console.customInspect,
+ inspect: __bootstrap.console.inspect,
+ env: __bootstrap.os.env,
+ exit: __bootstrap.os.exit,
+ execPath: __bootstrap.os.execPath,
+ Buffer: __bootstrap.buffer.Buffer,
+ readAll: __bootstrap.buffer.readAll,
+ readAllSync: __bootstrap.buffer.readAllSync,
+ writeAll: __bootstrap.buffer.writeAll,
+ writeAllSync: __bootstrap.buffer.writeAllSync,
+ copy: __bootstrap.io.copy,
+ iter: __bootstrap.io.iter,
+ iterSync: __bootstrap.io.iterSync,
+ SeekMode: __bootstrap.io.SeekMode,
+ read: __bootstrap.io.read,
+ readSync: __bootstrap.io.readSync,
+ write: __bootstrap.io.write,
+ writeSync: __bootstrap.io.writeSync,
+ File: __bootstrap.files.File,
+ open: __bootstrap.files.open,
+ openSync: __bootstrap.files.openSync,
+ create: __bootstrap.files.create,
+ createSync: __bootstrap.files.createSync,
+ stdin: __bootstrap.files.stdin,
+ stdout: __bootstrap.files.stdout,
+ stderr: __bootstrap.files.stderr,
+ seek: __bootstrap.files.seek,
+ seekSync: __bootstrap.files.seekSync,
+ connect: __bootstrap.net.connect,
+ listen: __bootstrap.net.listen,
+ connectTls: __bootstrap.tls.connectTls,
+ listenTls: __bootstrap.tls.listenTls,
+ sleepSync: __bootstrap.timers.sleepSync,
+ fsyncSync: __bootstrap.fs.fsyncSync,
+ fsync: __bootstrap.fs.fsync,
+ fdatasyncSync: __bootstrap.fs.fdatasyncSync,
+ fdatasync: __bootstrap.fs.fdatasync,
+ };
-__bootstrap.denoNsUnstable = {
- signal: __bootstrap.signals.signal,
- signals: __bootstrap.signals.signals,
- Signal: __bootstrap.signals.Signal,
- SignalStream: __bootstrap.signals.SignalStream,
- transpileOnly: __bootstrap.compilerApi.transpileOnly,
- compile: __bootstrap.compilerApi.compile,
- bundle: __bootstrap.compilerApi.bundle,
- permissions: __bootstrap.permissions.permissions,
- Permissions: __bootstrap.permissions.Permissions,
- PermissionStatus: __bootstrap.permissions.PermissionStatus,
- openPlugin: __bootstrap.plugins.openPlugin,
- kill: __bootstrap.process.kill,
- setRaw: __bootstrap.tty.setRaw,
- consoleSize: __bootstrap.tty.consoleSize,
- DiagnosticCategory: __bootstrap.diagnostics.DiagnosticCategory,
- loadavg: __bootstrap.os.loadavg,
- hostname: __bootstrap.os.hostname,
- osRelease: __bootstrap.os.osRelease,
- systemMemoryInfo: __bootstrap.os.systemMemoryInfo,
- systemCpuInfo: __bootstrap.os.systemCpuInfo,
- applySourceMap: __bootstrap.errorStack.opApplySourceMap,
- formatDiagnostics: __bootstrap.errorStack.opFormatDiagnostics,
- shutdown: __bootstrap.net.shutdown,
- ShutdownMode: __bootstrap.net.ShutdownMode,
- listen: __bootstrap.netUnstable.listen,
- connect: __bootstrap.netUnstable.connect,
- listenDatagram: __bootstrap.netUnstable.listenDatagram,
- startTls: __bootstrap.tls.startTls,
- fstatSync: __bootstrap.fs.fstatSync,
- fstat: __bootstrap.fs.fstat,
- ftruncateSync: __bootstrap.fs.ftruncateSync,
- ftruncate: __bootstrap.fs.ftruncate,
- umask: __bootstrap.fs.umask,
- link: __bootstrap.fs.link,
- linkSync: __bootstrap.fs.linkSync,
- futime: __bootstrap.fs.futime,
- futimeSync: __bootstrap.fs.futimeSync,
- utime: __bootstrap.fs.utime,
- utimeSync: __bootstrap.fs.utimeSync,
- symlink: __bootstrap.fs.symlink,
- symlinkSync: __bootstrap.fs.symlinkSync,
- HttpClient: __bootstrap.fetch.HttpClient,
- createHttpClient: __bootstrap.fetch.createHttpClient,
-};
+ __bootstrap.denoNsUnstable = {
+ signal: __bootstrap.signals.signal,
+ signals: __bootstrap.signals.signals,
+ Signal: __bootstrap.signals.Signal,
+ SignalStream: __bootstrap.signals.SignalStream,
+ transpileOnly: __bootstrap.compilerApi.transpileOnly,
+ compile: __bootstrap.compilerApi.compile,
+ bundle: __bootstrap.compilerApi.bundle,
+ permissions: __bootstrap.permissions.permissions,
+ Permissions: __bootstrap.permissions.Permissions,
+ PermissionStatus: __bootstrap.permissions.PermissionStatus,
+ openPlugin: __bootstrap.plugins.openPlugin,
+ kill: __bootstrap.process.kill,
+ setRaw: __bootstrap.tty.setRaw,
+ consoleSize: __bootstrap.tty.consoleSize,
+ DiagnosticCategory: __bootstrap.diagnostics.DiagnosticCategory,
+ loadavg: __bootstrap.os.loadavg,
+ hostname: __bootstrap.os.hostname,
+ osRelease: __bootstrap.os.osRelease,
+ systemMemoryInfo: __bootstrap.os.systemMemoryInfo,
+ systemCpuInfo: __bootstrap.os.systemCpuInfo,
+ applySourceMap: __bootstrap.errorStack.opApplySourceMap,
+ formatDiagnostics: __bootstrap.errorStack.opFormatDiagnostics,
+ shutdown: __bootstrap.net.shutdown,
+ ShutdownMode: __bootstrap.net.ShutdownMode,
+ listen: __bootstrap.netUnstable.listen,
+ connect: __bootstrap.netUnstable.connect,
+ listenDatagram: __bootstrap.netUnstable.listenDatagram,
+ startTls: __bootstrap.tls.startTls,
+ fstatSync: __bootstrap.fs.fstatSync,
+ fstat: __bootstrap.fs.fstat,
+ ftruncateSync: __bootstrap.fs.ftruncateSync,
+ ftruncate: __bootstrap.fs.ftruncate,
+ umask: __bootstrap.fs.umask,
+ link: __bootstrap.fs.link,
+ linkSync: __bootstrap.fs.linkSync,
+ futime: __bootstrap.fs.futime,
+ futimeSync: __bootstrap.fs.futimeSync,
+ utime: __bootstrap.fs.utime,
+ utimeSync: __bootstrap.fs.utimeSync,
+ symlink: __bootstrap.fs.symlink,
+ symlinkSync: __bootstrap.fs.symlinkSync,
+ HttpClient: __bootstrap.fetch.HttpClient,
+ createHttpClient: __bootstrap.fetch.createHttpClient,
+ };
+})(this);