TSLint: re-enable comment-format rule

This rule requires that all single line comments must start with a
space, i.e. `//hello` is forbidden and `// hello` is allowed.
This made me discover a few pre-processor macro in files that aren't
taken into account by the macro-preprocessor and so I've decided to
remove these directives.
Note that this rule must stay disabled for excmds.ts as it would break
our preprocessor macros.
This commit is contained in:
glacambre 2019-04-02 06:34:31 +02:00
parent f2630ea047
commit 8545efdf3f
No known key found for this signature in database
GPG key ID: B9625DB1767553AC
10 changed files with 33 additions and 43 deletions

View file

@ -8,11 +8,11 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
export function jack_in() {
//chinese characters - taken from the unicode charset
// chinese characters - taken from the unicode charset
const chinese = "田由甲申甴电甶男甸甹町画甼甽甾甿畀畁畂畃畄畅畆畇畈畉畊畋界畍畎畏畐畑".split(
"",
)
const colour = "#0F0" //green text
const colour = "#0F0" // green text
rain(chinese, colour)
}
@ -35,42 +35,42 @@ export function rain(characters: string[], colour, darkening = 0.05) {
document.body.appendChild(d)
let ctx = c.getContext("2d")
//making the canvas full screen
// making the canvas full screen
c.height = window.innerHeight
c.width = window.innerWidth
//converting the string into an array of single characters
// converting the string into an array of single characters
let font_size = 10
let columns = c.width / font_size //number of columns for the rain
//an array of drops - one per column
let columns = c.width / font_size // number of columns for the rain
// an array of drops - one per column
let drops = []
//x below is the x coordinate
//1 = y co-ordinate of the drop(same for every drop initially)
// x below is the x coordinate
// 1 = y co-ordinate of the drop(same for every drop initially)
for (let x = 0; x < columns; x++) drops[x] = 1
//drawing the characters
// drawing the characters
function draw() {
//Black BG for the canvas
//translucent BG to show trail
// Black BG for the canvas
// translucent BG to show trail
ctx.fillStyle = "rgba(0, 0, 0, " + darkening + ")"
ctx.fillRect(0, 0, c.width, c.height)
ctx.fillStyle = colour
ctx.font = font_size + "px arial"
//looping over drops
// looping over drops
for (let i = 0; i < drops.length; i++) {
//a random chinese character to print
// a random chinese character to print
let text = characters[Math.floor(Math.random() * characters.length)]
//x = i*font_size, y = value of drops[i]*font_size
// x = i*font_size, y = value of drops[i]*font_size
ctx.fillText(text, i * font_size, drops[i] * font_size)
//sending the drop back to the top randomly after it has crossed the screen
//adding a randomness to the reset to make the drops scattered on the Y axis
// sending the drop back to the top randomly after it has crossed the screen
// adding a randomness to the reset to make the drops scattered on the Y axis
if (drops[i] * font_size > c.height && Math.random() > 0.975)
drops[i] = 0
//incrementing Y coordinate
// incrementing Y coordinate
drops[i]++
}
}

View file

@ -1,4 +1,5 @@
/* tslint:disable:array-type */
/* tslint:disable:comment-format */
// '//#' is a start point for a simple text-replacement-type macro. See excmds_macros.py
/** # Tridactyl help page

View file

@ -108,7 +108,7 @@ export class AutoContain implements IAutoContain {
return { cancel: true }
}
//Handles the requests after the initial checks made in this.autoContain.
// Handles the requests after the initial checks made in this.autoContain.
cancelEarly = (tab: browser.tabs.Tab, details: IDetails): boolean => {
if (!this.cancelledRequests[tab.id]) {
this.cancelRequest(tab, details)

View file

@ -223,7 +223,7 @@ class default_config {
// "?": "fillcmdline find -?",
// n: "findnext 1",
// N: "findnext -1",
//",<Space>": "nohlsearch",
// ",<Space>": "nohlsearch",
M: "gobble 1 quickmark",
B: "fillcmdline taball",
b: "fillcmdline tab",
@ -406,8 +406,8 @@ class default_config {
* Each key corresponds to a URL fragment which, if contained within the page URL, the site will be opened in a container tab instead.
*/
autocontain = o({
//"github.com": "microsoft",
//"youtube.com": "google",
// "github.com": "microsoft",
// "youtube.com": "google",
})
/**

View file

@ -494,7 +494,6 @@ export function focus(e: HTMLElement): void {
/** DOM reference to the last used Input field
*/
//#content_helper
let LAST_USED_INPUT: HTMLElement = null
export function getLastUsedInput(): HTMLElement {

View file

@ -67,7 +67,6 @@ export async function message(type: NonTabMessageType, command, args?) {
}
/** Message the active tab of the currentWindow */
//#background_helper
export async function messageActiveTab(
type: TabMessageType,
command: string,
@ -85,9 +84,7 @@ export async function messageTab(tabId, type: TabMessageType, command, args?) {
return browserBg.tabs.sendMessage(tabId, message)
}
//#content_helper
let _ownTabId = undefined
//#content_helper
export async function messageOwnTab(type: TabMessageType, command, args?) {
if (_ownTabId === undefined) {
_ownTabId = await ownTabId()
@ -127,7 +124,6 @@ export function addListener(type: MessageType, callback: listener) {
}
// Warning: lib/webext.ts:ownTab() relies on this listener being added in order to work
//#content_helper
addListener("owntab_background", (message, sender, sendResponse) => {
let x = Object.assign(Object.create(null), sender.tab)
x.mutedInfo = Object.assign(Object.create(null), sender.tab.mutedInfo)

View file

@ -9,7 +9,7 @@ const logger = new Logger("requests")
class DefaultMap extends Map {
constructor(private defaultFactory, ...args) {
//super(...args)
// super(...args)
super()
}

View file

@ -90,7 +90,7 @@ export function getUrlParent(url, count = 1) {
// more than domain + TLD
if (domains.length > 2) {
//domains.pop()
// domains.pop()
parent.host = domains.slice(1).join(".")
return gup(parent, count - 1)
}
@ -368,14 +368,16 @@ export function interpolateSearchItem(urlPattern: URL, query: string): URL {
// replace or append as needed
if (hasInterpolationPoint) {
let resultingURL = new URL (urlPattern.href.replace(/%s\d+/g, function(x) {
let resultingURL = new URL(
urlPattern.href.replace(/%s\d+/g, function(x) {
const index = parseInt(x.slice(2)) - 1
if (index >= queryWords.length) {
return ""
}
return queryWords[index]
}))
}),
)
return new URL(resultingURL.href.replace("%s", query))
} else {

View file

@ -40,7 +40,6 @@ if (inContentScript()) {
* TODO: Highlander theory: Can there ever be more than one?
*
*/
//#background_helper
export async function activeTab() {
return (await browserBg.tabs.query({
active: true,
@ -48,33 +47,27 @@ export async function activeTab() {
}))[0]
}
//#background_helper
export async function activeTabId() {
return (await activeTab()).id
}
//#background_helper
export async function activeTabContainerId() {
return (await activeTab()).cookieStoreId
}
//#content_helper
export async function ownTab() {
// Warning: this relies on the owntab_background listener being set in messaging.ts in order to work
return browser.runtime.sendMessage({ type: "owntab_background" })
}
//#content_helper
export async function ownTabId() {
return (await ownTab()).id
}
//#content_helper
export async function ownTabContainer() {
return browserBg.contextualIdentities.get((await ownTab()).cookieStoreId)
}
//#background_helper
export async function activeTabContainer() {
let containerId = await activeTabContainerId()
if (containerId !== "firefox-default")

View file

@ -5,7 +5,6 @@
"arrow-parens": false,
"class-name": false,
"cognitive-complexity": false,
"comment-format": false,
"curly": false,
"forin": false,
"if-filter": false,