\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);
}