diff --git a/types/activex-adodb/activex-adodb-tests.ts b/types/activex-adodb/activex-adodb-tests.ts index cadb01c15e..22680d963c 100644 --- a/types/activex-adodb/activex-adodb-tests.ts +++ b/types/activex-adodb/activex-adodb-tests.ts @@ -14,9 +14,7 @@ let obj5 = new ActiveXObject('ADODB.Stream'); let pathToExcelFile = 'C:\\path\\to\\excel\\file.xlsx'; let conn = new ActiveXObject('ADODB.Connection'); conn.Provider = 'Microsoft.ACE.OLEDB.12.0'; -conn.ConnectionString = - 'Data Source="' + pathToExcelFile + '";' + - 'Extended Properties="Excel 12.0;HDR=Yes"'; +conn.ConnectionString = `Data Source="${pathToExcelFile}";Extended Properties="Excel 12.0;HDR=Yes"`; conn.Open(); // create a Command to access the data diff --git a/types/activex-scripting/activex-scripting-tests.ts b/types/activex-scripting/activex-scripting-tests.ts index 3be8e1ccf5..2297548b81 100644 --- a/types/activex-scripting/activex-scripting-tests.ts +++ b/types/activex-scripting/activex-scripting-tests.ts @@ -40,9 +40,9 @@ function showFileAttributes(file: Scripting.File) { function showFreeSpace(drvPath: string) { const fso = new ActiveXObject('Scripting.FileSystemObject'); const d = fso.GetDrive(fso.GetDriveName(drvPath)); - let s = 'Drive ' + drvPath + ' - '; + let s = `Drive ${drvPath} - `; s += d.VolumeName + '
'; - s += 'Free Space: ' + d.FreeSpace / 1024 + ' Kbytes'; + s += `Free Space: ${d.FreeSpace / 1024} Kbytes`; return (s); } diff --git a/types/activex-wia/activex-wia-tests.ts b/types/activex-wia/activex-wia-tests.ts index b765083870..d8046ef319 100644 --- a/types/activex-wia/activex-wia-tests.ts +++ b/types/activex-wia/activex-wia-tests.ts @@ -37,14 +37,14 @@ let e = new Enumerator(dev.Properties); // no foreach over Active e.moveFirst(); while (!e.atEnd()) { const p = e.item(); - let s = p.Name + ' (' + p.PropertyID + ') = '; + let s = `${p.Name} (${p.PropertyID}) = `; if (p.IsVector) { s += '[vector of data]'; } else { s += p.Value; if (p.SubType !== WIA.WiaSubType.UnspecifiedSubType) { if (p.Value !== p.SubTypeDefault) { - s += ' (Default = ' + p.SubTypeDefault + ')'; + s += ` (Default = ${p.SubTypeDefault})`; } } } @@ -70,7 +70,7 @@ while (!e.atEnd()) { s += ']'; break; case WIA.WiaSubType.RangeSubType: - s += ' [valid values in the range from ' + p.SubTypeMin + ' to ' + p.SubTypeMax + ' in increments of ' + p.SubTypeStep + ']'; + s += ` [valid values in the range from ${p.SubTypeMin} to ${p.SubTypeMax} in increments of ${p.SubTypeStep}]`; break; } } diff --git a/types/algebra.js/algebra.js-tests.ts b/types/algebra.js/algebra.js-tests.ts index 7b6cebfab8..0ecaccd2ef 100644 --- a/types/algebra.js/algebra.js-tests.ts +++ b/types/algebra.js/algebra.js-tests.ts @@ -36,7 +36,7 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js'; let expr1 = new Expression("a").add("b").add("c"); let expr2 = new Expression("c").subtract("b"); let expr3 = expr1.subtract(expr2); - expr1.toString() + " - (" + expr2.toString() + ") = " + expr3.toString(); + `${expr1.toString()} - (${expr2.toString()}) = ${expr3.toString()}`; expr1 = new Expression("x"); expr1 = expr1.add(2); @@ -46,7 +46,7 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js'; expr2 = expr2.multiply(new Fraction(1, 3)); expr2 = expr2.add(4); expr3 = expr1.multiply(expr2); - "(" + expr1.toString() + ")(" + expr2.toString() + ") = " + expr3.toString(); + `(${expr1.toString()})(${expr2.toString()}) = ${expr3.toString()}`; x = new Expression("x").divide(2).divide(new Fraction(1, 5)); x.toString(); @@ -58,7 +58,7 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js'; sum.toString(); exp = new Expression("x").add(2); const exp3 = exp.pow(3); - "(" + exp.toString() + ")^3 = " + exp3.toString(); + `(${exp.toString()})^3 = ${exp3.toString()}`; let expr = new Expression("x"); expr = expr.multiply(2); diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index eec64baed0..2d56862174 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -620,7 +620,7 @@ function test_angular_forEach() { const log: string[] = []; angular.forEach(values, (value, key, obj) => { obj[key] = value; - this.push(key + ': ' + value); + this.push(`${key}: ${value}`); }, log); // expect(log).toEqual(['name: misko', 'gender: male']); } diff --git a/types/awesomplete/awesomplete-tests.ts b/types/awesomplete/awesomplete-tests.ts index 6cea0e1bca..f9ff4fed77 100644 --- a/types/awesomplete/awesomplete-tests.ts +++ b/types/awesomplete/awesomplete-tests.ts @@ -35,7 +35,7 @@ new Awesomplete('input[type="email"]', { "hotmail.co.uk", "mac.com", "me.com", "mail.com", "msn.com", "live.com", "sbcglobal.net", "verizon.net", "yahoo.com", "yahoo.co.uk"], data: (text: string, input: string) => { - return input.slice(0, input.indexOf("@")) + "@" + text; + return `${input.slice(0, input.indexOf("@"))}@${text}`; }, filter: Awesomplete.FILTER_STARTSWITH }); @@ -47,7 +47,7 @@ new Awesomplete('input[data-multiple]', { replace: (text: string) => { const before = this.input.value.match(/^.+,\s*|/)[0]; - this.input.value = before + text + ", "; + this.input.value = `${before}${text}, `; } }); diff --git a/types/bagpipes/tslint.json b/types/bagpipes/tslint.json index a4bcc87748..03a7f353ed 100755 --- a/types/bagpipes/tslint.json +++ b/types/bagpipes/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "callable-types": false + // TODOs + "callable-types": false, + "no-object-literal-type-assertion": false } } diff --git a/types/better-sqlite3/better-sqlite3-tests.ts b/types/better-sqlite3/better-sqlite3-tests.ts index 0d9ebda2aa..43d78e1503 100644 --- a/types/better-sqlite3/better-sqlite3-tests.ts +++ b/types/better-sqlite3/better-sqlite3-tests.ts @@ -1,7 +1,7 @@ import * as Database from 'better-sqlite3'; -let integer = Database.Integer(1); -let err = new Database.SqliteError('ok', 'ok'); +const integer = Database.Integer(1); +const err = new Database.SqliteError('ok', 'ok'); let db = Database('.'); db = new Database('.', {memory: true}); @@ -15,7 +15,7 @@ db.register({name: 'noop', deterministic: true, varargs: true}, () => {}); db.defaultSafeIntegers(); db.defaultSafeIntegers(true); -let stmt = db.prepare('SELECT * FROM test WHERE name == ?;'); +const stmt = db.prepare('SELECT * FROM test WHERE name == ?;'); stmt.get(['name']); stmt.all({name: 'name'}); stmt.each('name', (row: {name: string}) => {}); @@ -26,7 +26,7 @@ stmt.bind('name'); stmt.safeIntegers(); stmt.safeIntegers(true); -let trans = db.transaction(['INSERT INTO test(name) VALUES(?);']); +const trans = db.transaction(['INSERT INTO test(name) VALUES(?);']); trans.run('name'); trans.bind('name'); trans.run(); diff --git a/types/better-sqlite3/index.d.ts b/types/better-sqlite3/index.d.ts index 3b6834b3cf..efd6d5f4d9 100644 --- a/types/better-sqlite3/index.d.ts +++ b/types/better-sqlite3/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for better-sqlite3 3.1 // Project: http://github.com/JoshuaWise/better-sqlite3 -// Definitions by: Ben Davies +// Definitions by: Ben Davies // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/bootstrap-slider/bootstrap-slider-tests.ts b/types/bootstrap-slider/bootstrap-slider-tests.ts index 8b59a25a36..2073a3de9d 100644 --- a/types/bootstrap-slider/bootstrap-slider-tests.ts +++ b/types/bootstrap-slider/bootstrap-slider-tests.ts @@ -12,7 +12,7 @@ $(() => { $('#ex2').slider({}); const RGBChange = () => { - $('#RGB').css('background', 'rgb(' + r.getValue() + ',' + g.getValue() + ',' + b.getValue() + ')'); + $('#RGB').css('background', `rgb(${r.getValue()},${g.getValue()},${b.getValue()})`); }; const r = $('#R').slider() diff --git a/types/chart.js/chart.js-tests.ts b/types/chart.js/chart.js-tests.ts index 4ba3c4fc4c..a4cccb0bae 100644 --- a/types/chart.js/chart.js-tests.ts +++ b/types/chart.js/chart.js-tests.ts @@ -6,7 +6,7 @@ import { Chart, ChartData } from 'chart.js'; const chart: Chart = new Chart(new CanvasRenderingContext2D(), { type: 'bar', - data: { + data: { labels: ['group 1'], datasets: [ { diff --git a/types/connect-history-api-fallback/connect-history-api-fallback-tests.ts b/types/connect-history-api-fallback/connect-history-api-fallback-tests.ts index 382e436366..6095d2fecb 100644 --- a/types/connect-history-api-fallback/connect-history-api-fallback-tests.ts +++ b/types/connect-history-api-fallback/connect-history-api-fallback-tests.ts @@ -57,7 +57,7 @@ historyApiFallback({ { from: /^\/libs\/(.*)$/, to(context) { - return '/' + context.match[2] + '/' + context.match[3]; + return `/${context.match[2]}/${context.match[3]}`; } } ] diff --git a/types/cordova-sqlite-storage/cordova-sqlite-storage-tests.ts b/types/cordova-sqlite-storage/cordova-sqlite-storage-tests.ts index 6d2e3c3454..215be1d3de 100644 --- a/types/cordova-sqlite-storage/cordova-sqlite-storage-tests.ts +++ b/types/cordova-sqlite-storage/cordova-sqlite-storage-tests.ts @@ -104,13 +104,13 @@ function sampleWithPRAGMA() { }); tx.executeSql("INSERT INTO test_table (data, data_num) VALUES (?,?)", ["test", 100], (tx, res) => { - console.log("insertId: " + res.insertId + " -- probably 1"); - console.log("rowsAffected: " + res.rowsAffected + " -- should be 1"); + console.log(`insertId: ${res.insertId} -- probably 1`); + console.log(`rowsAffected: ${res.rowsAffected} -- should be 1`); db.transaction(tx => { tx.executeSql("select count(id) as cnt from test_table;", [], (tx, res) => { - console.log("res.rows.length: " + res.rows.length + " -- should be 1"); - console.log("res.rows.item(0).cnt: " + res.rows.item(0).cnt + " -- should be 1"); + console.log(`res.rows.length: ${res.rows.length} -- should be 1`); + console.log(`res.rows.item(0).cnt: ${res.rows.item(0).cnt} -- should be 1`); }); }); @@ -135,12 +135,12 @@ function sampleWithTransactionLevelNesting() { tx.executeSql('CREATE TABLE IF NOT EXISTS test_table (id integer primary key, data text, data_num integer)'); tx.executeSql("INSERT INTO test_table (data, data_num) VALUES (?,?)", ["test", 100], (tx, res) => { - console.log("insertId: " + res.insertId + " -- probably 1"); - console.log("rowsAffected: " + res.rowsAffected + " -- should be 1"); + console.log(`insertId: ${res.insertId} -- probably 1`); + console.log(`rowsAffected: ${res.rowsAffected} -- should be 1`); tx.executeSql("select count(id) as cnt from test_table;", [], (tx, res) => { - console.log("res.rows.length: " + res.rows.length + " -- should be 1"); - console.log("res.rows.item(0).cnt: " + res.rows.item(0).cnt + " -- should be 1"); + console.log(`res.rows.length: ${res.rows.length} -- should be 1`); + console.log(`res.rows.item(0).cnt: ${res.rows.item(0).cnt} -- should be 1`); }); }, (tx, e) => { console.log("ERROR: " + e.message); diff --git a/types/cwise/cwise-tests.ts b/types/cwise/cwise-tests.ts index 66843adfe2..b759fb1a0c 100644 --- a/types/cwise/cwise-tests.ts +++ b/types/cwise/cwise-tests.ts @@ -66,7 +66,7 @@ tape("binary", (t) => { const binary = cwise({ args: ["array", "array", "scalar", "shape", "index"], body(a: number, b: number, t: tape.Test, s: number[], idx: number) { - if (!(a === 0)) t.fail("idx:" + idx + ", shape:" + s + ",a:" + a); + if (!(a === 0)) t.fail(`idx:${idx}, shape:${s},a:${a}`); a = b + 1001; } }); @@ -80,7 +80,7 @@ tape("binary", (t) => { binary(P, Q, t); for (let i = 0; i < P.shape[0]; ++i) { if (!(P.get(i) === i + 1001)) { - t.fail(testName + "; encountered " + P.get(i) + " instead of " + (i + 1001) + " at " + i); + t.fail(`${testName}; encountered ${P.get(i)} instead of ${(i + 1001)} at ${i}`); return; } } @@ -128,7 +128,7 @@ tape("binary", (t) => { for (let i = 0; i < P.shape[0]; ++i) { for (let j = 0; j < P.shape[1]; ++j) { if (!(P.get(i, j) === i * 1000 + j + 1001)) { - t.fail(testName + "; encountered " + P.get(i, j) + " instead of " + (i * 1000 + j + 1001) + " at (" + i + "," + j + ")"); + t.fail(`${testName}; encountered ${P.get(i, j)} instead of ${(i * 1000 + j + 1001)} at (" + i + "," + j + ")`); return; } } @@ -163,7 +163,7 @@ function bundleCasesFrom(i: number) { if (i >= cases.length) return; const b = browserify(); b.ignore("tape"); - b.add(__dirname + "/" + cases[i] + ".js"); + b.add(`${__dirname}/${cases[i]}.js`); b.transform(path.normalize(__dirname + "/../cwise.js")); tape(cases[i], (t) => { // Without nested tests, the asynchronous nature of bundle causes issues with tape... b.bundle((err, src) => { @@ -209,7 +209,7 @@ tape("fill", (t) => { for (let i = 0; i < xlen; i++) { for (let j = 0; j < ylen; j++) { - t.equals(array.get(i, j), 0, 'fill (' + i + ',' + j + ')'); + t.equals(array.get(i, j), 0, `fill (${i},${j})`); } } @@ -219,7 +219,7 @@ tape("fill", (t) => { for (let i = 0; i < xlen; i++) { for (let j = 0; j < ylen; j++) { - t.equals(array.get(i, j), 10 * (i + j), 'fill (' + i + ',' + j + ')'); + t.equals(array.get(i, j), 10 * (i + j), `fill (${i},${j})`); } } @@ -231,7 +231,7 @@ tape("offset", (t) => { const binary = cwise({ args: ["array", "array", { offset: [1], array: 1 }, "scalar", "shape", "index"], body(a, b, c, t, s, idx) { - if (!(a === 0)) t.fail("idx:" + idx + ", shape:" + s + ",a:" + a); + if (!(a === 0)) t.fail(`idx:${idx}, shape:${s},a:${a}`); a = c + b + 1000; } }); @@ -246,7 +246,7 @@ tape("offset", (t) => { binary(P, Q.hi(Q.shape[0] - 1), t); for (let i = 0; i < P.shape[0]; ++i) { if (!(P.get(i) === 2 * i + 1001)) { - t.fail(testName + "; encountered " + P.get(i) + " instead of " + (2 * i + 1001) + " at " + i); + t.fail(`${testName}; encountered ${P.get(i)} instead of ${2 * i + 1001} at ${i}`); return; } } @@ -292,7 +292,7 @@ tape("unary", (t) => { unary(arr); for (let i = 0; i < arr.shape[0]; ++i) { if (!(arr.get(i) === i + 1)) { - t.fail(testName + "; encountered " + arr.get(i) + " instead of " + (i + 1) + " at " + i); + t.fail(`${testName}; encountered ${arr.get(i)} instead of ${i + 1} at ${i}`); return; } } @@ -336,7 +336,7 @@ tape("unary", (t) => { for (let i = 0; i < arr.shape[0]; ++i) { for (let j = 0; j < arr.shape[1]; ++j) { if (!(arr.get(i, j) === 1 + i + j * arr.shape[0])) { - t.fail(testName + "; encountered " + arr.get(i, j) + " instead of " + (1 + i + j * arr.shape[0]) + " at (" + i + "," + j + ")"); + t.fail(`${testName}; encountered ${arr.get(i, j)} instead of ${1 + i + j * arr.shape[0]} at (${i},${j})`); return; } } diff --git a/types/d3-drag/tslint.json b/types/d3-drag/tslint.json index 08b1465cd6..b8825c1674 100644 --- a/types/d3-drag/tslint.json +++ b/types/d3-drag/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { + // TODO + "no-this-assignment": false, "unified-signatures": false } } diff --git a/types/d3-force/tslint.json b/types/d3-force/tslint.json index 08b1465cd6..b8825c1674 100644 --- a/types/d3-force/tslint.json +++ b/types/d3-force/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { + // TODO + "no-this-assignment": false, "unified-signatures": false } } diff --git a/types/d3-geo/tslint.json b/types/d3-geo/tslint.json index 657f2f02f7..680a816ce2 100644 --- a/types/d3-geo/tslint.json +++ b/types/d3-geo/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { + // TODO + "no-this-assignment": false, "unified-signatures": false, "max-line-length": [false, 200] } diff --git a/types/d3-queue/tslint.json b/types/d3-queue/tslint.json index 08b1465cd6..b8825c1674 100644 --- a/types/d3-queue/tslint.json +++ b/types/d3-queue/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { + // TODO + "no-this-assignment": false, "unified-signatures": false } } diff --git a/types/d3-request/tslint.json b/types/d3-request/tslint.json index da66196eee..70edbfa511 100644 --- a/types/d3-request/tslint.json +++ b/types/d3-request/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { + // TODO + "no-this-assignment": false, "unified-signatures": false, "max-line-length": [false, 145] } diff --git a/types/d3-selection-multi/tslint.json b/types/d3-selection-multi/tslint.json index 08b1465cd6..b8825c1674 100644 --- a/types/d3-selection-multi/tslint.json +++ b/types/d3-selection-multi/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { + // TODO + "no-this-assignment": false, "unified-signatures": false } } diff --git a/types/d3-selection/d3-selection-tests.ts b/types/d3-selection/d3-selection-tests.ts index baae76bad2..e2a4d6ffd9 100644 --- a/types/d3-selection/d3-selection-tests.ts +++ b/types/d3-selection/d3-selection-tests.ts @@ -484,7 +484,7 @@ body = body const datum: BodyDatum = d; const index: number = i; const group: HTMLBodyElement[] | d3Selection.ArrayLike = g; - return '
Body Background Color: ' + this.bgColor + ', Foo Datum: ' + d.foo + '
'; // this context HTMLBodyElement, datum BodyDatum + return `
Body Background Color: ${this.bgColor}, Foo Datum: ${d.foo}
`; // this context HTMLBodyElement, datum BodyDatum }); // --------------------------------------------------------------------------------------- @@ -993,7 +993,7 @@ let customListener: (this: HTMLBodyElement, finalOpponent: string) => string; customListener = finalOpponent => { const e = d3Selection.event; - return e.team + ' defeated ' + finalOpponent + ' in the EURO 2016 Cup. Who would have thought!!!'; + return `${e.team} defeated ${finalOpponent} in the EURO 2016 Cup. Who would have thought!!!`; }; const resultText: string = d3Selection.customEvent(successEvent, customListener, body.node(), 'Wales'); diff --git a/types/d3-selection/tslint.json b/types/d3-selection/tslint.json index 08b1465cd6..b8825c1674 100644 --- a/types/d3-selection/tslint.json +++ b/types/d3-selection/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { + // TODO + "no-this-assignment": false, "unified-signatures": false } } diff --git a/types/d3-shape/tslint.json b/types/d3-shape/tslint.json index 604d5950cf..108ab49c45 100644 --- a/types/d3-shape/tslint.json +++ b/types/d3-shape/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { + // TODO + "no-this-assignment": false, "unified-signatures": false, "callable-types": false } diff --git a/types/d3-transition/tslint.json b/types/d3-transition/tslint.json index 08b1465cd6..b8825c1674 100644 --- a/types/d3-transition/tslint.json +++ b/types/d3-transition/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { + // TODO + "no-this-assignment": false, "unified-signatures": false } } diff --git a/types/d3-zoom/tslint.json b/types/d3-zoom/tslint.json index 08b1465cd6..b8825c1674 100644 --- a/types/d3-zoom/tslint.json +++ b/types/d3-zoom/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { + // TODO + "no-this-assignment": false, "unified-signatures": false } } diff --git a/types/dot/dot-tests.ts b/types/dot/dot-tests.ts index 43ff610d91..9920f798bd 100644 --- a/types/dot/dot-tests.ts +++ b/types/dot/dot-tests.ts @@ -1,18 +1,18 @@ const headertmpl = "

{{=it.title}}

"; -const pagetmpl = "

Here is the page using a header template< / h2 >\n" - + "{{#def.header}}\n" - + "{{=it.name}}"; +const pagetmpl = `

Here is the page using a header template< / h2 > +{{#def.header}} +{{=it.name}}`; -const customizableheadertmpl = "{{#def.header}}" - + "\n{{#def.mycustominjectionintoheader || ''} }"; +const customizableheadertmpl = `{{#def.header}} +{{#def.mycustominjectionintoheader || ''} }`; -const pagetmplwithcustomizableheader = "

Here is the page with customized header template

\n" - + "{{##def.mycustominjectionintoheader:\n" - + "
{{=it.title}} is not {{=it.name}}
\n" - + "#}}\n" - + "{{#def.customheader}}\n" - + "{{=it.name}}"; +const pagetmplwithcustomizableheader = `

Here is the page with customized header template

+{{##def.mycustominjectionintoheader: +
{{=it.title}} is not {{=it.name}}
+#}} +{{#def.customheader}} +{{=it.name}}`; const def = { header: headertmpl, diff --git a/types/dropkickjs/dropkickjs-tests.ts b/types/dropkickjs/dropkickjs-tests.ts index 72006e1b6d..a5f0f13e07 100644 --- a/types/dropkickjs/dropkickjs-tests.ts +++ b/types/dropkickjs/dropkickjs-tests.ts @@ -79,7 +79,7 @@ const selectOptions: DropkickOptions = { open(this: Dropkick) { const optionsList = ( this).data.elem.lastChild; // undocumented but useful data field if (optionsList.scrollWidth > optionsList.offsetWidth) { - optionsList.style.width = optionsList.scrollWidth + 25 + 'px'; + optionsList.style.width = `${optionsList.scrollWidth + 25}px`; } }, change: () => { diff --git a/types/fullcalendar/fullcalendar-tests.ts b/types/fullcalendar/fullcalendar-tests.ts index c0a53a59f1..303a3ca446 100644 --- a/types/fullcalendar/fullcalendar-tests.ts +++ b/types/fullcalendar/fullcalendar-tests.ts @@ -418,7 +418,7 @@ $('#calendar').fullCalendar({ $('#calendar').fullCalendar({ dayClick(date, jsEvent, view) { - alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY); + alert(`Coordinates: ${jsEvent.pageX},${jsEvent.pageY}`); alert('Current view: ' + view.name); @@ -430,7 +430,7 @@ $('#calendar').fullCalendar({ $('#calendar').fullCalendar({ eventClick(calEvent, jsEvent, view) { alert('Event: ' + calEvent.title); - alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY); + alert(`Coordinates: ${jsEvent.pageX},${jsEvent.pageY}`); alert('View: ' + view.name); // change the border color just for fun @@ -649,7 +649,7 @@ $('#my-draggable').draggable({ $('#calendar').fullCalendar({ droppable: true, drop(date, allDay) { - alert("Dropped on " + date + " with allDay=" + allDay); + alert(`Dropped on ${date} with allDay=${allDay}`); } }); diff --git a/types/get-stdin/get-stdin-tests.ts b/types/get-stdin/get-stdin-tests.ts index d77dff5924..efa0f2246a 100644 --- a/types/get-stdin/get-stdin-tests.ts +++ b/types/get-stdin/get-stdin-tests.ts @@ -5,5 +5,5 @@ getStdin().then(str => { }); getStdin.buffer().then(buffer => { - console.log("Length " + buffer.length + buffer.toString()); + console.log(`Length ${buffer.length}${buffer.toString()}`); }); diff --git a/types/griddle-react/test/CustomColumnComponent.tsx b/types/griddle-react/test/CustomColumnComponent.tsx index 6e81453e95..f344796538 100644 --- a/types/griddle-react/test/CustomColumnComponent.tsx +++ b/types/griddle-react/test/CustomColumnComponent.tsx @@ -14,13 +14,13 @@ interface MyCustomResult { class LinkComponent extends React.Component> { render() { - const url = "speakers/" + this.props.rowData.test + "/" + this.props.data; + const url = `speakers/${this.props.rowData.test}/${this.props.data}`; return {this.props.data}; } } const StatelessFunctionComponent = (props: CustomColumnComponentProps) => { - const url = "speakers/" + props.rowData.test + "/" + props.data; + const url = `speakers/${props.rowData.test}/${props.data}`; return {props.data}; }; diff --git a/types/griddle-react/test/index.tsx b/types/griddle-react/test/index.tsx index 4c977c0f97..b42513a34d 100644 --- a/types/griddle-react/test/index.tsx +++ b/types/griddle-react/test/index.tsx @@ -18,13 +18,13 @@ interface MyCustomResult { class LinkComponent extends React.Component> { render() { - const url = "speakers/" + this.props.rowData.test + "/" + this.props.data; + const url = `speakers/${this.props.rowData.test}/${this.props.data}`; return {this.props.data}; } } const StatelessFunctionComponent = (props: CustomColumnComponentProps) => { - const url = "speakers/" + props.rowData.test + "/" + props.data; + const url = `speakers/${props.rowData.test}/${props.data}`; return {props.data}; }; diff --git a/types/hoek/hoek-tests.ts b/types/hoek/hoek-tests.ts index 45487c2f45..4bfc98232a 100644 --- a/types/hoek/hoek-tests.ts +++ b/types/hoek/hoek-tests.ts @@ -201,12 +201,12 @@ Hoek.stringify(a); // Returns '[Cannot display object: Converting circular const timerObj = new Hoek.Timer(); console.log("Time is now: " + timerObj.ts); -console.log("Elapsed time from initialization: " + timerObj.elapsed() + 'milliseconds'); +console.log(`Elapsed time from initialization: ${timerObj.elapsed()}milliseconds`); // Bench const benchObj = new Hoek.Bench(); -console.log("Elapsed time from initialization: " + benchObj.elapsed() + 'milliseconds'); +console.log(`Elapsed time from initialization: ${benchObj.elapsed()}milliseconds`); // base64urlEncode(value) diff --git a/types/inline-style-prefixer/inline-style-prefixer-tests.ts b/types/inline-style-prefixer/inline-style-prefixer-tests.ts index 7592cdc252..6971eac32d 100644 --- a/types/inline-style-prefixer/inline-style-prefixer-tests.ts +++ b/types/inline-style-prefixer/inline-style-prefixer-tests.ts @@ -5,4 +5,4 @@ const prefixer = new Prefixer(); const prefixed = prefixer.prefix({ fontSize: '16', flexDirection: 'column' -} as CSSStyleDeclaration); +}); diff --git a/types/jquery.validation/jquery.validation-tests.ts b/types/jquery.validation/jquery.validation-tests.ts index b9f0ea4afd..cac355fc38 100644 --- a/types/jquery.validation/jquery.validation-tests.ts +++ b/types/jquery.validation/jquery.validation-tests.ts @@ -16,7 +16,7 @@ function test_validate() { if (errors) { const message = errors === 1 ? 'You missed 1 field. It has been highlighted' - : 'You missed ' + errors + ' fields. They have been highlighted'; + : `You missed ${errors} fields. They have been highlighted`; $("div.error span").html(message); $("div.error").show(); } else { @@ -124,7 +124,7 @@ function test_validate() { }); $(".selector").validate({ showErrors: (errorMap: JQueryValidation.ErrorDictionary, errorList: JQueryValidation.ErrorListItem[]) => { - $("#summary").html("Your form contains " + this.numberOfInvalids() + " errors, see details below."); + $("#summary").html(`Your form contains ${this.numberOfInvalids()} errors, see details below.`); this.defaultShowErrors(); } }); @@ -154,12 +154,12 @@ function test_validate() { $(".selector").validate({ highlight: (element: HTMLInputElement, errorClass, validClass) => { $(element).addClass(errorClass).removeClass(validClass); - $(element.form).find("label[for=" + element.id + "]") + $(element.form).find(`label[for=${element.id}]`) .addClass(errorClass); }, unhighlight: (element: HTMLInputElement, errorClass, validClass) => { $(element).removeClass(errorClass).addClass(validClass); - $(element.form).find("label[for=" + element.id + "]") + $(element.form).find(`label[for=${element.id}]`) .removeClass(errorClass); } }); diff --git a/types/js-quantities/js-quantities-tests.ts b/types/js-quantities/js-quantities-tests.ts index 48d318a38e..786a9f1a3f 100644 --- a/types/js-quantities/js-quantities-tests.ts +++ b/types/js-quantities/js-quantities-tests.ts @@ -143,7 +143,7 @@ const configurableRoundingFormatter = (maxDecimals: number) => { const pow = Math.pow(10, maxDecimals); const rounded = Math.round(scalar * pow) / pow; - return rounded + ' ' + units; + return `${rounded} ${units}`; }; }; @@ -1225,7 +1225,7 @@ describe("js-quantities", () => { const pow = Math.pow(10, maxDecimals); const rounded = Math.round(scalar * pow) / pow; - return rounded + " " + units; + return `${rounded} ${units}`; }; }; diff --git a/types/jsdom/tslint.json b/types/jsdom/tslint.json index 4f44991c3c..523ff9bf74 100644 --- a/types/jsdom/tslint.json +++ b/types/jsdom/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "no-empty-interface": false + // TODOs + "no-empty-interface": false, + "no-object-literal-type-assertion": false } } diff --git a/types/json-rpc-ws/json-rpc-ws-tests.ts b/types/json-rpc-ws/json-rpc-ws-tests.ts index 5e49480dc1..0796f02263 100644 --- a/types/json-rpc-ws/json-rpc-ws-tests.ts +++ b/types/json-rpc-ws/json-rpc-ws-tests.ts @@ -28,7 +28,7 @@ const serverWithCustomConnection = JsonRpcWs.createServer(); serverWithCustomConnection.expose('join', function(params: { room: string }) { this.rooms = this.rooms || []; this.rooms.push(params.room); - console.log(this.id + ' joined ' + params.room); + console.log(`${this.id} joined ${params.room}`); }); serverWithCustomConnection.start({ port: 8080 }, () => { diff --git a/types/keypress.js/tslint.json b/types/keypress.js/tslint.json index 2750cc0197..9e23990c45 100644 --- a/types/keypress.js/tslint.json +++ b/types/keypress.js/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } \ No newline at end of file +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-object-literal-type-assertion": false + } +} diff --git a/types/koa-morgan/koa-morgan-tests.ts b/types/koa-morgan/koa-morgan-tests.ts index 86c8c03e05..0a0e51cd95 100644 --- a/types/koa-morgan/koa-morgan-tests.ts +++ b/types/koa-morgan/koa-morgan-tests.ts @@ -77,8 +77,8 @@ const developmentExtendedFormatLine: ExtendedFormatFn = (tokens, req: IncomingMe developmentExtendedFormatLine.memoizer = {}; } - fn = developmentExtendedFormatLine.memoizer[color] = morgan.compile('\x1b[0m:method :url \x1b[' - + color + 'm:status \x1b[0m:response-time ms - :res[content-length]\x1b[0m :user-agent'); + fn = developmentExtendedFormatLine.memoizer[color] = morgan.compile( + `\x1b[0m:method :url \x1b[${color}m:status \x1b[0m:response-time ms - :res[content-length]\x1b[0m :user-agent`); } return fn(tokens, req, res); diff --git a/types/later/tslint.json b/types/later/tslint.json index 3db14f85ea..9e23990c45 100644 --- a/types/later/tslint.json +++ b/types/later/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-object-literal-type-assertion": false + } +} diff --git a/types/lovefield/lovefield-tests.ts b/types/lovefield/lovefield-tests.ts index 8ff33d04e5..fade4e6755 100644 --- a/types/lovefield/lovefield-tests.ts +++ b/types/lovefield/lovefield-tests.ts @@ -32,8 +32,7 @@ function main(): void { return todoDb.select().from(itemSchema).where(column.eq(false)).exec(); }).then((results) => { results.forEach((row) => { - document.body.textContent = (row as any).description + ' before ' + - (row as any).deadline; + document.body.textContent = `${(row as any).description} before ${(row as any).deadline}`; }); return todoDb.delete().from(itemSchema); diff --git a/types/mapbox/mapbox-tests.ts b/types/mapbox/mapbox-tests.ts index f4d0750199..ab9ad6c5de 100644 --- a/types/mapbox/mapbox-tests.ts +++ b/types/mapbox/mapbox-tests.ts @@ -16,7 +16,7 @@ const marker = L.marker(new L.LatLng([0, 0]), { // every time the marker is dragged, update the coordinates container marker.on('dragend', () => { const m = marker.getLatLng(); - coordinates.innerHTML = 'Latitude: ' + m.lat + '
Longitude: ' + m.lng; + coordinates.innerHTML = `Latitude: ${m.lat}
Longitude: ${m.lng}`; }); // Build a marker from a simple GeoJSON object: diff --git a/types/markdown-it-container/markdown-it-container-tests.ts b/types/markdown-it-container/markdown-it-container-tests.ts index f3ef2dbba1..3c8f3bf980 100644 --- a/types/markdown-it-container/markdown-it-container-tests.ts +++ b/types/markdown-it-container/markdown-it-container-tests.ts @@ -13,6 +13,7 @@ md.use(MarkdownItContainer, 'spoiler', { if (tokens[index].nesting === 1) { return ( + // tslint:disable-next-line prefer-template '
\n' + '
\n' + md.utils.escapeHtml(match && match[1] || '') + '\n' + diff --git a/types/mithril-global/mithril-global-tests.ts b/types/mithril-global/mithril-global-tests.ts index a8aa577320..4f776c26cd 100644 --- a/types/mithril-global/mithril-global-tests.ts +++ b/types/mithril-global/mithril-global-tests.ts @@ -1,10 +1,10 @@ // Test global mithril types -const comp = { +const comp: m.Comp<{},{}> = { view() { return m('span', "Test") } -} as m.Comp<{},{}> +}; m.mount(document.getElementById('comp')!, comp) diff --git a/types/mithril/test/test-api.ts b/types/mithril/test/test-api.ts index 2aebecb87e..a27a674068 100644 --- a/types/mithril/test/test-api.ts +++ b/types/mithril/test/test-api.ts @@ -366,13 +366,13 @@ const FRAME_BUDGET = 100; class User { name: string; constructor(data: any) { - this.name = data.firstName + " " + data.lastName; + this.name = `${data.firstName} ${data.lastName}`; } } // End rewrite to TypeScript // function User(data) { - // this.name = data.firstName + " " + data.lastName + // this.name = `${data.firstName} ${data.lastName}` // } m.request({ @@ -513,7 +513,7 @@ const FRAME_BUDGET = 100; const view = () => m(".container", cells.map(i => m(".slice", { - style: {backgroundPosition: (i % 10 * 11) + "% " + (Math.floor(i / 10) * 11) + "%"}, + style: {backgroundPosition: `${i % 10 * 11}% ${Math.floor(i / 10) * 11}%`}, onbeforeremove: exit }))); @@ -684,7 +684,7 @@ const FRAME_BUDGET = 100; m("label[for='toggle-all']", {onclick: ui.toggleAll}, "Mark all as complete"), m("ul#todo-list", [ state.todosByStatus.map((todo: any) => { - return m("li", {class: (todo.completed ? "completed" : "") + " " + (todo === state.editing ? "editing" : "")}, [ + return m("li", {class: `${todo.completed ? "completed" : ""} ${todo === state.editing ? "editing" : ""}`}, [ m(".view", [ m("input.toggle[type='checkbox']", { checked: todo.completed, onclick: () => { ui.toggle(todo); } }), m("label", { ondblclick: () => { state.dispatch("edit", [todo]); } }, todo.title), diff --git a/types/mithril/test/test-component.ts b/types/mithril/test/test-component.ts index d1fec567d2..a1f8107b0c 100644 --- a/types/mithril/test/test-component.ts +++ b/types/mithril/test/test-component.ts @@ -177,10 +177,11 @@ interface State { count: number; } -export default { +// Using the Comp type will apply the State intersection type for us. +const comp: Comp = { count: 0, view({attrs}) { return m('span', `name: ${attrs.name}, count: ${this.count}`); } -} as Comp; -// Using the Comp type will apply the State intersection type for us. +}; +export default comp; diff --git a/types/mithril/test/test-factory-component.ts b/types/mithril/test/test-factory-component.ts index ba2742f068..be3fdb60f1 100644 --- a/types/mithril/test/test-factory-component.ts +++ b/types/mithril/test/test-factory-component.ts @@ -23,7 +23,7 @@ m.mount(document.getElementById('comp0')!, null); // 1. // Simple example. Vnode type for component methods is inferred. // -function comp1() { +function comp1(): Component<{}, {}> { return { oncreate({dom}) { // vnode.dom type inferred @@ -31,7 +31,7 @@ function comp1() { view(vnode) { return m('span', "Test"); } - } as Component<{}, {}>; + }; } /////////////////////////////////////////////////////////// diff --git a/types/mithril/test/test-route.ts b/types/mithril/test/test-route.ts index d8acdd092c..fadf4b9c97 100644 --- a/types/mithril/test/test-route.ts +++ b/types/mithril/test/test-route.ts @@ -8,11 +8,11 @@ const component1 = { } }; -const component2 = { +const component2: Component<{title: string}, {}> = { view({attrs: {title}}) { return h('h1', title); } -} as Component<{title: string}, {}>; +}; interface Attrs { id: string; diff --git a/types/modernizr/modernizr-tests.ts b/types/modernizr/modernizr-tests.ts index ece0cecb5d..1b357fcd6f 100644 --- a/types/modernizr/modernizr-tests.ts +++ b/types/modernizr/modernizr-tests.ts @@ -1,7 +1,7 @@ declare const $: any; window.alert = (thing?: string) => { - $('#content').append('
' + thing + '
'); + $('#content').append(`
${thing}
`); }; $(() => { @@ -110,7 +110,7 @@ Modernizr.prefixedCSSValue('background', 'linear-gradient(left, red, red)'); let rule = Modernizr._prefixes.join('transform: rotate(20deg); '); rule === 'transform: rotate(20deg); webkit-transform: rotate(20deg); moz-transform: rotate(20deg); o-transform: rotate(20deg); ms-transform: rotate(20deg);'; -rule = 'display:' + Modernizr._prefixes.join('flex; display:') + 'flex'; +rule = `display:${Modernizr._prefixes.join('flex; display:')}flex`; rule === 'display:flex; display:-webkit-flex; display:-moz-flex; display:-o-flex; display:-ms-flex; display:flex'; Modernizr.testAllProps('boxSizing'); // true diff --git a/types/node-pg-migrate/tslint.json b/types/node-pg-migrate/tslint.json index 3db14f85ea..1061428d6e 100644 --- a/types/node-pg-migrate/tslint.json +++ b/types/node-pg-migrate/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-object-literal-type-assertion": false + } +} diff --git a/types/node-ral/tslint.json b/types/node-ral/tslint.json index b3fc134bd9..96427e1ebe 100644 --- a/types/node-ral/tslint.json +++ b/types/node-ral/tslint.json @@ -1,8 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "only-arrow-functions": [ - false - ] - } + // TODOs + "no-object-literal-type-assertion": false, + "only-arrow-functions": false + } } \ No newline at end of file diff --git a/types/node-rsa/node-rsa-tests.ts b/types/node-rsa/node-rsa-tests.ts index 798d0f6362..e210d5b68d 100644 --- a/types/node-rsa/node-rsa-tests.ts +++ b/types/node-rsa/node-rsa-tests.ts @@ -14,16 +14,15 @@ emptyKey.generateKeyPair(512, 65537); const newKey = new NodeRSA({ b: 512 }); const keyFromPEM = new NodeRSA( - '-----BEGIN RSA PRIVATE KEY-----\n' + - 'MIIBOQIBAAJAVY6quuzCwyOWzymJ7C4zXjeV/232wt2ZgJZ1kHzjI73wnhQ3WQcL\n' + - 'DFCSoi2lPUW8/zspk0qWvPdtp6Jg5Lu7hwIDAQABAkBEws9mQahZ6r1mq2zEm3D/\n' + - 'VM9BpV//xtd6p/G+eRCYBT2qshGx42ucdgZCYJptFoW+HEx/jtzWe74yK6jGIkWJ\n' + - 'AiEAoNAMsPqwWwTyjDZCo9iKvfIQvd3MWnmtFmjiHoPtjx0CIQCIMypAEEkZuQUi\n' + - 'pMoreJrOlLJWdc0bfhzNAJjxsTv/8wIgQG0ZqI3GubBxu9rBOAM5EoA4VNjXVigJ\n' + - 'QEEk1jTkp8ECIQCHhsoq90mWM/p9L5cQzLDWkTYoPI49Ji+Iemi2T5MRqwIgQl07\n' + - 'Es+KCn25OKXR/FJ5fu6A6A+MptABL3r8SEjlpLc=\n' + - '-----END RSA PRIVATE KEY-----' -); +`-----BEGIN RSA PRIVATE KEY----- +MIIBOQIBAAJAVY6quuzCwyOWzymJ7C4zXjeV/232wt2ZgJZ1kHzjI73wnhQ3WQcL +DFCSoi2lPUW8/zspk0qWvPdtp6Jg5Lu7hwIDAQABAkBEws9mQahZ6r1mq2zEm3D/ +VM9BpV//xtd6p/G+eRCYBT2qshGx42ucdgZCYJptFoW+HEx/jtzWe74yK6jGIkWJ +AiEAoNAMsPqwWwTyjDZCo9iKvfIQvd3MWnmtFmjiHoPtjx0CIQCIMypAEEkZuQUi +pMoreJrOlLJWdc0bfhzNAJjxsTv/8wIgQG0ZqI3GubBxu9rBOAM5EoA4VNjXVigJ +QEEk1jTkp8ECIQCHhsoq90mWM/p9L5cQzLDWkTYoPI49Ji+Iemi2T5MRqwIgQl07 +Es+KCn25OKXR/FJ5fu6A6A+MptABL3r8SEjlpLc= +-----END RSA PRIVATE KEY-----`); const keyData = '-----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----'; key.importKey(keyData, 'pkcs8'); diff --git a/types/openfin/openfin-tests.ts b/types/openfin/openfin-tests.ts index 95ed176fb1..61b819018f 100644 --- a/types/openfin/openfin-tests.ts +++ b/types/openfin/openfin-tests.ts @@ -44,12 +44,11 @@ function test_application() { }); // getGroups application.getGroups(allGroups => { - console.log("There are a total of " + allGroups.length + " groups."); + console.log(`There are a total of ${allGroups.length} groups.`); let groupCounter = 1; allGroups.forEach(windowGroup => { - console.log("Group " + groupCounter + " contains " + - windowGroup.length + " windows."); + console.log(`Group ${groupCounter} contains ${windowGroup.length} windows.`); ++groupCounter; }); }); @@ -122,7 +121,7 @@ function test_application() { }); // setTrayIcon application.setTrayIcon("https://developer.openf.in/download/openfin.png", clickInfo => { - console.log("The mouse has clicked at (" + clickInfo.x + "," + clickInfo.y + ")"); + console.log(`The mouse has clicked at (${clickInfo.x}, ${clickInfo.y})`); }); // terminate application.terminate(); @@ -157,11 +156,11 @@ function test_external_application() { function test_inter_application_bus() { // addSubscribeListener fin.desktop.InterApplicationBus.addSubscribeListener((uuid, topic, name) => { - console.log("The application " + uuid + " has subscribed to " + topic); + console.log(`The application ${uuid} has subscribed to ${topic}`); }); // addUnsubscribeListener fin.desktop.InterApplicationBus.addUnsubscribeListener((uuid, topic, name) => { - console.log("The application " + uuid + " has unsubscribed to " + topic); + console.log(`The application ${uuid} has unsubscribed to ${topic}`); }); // removeSubscribeListener const aRegisteredListener = (uuid: string, topic: string, name: string) => { }; @@ -180,7 +179,7 @@ function test_inter_application_bus() { }); // subscribe fin.desktop.InterApplicationBus.subscribe("*", "a topic", (message, uuid, name) => { - console.log("The application " + uuid + " sent this message: " + message); + console.log(`The application ${uuid} sent this message: ${message}`); }); // unsubscribe const aRegisteredMessageListener = (message: any, senderUuid: string) => { @@ -305,10 +304,7 @@ function test_system() { // getLogList fin.desktop.System.getLogList(logList => { logList.forEach(logInfo => { - console.log("The filename of the log is " + - logInfo.name + ", the size is " + - logInfo.size + ", and the date of creation is " + - logInfo.date); + console.log(`The filename of the log is ${logInfo.name}, the size is ${logInfo.size}, and the date of creation is ${logInfo.date}`); }); }); // getMonitorInfo @@ -317,12 +313,12 @@ function test_system() { }); // getMousePosition fin.desktop.System.getMousePosition(mousePosition => { - console.log("The mouse is located at left: " + mousePosition.left + ", top: " + mousePosition.top); + console.log(`The mouse is located at left: ${mousePosition.left}, top: ${mousePosition.top}`); }); // getProcessList fin.desktop.System.getProcessList(list => { list.forEach(process => { - console.log("UUID: " + process.uuid + ", Application Name: " + process.name); + console.log(`UUID: ${process.uuid}, Application Name: ${process.name}`); }); }); // getProxySettings @@ -612,10 +608,7 @@ function test_window() { finWindow.focus(); // getBounds finWindow.getBounds(bounds => { - console.log("top: " + bounds.top + - "left: " + bounds.left + - "height: " + bounds.height + - "width: " + bounds.width); + console.log(`top: ${bounds.top} left: ${bounds.left} height: ${bounds.height} width: ${bounds.width}`); }); // getOptions finWindow.getOptions(options => { diff --git a/types/p-reduce/p-reduce-tests.ts b/types/p-reduce/p-reduce-tests.ts index 38b0223273..113b6040fc 100644 --- a/types/p-reduce/p-reduce-tests.ts +++ b/types/p-reduce/p-reduce-tests.ts @@ -21,7 +21,7 @@ const names2 = [ ]; pReduce(names2, (allNames, name) => { - return Promise.resolve(allNames + ',' + name); + return Promise.resolve(`${allNames},${name}`); }, '').then(allNames => { const str: string = allNames; }); diff --git a/types/phonon/phonon-tests.ts b/types/phonon/phonon-tests.ts index 678611c2e3..c32e837501 100644 --- a/types/phonon/phonon-tests.ts +++ b/types/phonon/phonon-tests.ts @@ -167,7 +167,7 @@ popover.setList([ popover.setList(['a', 'b', 'c'], item => { const text = typeof item === 'string' ? item : item.text; const value = typeof item === 'string' ? item : item.value; - return '
  • ' + text + '
  • '; + return `
  • ${text}
  • `; }); popover.attachButton('.button-trigger-popover', true); diff --git a/types/prosemirror-state/tslint.json b/types/prosemirror-state/tslint.json index 3db14f85ea..9e23990c45 100644 --- a/types/prosemirror-state/tslint.json +++ b/types/prosemirror-state/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-object-literal-type-assertion": false + } +} diff --git a/types/protractor-browser-logs/protractor-browser-logs-tests.ts b/types/protractor-browser-logs/protractor-browser-logs-tests.ts index 75af9eb039..82da49b580 100644 --- a/types/protractor-browser-logs/protractor-browser-logs-tests.ts +++ b/types/protractor-browser-logs/protractor-browser-logs-tests.ts @@ -6,7 +6,7 @@ import Entry = webdriver.logging.Entry; function colored(entries: Entry[]) { const colors: any = { INFO: 35 /* magenta */, WARNING: 33 /* yellow */, SEVERE: 31 /* red */}; entries.forEach((entry: Entry) => { - console.log('\u001b[' + (colors[entry.level.name] || 37) + 'm' + [entry.level.name, entry.message].join(': ') + '\u001b[39m'); + console.log(`\u001b[${colors[entry.level.name] || 37}m${[entry.level.name, entry.message].join(': ')}\u001b[39m`); }); } diff --git a/types/react-native-fs/react-native-fs-tests.ts b/types/react-native-fs/react-native-fs-tests.ts index 85a623b82e..88d9093872 100644 --- a/types/react-native-fs/react-native-fs-tests.ts +++ b/types/react-native-fs/react-native-fs-tests.ts @@ -68,7 +68,7 @@ const uploadBegin: RNFS.UploadCallbackBegin = (response) => { const uploadProgress: RNFS.UploadCallbackProgress = (response) => { const percentage = Math.floor((response.totalBytesSent / response.totalBytesExpectedToSend) * 100); - console.log('UPLOAD IS ' + percentage + '% DONE!'); + console.log(`UPLOAD IS ${percentage}% DONE!`); }; // upload files diff --git a/types/react-native-snap-carousel/tslint.json b/types/react-native-snap-carousel/tslint.json index 3db14f85ea..9e23990c45 100644 --- a/types/react-native-snap-carousel/tslint.json +++ b/types/react-native-snap-carousel/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-object-literal-type-assertion": false + } +} diff --git a/types/react-navigation/tslint.json b/types/react-navigation/tslint.json index 0a6488b194..07cc01e66e 100644 --- a/types/react-navigation/tslint.json +++ b/types/react-navigation/tslint.json @@ -12,6 +12,7 @@ "no-misused-new": false, "no-consecutive-blank-lines": false, "no-empty-interface": false, + "no-object-literal-type-assertion": false, "no-padding": false, "no-var": false, "prefer-declare-function": false, diff --git a/types/react-swipeable-views/react-swipeable-views-tests.ts b/types/react-swipeable-views/react-swipeable-views-tests.ts index b723f58575..e35be787fb 100644 --- a/types/react-swipeable-views/react-swipeable-views-tests.ts +++ b/types/react-swipeable-views/react-swipeable-views-tests.ts @@ -9,7 +9,7 @@ import SwipeableViews, } from 'react-swipeable-views'; const onChangeIndex: OnChangeIndexCallback = (indexNew: number, indexLatest: number) => { - console.log('New index: ' + indexNew + ', latest index' + indexLatest); + console.log(`New index: ${indexNew}, latest index ${indexLatest}`); }; const onSwitching: OnSwitchingCallback = (index: number, type: OnSwitchingCallbackTypeDescriptor) => { diff --git a/types/readline-sync/readline-sync-tests.ts b/types/readline-sync/readline-sync-tests.ts index 7800fda39a..2e1bd21e2c 100644 --- a/types/readline-sync/readline-sync-tests.ts +++ b/types/readline-sync/readline-sync-tests.ts @@ -55,7 +55,7 @@ readlineSync.promptCL((command: string, arg1: string, arg2: string) => { if (command === 'add') { console.log(arg1 + ' is added.'); } else if (command === 'copy') { - console.log(arg1 + ' is copied to ' + arg2 + '.'); + console.log(`${arg1} is copied to ${arg2}.`); } }); @@ -64,12 +64,12 @@ readlineSync.promptCL({ console.log(element + ' is added.'); }, copy: (from: string, to: string) => { - console.log(from + ' is copied to ' + to + '.'); + console.log(`${from} is copied to ${to}.`); } }); readlineSync.promptLoop((input: string) => { - console.log('-- You said "' + input + '"'); + console.log(`-- You said "${input}"`); return input === 'bye'; }); @@ -78,7 +78,7 @@ readlineSync.promptCLLoop({ console.log(element + ' is added.'); }, copy: (from: string, to: string) => { - console.log(from + ' is copied to ' + to + '.'); + console.log(`${from} is copied to ${to}.`); }, bye: () => true }); diff --git a/types/riot/riot-tests.ts b/types/riot/riot-tests.ts index d18c7d36a2..39c2e14225 100644 --- a/types/riot/riot-tests.ts +++ b/types/riot/riot-tests.ts @@ -11,7 +11,7 @@ riot.settings.asyncRenderTimeout = 100500; // util.tmpl riot.util.tmpl.errorHandler = (err: riot.TemplateError) => { - console.error(err.message + ' in ' + err.riotData.tagName); + console.error(`${err.message} in ${err.riotData.tagName}`); }; // util.vdom diff --git a/types/rot-js/rot-js-tests.ts b/types/rot-js/rot-js-tests.ts index 4bf5f4c567..9a07511dce 100644 --- a/types/rot-js/rot-js-tests.ts +++ b/types/rot-js/rot-js-tests.ts @@ -63,7 +63,7 @@ class Item { a() { const first = self.name.charAt(0); - return (first.match(/[aeiouy]/i) ? "an" : "a") + " " + this.name; + return `${first.match(/[aeiouy]/i) ? "an" : "a"} ${this.name}`; } the() { @@ -465,7 +465,7 @@ cellular.create(display.DEBUG); display = new ROT.Display({ width: w, height: h, fontSize: 4 }); SHOW(display.getContainer()); cellular.connect(display.DEBUG, 0, (from, to) => { - SHOW("Connection was made " + from + " to " + to); + SHOW(`Connection was made ${from} to ${to}`); }); // Map creation / Dungeon @@ -531,13 +531,13 @@ SHOW(display.getContainer()); /* create a map */ let data_uniform: any = {}; new ROT.Map.Uniform().create((x: number, y: number, type: number) => { - data_uniform[x + "," + y] = type; + data_uniform[`${x},${y}`] = type; display.DEBUG(x, y, type); }); /* input callback */ let lightPasses = (x: number, y: number) => { - const key = x + "," + y; + const key = `${x},${y}`; if (key in data_uniform) { return (data_uniform[key] === 0); } return false; }; @@ -547,7 +547,7 @@ let fov = new ROT.FOV.PreciseShadowcasting(lightPasses); /* output callback */ fov.compute(50, 22, 10, (x, y, r, visibility) => { const ch = (r ? "" : "@"); - const color = (data_uniform[x + "," + y] ? "#aa0" : "#660"); + const color = (data_uniform[`${x},${y}`] ? "#aa0" : "#660"); display.draw(x, y, ch, "#fff", color); }); @@ -563,13 +563,13 @@ SHOW(display.getContainer()); /* create a map */ data_uniform = {}; new ROT.Map.Uniform().create((x: number, y: number, type: number) => { - data_uniform[x + "," + y] = type; + data_uniform[`${x},${y}`] = type; display.DEBUG(x, y, type); }); /* input callback */ lightPasses = (x: number, y: number) => { - const key = x + "," + y; + const key = `${x},${y}`; if (key in data_uniform) { return (data_uniform[key] === 0); } return false; }; @@ -579,21 +579,21 @@ const fov2 = new ROT.FOV.RecursiveShadowcasting(lightPasses); /* output callback for mob with bad vision */ fov2.compute90(50, 22, 10, DIR_WEST, (x: number, y: number, r: number, visibility: number) => { const ch = (r ? "1" : "@"); - const color = (data_uniform[x + "," + y] ? "#aa0" : "#660"); + const color = (data_uniform[`${x},${y}`] ? "#aa0" : "#660"); display.draw(x, y, ch, "#fff", color); }); /* output callback for second mob with better vision */ fov2.compute180(57, 14, 10, DIR_NORTH, (x: number, y: number, r: number, visibility: number) => { const ch = (r ? "2" : "@"); - const color = (data_uniform[x + "," + y] ? "#aa0" : "#660"); + const color = (data_uniform[`${x},${y}`] ? "#aa0" : "#660"); display.draw(x, y, ch, "#fff", color); }); /* output callback for third mob with supernatural vision */ fov2.compute(65, 5, 10, (x: number, y: number, r: number, visibility: number) => { const ch = (r ? "3" : "@"); - const color = (data_uniform[x + "," + y] ? "#aa0" : "#660"); + const color = (data_uniform[`${x},${y}`] ? "#aa0" : "#660"); display.draw(x, y, ch, "#fff", color); }); @@ -652,7 +652,7 @@ const lightData: { [key: string]: [number, number, number] } = {}; /* build a map */ cellular = new ROT.Map.Cellular().randomize(0.5); const createCallback = (x: number, y: number, value: number) => { - mapData[x + "," + y] = value; + mapData[`${x},${y}`] = value; }; for (let i = 0; i < 4; i++) { cellular.create(createCallback); @@ -660,13 +660,13 @@ for (let i = 0; i < 4; i++) { /* prepare a FOV algorithm */ lightPasses = (x: number, y: number) => { - return (mapData[x + "," + y] === 1); + return (mapData[`${x},${y}`] === 1); }; fov = new ROT.FOV.PreciseShadowcasting(lightPasses, { topology: 4 }); /* prepare a lighting algorithm */ const reflectivity = (x: number, y: number) => { - return (mapData[x + "," + y] === 1 ? 0.3 : 0); + return (mapData[`${x},${y}`] === 1 ? 0.3 : 0); }; const lighting = new ROT.Lighting(reflectivity, { range: 12, passes: 2 }); lighting.setFOV(fov); @@ -675,7 +675,7 @@ lighting.setLight(20, 20, [240, 60, 60]); lighting.setLight(45, 25, [200, 200, 200]); const lightingCallback = (x: number, y: number, color: [number, number, number]) => { - lightData[x + "," + y] = color; + lightData[`${x},${y}`] = color; }; lighting.compute(lightingCallback); @@ -711,13 +711,13 @@ SHOW(display.getContainer()); const uni_data: any = {}; let uni_map = new ROT.Map.Uniform(w, h); uni_map.create((x, y, value) => { - uni_data[x + "," + y] = value; + uni_data[`${x},${y}`] = value; display.DEBUG(x, y, value); }); /* input callback informs about map structure */ let passableCallback = (x: number, y: number) => { - return (uni_data[x + "," + y] === 0); + return (uni_data[`${x},${y}`] === 0); }; /* prepare path to given coords */ @@ -747,13 +747,13 @@ SHOW(display.getContainer()); /* generate map and store its data */ uni_map = new ROT.Map.Uniform(w, h); uni_map.create((x: number, y: number, value: number) => { - uni_data[x + "," + y] = value; + uni_data[`${x},${y}`] = value; display.DEBUG(x, y, value); }); /* input callback informs about map structure */ passableCallback = (x: number, y: number) => { - return (uni_data[x + "," + y] === 0); + return (uni_data[`${x},${y}`] === 0); }; /* prepare path to given coords */ @@ -786,7 +786,7 @@ for (let j = 0; j < h; j++) { const r = ~~(val > 0 ? val : 0); const g = ~~(val < 0 ? -val : 0); - display.draw(i, j, "", "", "rgb(" + r + "," + g + ",0)"); + display.draw(i, j, "", "", `rgb(${r},${g},0)`); } } // ---- @@ -801,7 +801,7 @@ for (let j = 0; j < h; j++) { const r = ~~(val > 0 ? val : 0); const g = ~~(val < 0 ? -val : 0); - display.draw(i, j, "", "", "rgb(" + r + "," + g + ",0)"); + display.draw(i, j, "", "", `rgb(${r},${g},0)`); } } @@ -1014,7 +1014,7 @@ SHOW(display.getContainer()); for (let y = 0; y < 4; y++) { for (let x = y % 2; x < 10; x += 2) { const bg = ["#333", "#666", "#999", "#ccc", "#fff"].random(); - display.draw(x, y, x + "," + y, "#000", bg); + display.draw(x, y, `${x},${y}`, "#000", bg); } } @@ -1061,13 +1061,13 @@ cell_map = new ROT.Map.Cellular(w, h, { cell_map.randomize(0.48); cell_map.create(); /* two iterations */ cell_map.create((x: number, y: number, value: number) => { - cell_data[x + "," + y] = value; + cell_data[`${x},${y}`] = value; display.DEBUG(x, y, value); }); /* input callback informs about map structure */ passableCallback = (x: number, y: number) => { - return (cell_data[x + "," + y] === 0); + return (cell_data[`${x},${y}`] === 0); }; /* prepare path to given coords */ @@ -1098,13 +1098,13 @@ cell_map = new ROT.Map.Cellular(undefined, undefined, { }); cell_map.randomize(0.4); cell_map.create((x: number, y: number, value: number) => { - cell_data[x + "," + y] = value; + cell_data[`${x},${y}`] = value; display.DEBUG(x, y, value); }); /* input callback */ lightPasses = (x: number, y: number) => { - const key = x + "," + y; + const key = `${x},${y}`; if (key in cell_data) { return (cell_data[key] === 0); } return false; }; @@ -1114,6 +1114,6 @@ fov = new ROT.FOV.PreciseShadowcasting(lightPasses, { topology: 6 }); /* output callback */ fov.compute(20, 14, 6, (x, y, r, vis) => { const ch = (r ? "" : "@"); - const color = (cell_data[x + "," + y] ? "#aa0" : "#660"); + const color = (cell_data[`${x},${y}`] ? "#aa0" : "#660"); display.draw(x, y, ch, "#fff", color); }); diff --git a/types/rx-lite-async/tslint.json b/types/rx-lite-async/tslint.json index 284122b6f8..4428b956c7 100644 --- a/types/rx-lite-async/tslint.json +++ b/types/rx-lite-async/tslint.json @@ -1,7 +1,9 @@ { "extends": "dtslint/dt.json", "rules": { + // TODOs "max-line-length": false, + "no-object-literal-type-assertion": false, "no-single-declare-module": false } } diff --git a/types/sqlite3/sqlite3-tests.ts b/types/sqlite3/sqlite3-tests.ts index 57cd516bcb..4ddfa0a502 100644 --- a/types/sqlite3/sqlite3-tests.ts +++ b/types/sqlite3/sqlite3-tests.ts @@ -28,7 +28,7 @@ function readAllRows() { console.log("readAllRows lorem"); db.all("SELECT rowid AS id, info FROM lorem", (err, rows) => { rows.forEach(row => { - console.log(row.id + ": " + row.info); + console.log(`${row.id}: ${row.info}`); }); readSomeRows(); }); @@ -37,7 +37,7 @@ function readAllRows() { function readSomeRows() { console.log("readAllRows lorem"); db.each("SELECT rowid AS id, info FROM lorem WHERE rowid < ? ", 5, (err, row) => { - console.log(row.id + ": " + row.info); + console.log(`${row.id}: ${row.info}`); }, closeDb); } @@ -62,7 +62,7 @@ db.serialize(() => { stmt.finalize(); db.each("SELECT rowid AS id, info FROM lorem", (err, row) => { - console.log(row.id + ": " + row.info); + console.log(`${row.id}: ${row.info}`); }); }); diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index 99214b2ccd..6d7eeb793d 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -34,7 +34,7 @@ agent if (res.error) { console.log('oh no ' + res.error.message); } else { - console.log('got ' + res.status + ' response'); + console.log(`got ${res.status} response`); } }); @@ -229,7 +229,7 @@ const reqUrl: string = req.url; const reqMethod: string = req.method; const reqCookies: string = req.cookies; -console.log(reqMethod + ' request to ' + reqUrl + ' cookies ' + reqCookies); +console.log(`${reqMethod} request to ${reqUrl} cookies ${reqCookies}`); // Basic authentication request.get('http://tobi:learnboost@local').end(callback); diff --git a/types/swiper/swiper-tests.ts b/types/swiper/swiper-tests.ts index 7e772a2742..9ba47c2aba 100644 --- a/types/swiper/swiper-tests.ts +++ b/types/swiper/swiper-tests.ts @@ -241,23 +241,23 @@ function dynamicSlides() { document.querySelector('.prepend-2-slides').addEventListener('click', e => { e.preventDefault(); swiper.prependSlide([ - '
    Slide ' + (--prependNumber) + '
    ', - '
    Slide ' + (--prependNumber) + '
    ' + `
    Slide ${--prependNumber}
    `, + `
    Slide ${--prependNumber}
    ` ]); }); document.querySelector('.prepend-slide').addEventListener('click', e => { e.preventDefault(); - swiper.prependSlide('
    Slide ' + (--prependNumber) + '
    '); + swiper.prependSlide(`
    Slide ${--prependNumber}
    `); }); document.querySelector('.append-slide').addEventListener('click', e => { e.preventDefault(); - swiper.appendSlide('
    Slide ' + (++appendNumber) + '
    '); + swiper.appendSlide(`
    Slide ${++appendNumber}
    `); }); document.querySelector('.append-2-slides').addEventListener('click', e => { e.preventDefault(); swiper.appendSlide([ - '
    Slide ' + (++appendNumber) + '
    ', - '
    Slide ' + (++appendNumber) + '
    ' + `
    Slide ${++appendNumber}
    `, + `
    Slide ${++appendNumber}
    ` ]); }); } @@ -363,7 +363,7 @@ function customPagination() { pagination: '.swiper-pagination', paginationClickable: true, paginationBulletRender(swiper, index, className) { - return '' + (index + 1) + ''; + return `${index + 1}`; } }); } diff --git a/types/to-markdown/to-markdown-tests.ts b/types/to-markdown/to-markdown-tests.ts index 8aa3b27a6f..6c21bf1740 100644 --- a/types/to-markdown/to-markdown-tests.ts +++ b/types/to-markdown/to-markdown-tests.ts @@ -22,13 +22,13 @@ toMarkdown(` { filter: 'code', replacement(innerHTML) { - return '`' + innerHTML + '`'; + return `\`${innerHTML}\``; } }, { filter: ['em', 'i'], replacement(innerHTML) { - return '*' + innerHTML + '*'; + return `*${innerHTML}*`; } }, { @@ -37,7 +37,7 @@ toMarkdown(` && /italic/i.test(node.style.fontStyle!); }, replacement(innerHTML) { - return '*' + innerHTML + '*'; + return `*${innerHTML}*`; } }, { @@ -46,7 +46,7 @@ toMarkdown(` && /italic/i.test(node.style.fontStyle!); }, replacement(innerHTML, node) { - return innerHTML + ' (node: `' + node.nodeName + '`)'; + return `${innerHTML}(node: \`${node.nodeName}\`)`; } } ] diff --git a/types/vast-client/tslint.json b/types/vast-client/tslint.json index d88586e5bd..f3aabf4668 100644 --- a/types/vast-client/tslint.json +++ b/types/vast-client/tslint.json @@ -1,3 +1,7 @@ { - "extends": "dtslint/dt.json" + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-object-literal-type-assertion": false + } } diff --git a/types/vinyl-fs/vinyl-fs-tests.ts b/types/vinyl-fs/vinyl-fs-tests.ts index 38585422c8..573f25f086 100644 --- a/types/vinyl-fs/vinyl-fs-tests.ts +++ b/types/vinyl-fs/vinyl-fs-tests.ts @@ -873,7 +873,7 @@ describe('symlink stream', () => { }); ['end', 'finish'].forEach(eventName => { - it('should emit ' + eventName + ' event', done => { + it(`should emit ${eventName} event`, done => { const srcPath = path.join(__dirname, './fixtures/test.coffee'); const stream = vfs.symlink('./out-fixtures/', { cwd: __dirname }); diff --git a/types/voca/voca-tests.ts b/types/voca/voca-tests.ts index 2353521ca0..7a874455e4 100644 --- a/types/voca/voca-tests.ts +++ b/types/voca/voca-tests.ts @@ -197,7 +197,7 @@ str = v.replace(); str = v.replace('swan', 'wa', 'u'); str = v.replace('domestic duck', /domestic\s/, ''); str = v.replace('nice duck', /(nice)(duck)/, (match: string, nice: string, duck: string) => { - return 'the ' + duck + ' is ' + nice; + return `the ${duck} is ${nice}`; }); str = v.replaceAll(); diff --git a/types/waypoints/waypoints-tests.ts b/types/waypoints/waypoints-tests.ts index df98d43b0f..658412f953 100644 --- a/types/waypoints/waypoints-tests.ts +++ b/types/waypoints/waypoints-tests.ts @@ -35,7 +35,7 @@ let waypoint3 = new Waypoint({ let waypoint4 = new Waypoint({ element: document.getElementById('element-waypoint')!, handler(direction) { - notify(this.element.id + ' triggers at ' + this.triggerPoint); + notify(`${this.element.id} triggers at ${this.triggerPoint}`); }, offset: '75%' }); diff --git a/types/web-animations-js/web-animations-js-tests.ts b/types/web-animations-js/web-animations-js-tests.ts index 56937c4ce8..934bc944d1 100644 --- a/types/web-animations-js/web-animations-js-tests.ts +++ b/types/web-animations-js/web-animations-js-tests.ts @@ -28,9 +28,7 @@ function test_AnimationsApiNext() { function buildFadeOut(target: HTMLElement) { const angle = Math.pow((Math.random() * 16) - 6, 3); const offset = (Math.random() * 20) - 10; - const transform = 'translate(' + offset + 'em, 20em) ' + - 'rotate(' + angle + 'deg) ' + - 'scale(0)'; + const transform = `translate(${offset}em, 20em) rotate(${angle}deg) scale(0)`; const steps = [ { visibility: 'visible', opacity: 1, transform: 'none' }, { visibility: 'visible', opacity: 0, transform } @@ -43,13 +41,13 @@ function test_AnimationsApiNext() { const effectNode = document.createElement('div'); effectNode.className = 'circleEffect'; const bounds = document.documentElement.getBoundingClientRect(); - effectNode.style.left = bounds.left + bounds.width / 2 + 'px'; - effectNode.style.top = bounds.top + bounds.height / 2 + 'px'; + effectNode.style.left = `${bounds.left + bounds.width / 2}px`; + effectNode.style.top = `${bounds.top + bounds.height / 2}px`; const header = document.querySelector('header'); if (header) { header.appendChild(effectNode); } - const newColor = 'hsl(' + Math.round(Math.random() * 255) + ', 46%, 42%)'; + const newColor = `hsl(${Math.round(Math.random() * 255)}, 46%, 42%)`; effectNode.style.background = newColor; const scaleSteps = [{ transform: 'scale(0)' }, { transform: 'scale(1)' }]; const timing: AnimationEffectTiming = { duration: 2500, easing: 'ease-in-out', fill: "backwards" }; diff --git a/types/webassembly-js-api/webassembly-js-api-tests.ts b/types/webassembly-js-api/webassembly-js-api-tests.ts index 5b62354070..78d5883e9d 100644 --- a/types/webassembly-js-api/webassembly-js-api-tests.ts +++ b/types/webassembly-js-api/webassembly-js-api-tests.ts @@ -30,7 +30,7 @@ debug(`wasmDataU8[7]=${wasmDataU8[7].toString(16)}`); // Validate let valid = WebAssembly.validate(wasmDataU8); -debug("wasmDataU8 is " + (valid ? "" : "not ") + "a valid wasm wasmModule"); +debug(`wasmDataU8 is ${valid ? "" : "not "}a valid wasm wasmModule`); // Module let wasmModule = new WebAssembly.Module(wasmDataU8); diff --git a/types/webdriverio/webdriverio-tests.ts b/types/webdriverio/webdriverio-tests.ts index b914cb50cb..1765029a32 100644 --- a/types/webdriverio/webdriverio-tests.ts +++ b/types/webdriverio/webdriverio-tests.ts @@ -99,7 +99,7 @@ webdriverio .init() .url("https://news.ycombinator.com/") .selectorExecute("//div", (inputs: HTMLElement[], message: string) => { - return inputs.length + " " + message; + return `${inputs.length} ${message}`; }, "divs on the page") .then((res: string) => { console.log(res); diff --git a/types/webpack-sources/tslint.json b/types/webpack-sources/tslint.json index 3db14f85ea..1061428d6e 100644 --- a/types/webpack-sources/tslint.json +++ b/types/webpack-sources/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-object-literal-type-assertion": false + } +} diff --git a/types/wx-js-sdk-dt/index.d.ts b/types/wx-js-sdk-dt/index.d.ts index 3e95299cd7..cefc43887f 100644 --- a/types/wx-js-sdk-dt/index.d.ts +++ b/types/wx-js-sdk-dt/index.d.ts @@ -49,7 +49,7 @@ declare namespace wx { * 配置微信初始化成功后的回调 * @param x 回调 */ - function ready(x: () => void ): void; + function ready(x: () => void): void; /** * 配置微信初始化失败后的回调 diff --git a/types/xrm/xrm-tests.ts b/types/xrm/xrm-tests.ts index 467d34a419..5b5b12c333 100644 --- a/types/xrm/xrm-tests.ts +++ b/types/xrm/xrm-tests.ts @@ -36,7 +36,7 @@ grids.forEach((gridControl: Xrm.Page.GridControl) => { /// Demonstrate generic overload vs typecast -const lookupAttribute = Xrm.Page.getControl("customerid"); +const lookupAttribute = Xrm.Page.getControl("customerid"); const lookupAttribute2 = Xrm.Page.getControl("customerid"); /// Demonstrate ES6 String literal syntax diff --git a/types/zui/zui-tests.ts b/types/zui/zui-tests.ts index cccc6e3109..5fe23e1789 100644 --- a/types/zui/zui-tests.ts +++ b/types/zui/zui-tests.ts @@ -192,15 +192,15 @@ let count = 0; $('#draggableBtn').draggable({ container: '#draggableBox', before: () => { - console.log(count++ + ': ' + '[开始] 拖动...\n'); + console.log(`${count++}: [开始] 拖动...\n`); return true; }, drag: (e: DraggableEvent) => { - console.log(count++ + ': ' + '拖动: pos = ' + JSON.stringify(e.pos) + ', offset = ' + JSON.stringify(e.offset) + '\n'); + console.log(`${count++}: 拖动: pos = ${JSON.stringify(e.pos)}, offset = ${JSON.stringify(e.offset)}\n`); // console.log('(' + e.pos.left + ', ' + e.pos.top + ')'); }, finish: (e: DraggableEvent) => { - console.log(count++ + ': ' + '[完毕]:pos = ' + JSON.stringify(e.pos) + ', offset = ' + JSON.stringify(e.offset) + '\n'); + console.log(`${count++}: [完毕]:pos = ${JSON.stringify(e.pos)}, offset = ${JSON.stringify(e.offset)}\n`); } }); @@ -218,8 +218,8 @@ $('#multiDroppableContainer').droppable({ if (event.target && event.element) { const elementId = event.element.find('.btn-droppable-id').text(); let msg = '真棒!'; - event.target.addClass('panel-success').find('.panel-heading').text('成功将【按钮#' + elementId + '】拖到目的地。'); - msg += '成功拖动【按钮#' + elementId + '】到区域 ' + event.target.find('.area-name').text(); + event.target.addClass('panel-success').find('.panel-heading').text(`成功将【按钮#${elementId}】拖到目的地。`); + msg += `成功拖动【按钮#${elementId}】到区域${event.target.find('.area-name').text()}`; $.zui.messager.show(msg); }