diff --git a/.eslintrc.yml b/.eslintrc.yml
index 5659d3a..14d45ee 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -147,7 +147,7 @@ rules:
#operator-linebreak: [ 2, after ]
semi: [ 2, never ]
semi-spacing: 2
- space-before-function-paren: [ 2, { "anonymous": "always", "named": "never" } ]
+ space-before-function-paren: [2, always]
space-in-parens: [ 2, never ]
space-infix-ops: 2
space-unary-ops: 2
diff --git a/benchmark/benchmark.mjs b/benchmark/benchmark.mjs
index 555f0aa..b364258 100755
--- a/benchmark/benchmark.mjs
+++ b/benchmark/benchmark.mjs
@@ -33,7 +33,7 @@ fs.readdirSync(new URL('./samples', import.meta.url)).sort().forEach(sample => {
const title = `(${content.string.length} bytes)`
- function onComplete() { cursor.write('\n') }
+ function onComplete () { cursor.write('\n') }
const suite = new Benchmark.Suite(
title,
@@ -47,7 +47,7 @@ fs.readdirSync(new URL('./samples', import.meta.url)).sort().forEach(sample => {
suite.add(
impl.name,
{
- onCycle: function onCycle(event) {
+ onCycle: function onCycle (event) {
cursor.horizontalAbsolute()
cursor.eraseLine()
cursor.write(' > ' + event.target)
@@ -67,14 +67,14 @@ fs.readdirSync(new URL('./samples', import.meta.url)).sort().forEach(sample => {
})
-function select(patterns) {
+function select (patterns) {
const result = []
if (!(patterns instanceof Array)) {
patterns = [ patterns ]
}
- function checkName(name) {
+ function checkName (name) {
return patterns.length === 0 || patterns.some(function (regexp) {
return regexp.test(name)
})
@@ -90,7 +90,7 @@ function select(patterns) {
}
-function run(files) {
+function run (files) {
const selected = select(files)
if (selected.length > 0) {
diff --git a/benchmark/implementations/commonmark-reference/index.mjs b/benchmark/implementations/commonmark-reference/index.mjs
index 90ab737..65505b7 100644
--- a/benchmark/implementations/commonmark-reference/index.mjs
+++ b/benchmark/implementations/commonmark-reference/index.mjs
@@ -6,6 +6,6 @@ const commonmark = require('../../extra/lib/node_modules/commonmark')
const parser = new commonmark.Parser()
const renderer = new commonmark.HtmlRenderer()
-export function run(data) {
+export function run (data) {
return renderer.render(parser.parse(data))
}
diff --git a/benchmark/implementations/current-commonmark/index.mjs b/benchmark/implementations/current-commonmark/index.mjs
index c955d3a..47d2a34 100644
--- a/benchmark/implementations/current-commonmark/index.mjs
+++ b/benchmark/implementations/current-commonmark/index.mjs
@@ -9,6 +9,6 @@ const encode = md.utils.lib.mdurl.encode
md.normalizeLink = function (url) { return encode(url) }
md.normalizeLinkText = function (str) { return str }
-export function run(data) {
+export function run (data) {
return md.render(data)
}
diff --git a/benchmark/implementations/current/index.mjs b/benchmark/implementations/current/index.mjs
index f0c70d2..abbc231 100644
--- a/benchmark/implementations/current/index.mjs
+++ b/benchmark/implementations/current/index.mjs
@@ -6,6 +6,6 @@ const md = markdownit({
typographer: true
})
-export function run(data) {
+export function run (data) {
return md.render(data)
}
diff --git a/benchmark/implementations/markdown-it-2.2.1-commonmark/index.mjs b/benchmark/implementations/markdown-it-2.2.1-commonmark/index.mjs
index cda1dde..6af5567 100644
--- a/benchmark/implementations/markdown-it-2.2.1-commonmark/index.mjs
+++ b/benchmark/implementations/markdown-it-2.2.1-commonmark/index.mjs
@@ -5,6 +5,6 @@ const markdownit = require('../../extra/lib/node_modules/markdown-it')
const md = markdownit('commonmark')
-export function run(data) {
+export function run (data) {
return md.render(data)
}
diff --git a/benchmark/implementations/marked/index.mjs b/benchmark/implementations/marked/index.mjs
index 2806e62..9c9ba76 100644
--- a/benchmark/implementations/marked/index.mjs
+++ b/benchmark/implementations/marked/index.mjs
@@ -3,6 +3,6 @@ const require = createRequire(import.meta.url)
const marked = require('../../extra/lib/node_modules/marked')
-export function run(data) {
+export function run (data) {
return marked(data)
}
diff --git a/bin/markdown-it.mjs b/bin/markdown-it.mjs
index 7a386fa..3b35de6 100755
--- a/bin/markdown-it.mjs
+++ b/bin/markdown-it.mjs
@@ -51,7 +51,7 @@ cli.add_argument('-o', '--output', {
const options = cli.parse_args()
-function readFile(filename, encoding, callback) {
+function readFile (filename, encoding, callback) {
if (options.file === '-') {
// read from stdin
const chunks = []
diff --git a/lib/common/utils.mjs b/lib/common/utils.mjs
index f64406d..8da3f9d 100644
--- a/lib/common/utils.mjs
+++ b/lib/common/utils.mjs
@@ -6,19 +6,19 @@ import ucmicro from 'uc.micro'
import { decodeHTML } from 'entities'
import UNICODE_PUNCT_RE from 'uc.micro/categories/P/regex.js'
-function _class(obj) { return Object.prototype.toString.call(obj) }
+function _class (obj) { return Object.prototype.toString.call(obj) }
-function isString(obj) { return _class(obj) === '[object String]' }
+function isString (obj) { return _class(obj) === '[object String]' }
const _hasOwnProperty = Object.prototype.hasOwnProperty
-function has(object, key) {
+function has (object, key) {
return _hasOwnProperty.call(object, key)
}
// Merge objects
//
-function assign(obj /*from1, from2, from3, ...*/) {
+function assign (obj /*from1, from2, from3, ...*/) {
const sources = Array.prototype.slice.call(arguments, 1)
sources.forEach(function (source) {
@@ -38,13 +38,13 @@ function assign(obj /*from1, from2, from3, ...*/) {
// Remove element from array and put another array at those position.
// Useful for some operations with tokens
-function arrayReplaceAt(src, pos, newElements) {
+function arrayReplaceAt (src, pos, newElements) {
return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1))
}
////////////////////////////////////////////////////////////////////////////////
-function isValidEntityCode(c) {
+function isValidEntityCode (c) {
/*eslint no-bitwise:0*/
// broken sequence
if (c >= 0xD800 && c <= 0xDFFF) { return false }
@@ -61,7 +61,7 @@ function isValidEntityCode(c) {
return true
}
-function fromCodePoint(c) {
+function fromCodePoint (c) {
/*eslint no-bitwise:0*/
if (c > 0xffff) {
c -= 0x10000
@@ -81,7 +81,7 @@ const UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + '|' + ENTITY_RE.sourc
const DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i
-function replaceEntityPattern(match, name) {
+function replaceEntityPattern (match, name) {
if (name.charCodeAt(0) === 0x23/* # */ && DIGITAL_ENTITY_TEST_RE.test(name)) {
const code = name[1].toLowerCase() === 'x' ?
parseInt(name.slice(2), 16) : parseInt(name.slice(1), 10)
@@ -107,12 +107,12 @@ function replaceEntityPattern(match, name) {
return str.replace(ENTITY_RE, replaceEntityPattern);
}*/
-function unescapeMd(str) {
+function unescapeMd (str) {
if (str.indexOf('\\') < 0) { return str }
return str.replace(UNESCAPE_MD_RE, '$1')
}
-function unescapeAll(str) {
+function unescapeAll (str) {
if (str.indexOf('\\') < 0 && str.indexOf('&') < 0) { return str }
return str.replace(UNESCAPE_ALL_RE, function (match, escaped, entity) {
@@ -132,11 +132,11 @@ const HTML_REPLACEMENTS = {
'"': '"'
}
-function replaceUnsafeChar(ch) {
+function replaceUnsafeChar (ch) {
return HTML_REPLACEMENTS[ch]
}
-function escapeHtml(str) {
+function escapeHtml (str) {
if (HTML_ESCAPE_TEST_RE.test(str)) {
return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar)
}
@@ -147,13 +147,13 @@ function escapeHtml(str) {
const REGEXP_ESCAPE_RE = /[.?*+^$[\]\\(){}|-]/g
-function escapeRE(str) {
+function escapeRE (str) {
return str.replace(REGEXP_ESCAPE_RE, '\\$&')
}
////////////////////////////////////////////////////////////////////////////////
-function isSpace(code) {
+function isSpace (code) {
switch (code) {
case 0x09:
case 0x20:
@@ -163,7 +163,7 @@ function isSpace(code) {
}
// Zs (unicode class) || [\t\f\v\r\n]
-function isWhiteSpace(code) {
+function isWhiteSpace (code) {
if (code >= 0x2000 && code <= 0x200A) { return true }
switch (code) {
case 0x09: // \t
@@ -187,7 +187,7 @@ function isWhiteSpace(code) {
/*eslint-disable max-len*/
// Currently without astral characters support.
-function isPunctChar(ch) {
+function isPunctChar (ch) {
return UNICODE_PUNCT_RE.test(ch)
}
@@ -199,7 +199,7 @@ function isPunctChar(ch) {
//
// Don't confuse with unicode punctuation !!! It lacks some chars in ascii range.
//
-function isMdAsciiPunct(ch) {
+function isMdAsciiPunct (ch) {
switch (ch) {
case 0x21/* ! */:
case 0x22/* " */:
@@ -241,7 +241,7 @@ function isMdAsciiPunct(ch) {
// Hepler to unify [reference labels].
//
-function normalizeReference(str) {
+function normalizeReference (str) {
// Trim and collapse whitespace
//
str = str.trim().replace(/\s+/g, ' ')
diff --git a/lib/helpers/parse_link_destination.mjs b/lib/helpers/parse_link_destination.mjs
index 5ea7bb7..8a2868e 100644
--- a/lib/helpers/parse_link_destination.mjs
+++ b/lib/helpers/parse_link_destination.mjs
@@ -3,7 +3,7 @@
import { unescapeAll } from '../common/utils.mjs'
-export default function parseLinkDestination(str, start, max) {
+export default function parseLinkDestination (str, start, max) {
let code
let pos = start
diff --git a/lib/helpers/parse_link_label.mjs b/lib/helpers/parse_link_label.mjs
index 9663852..f1a53fa 100644
--- a/lib/helpers/parse_link_label.mjs
+++ b/lib/helpers/parse_link_label.mjs
@@ -4,7 +4,7 @@
// returns the end of the label
//
-export default function parseLinkLabel(state, start, disableNested) {
+export default function parseLinkLabel (state, start, disableNested) {
let level, found, marker, prevPos
const max = state.posMax
diff --git a/lib/helpers/parse_link_title.mjs b/lib/helpers/parse_link_title.mjs
index 5cacad9..f2eb53b 100644
--- a/lib/helpers/parse_link_title.mjs
+++ b/lib/helpers/parse_link_title.mjs
@@ -4,7 +4,7 @@
import { unescapeAll } from '../common/utils.mjs'
-export default function parseLinkTitle(str, start, max) {
+export default function parseLinkTitle (str, start, max) {
let code, marker
let lines = 0
let pos = start
diff --git a/lib/index.mjs b/lib/index.mjs
index aa6a7b3..0650506 100644
--- a/lib/index.mjs
+++ b/lib/index.mjs
@@ -32,7 +32,7 @@ const config = {
const BAD_PROTO_RE = /^(vbscript|javascript|file|data):/
const GOOD_DATA_RE = /^data:image\/(gif|png|jpeg|webp);/
-function validateLink(url) {
+function validateLink (url) {
// url should be normalized at this point, and existing entities are decoded
const str = url.trim().toLowerCase()
@@ -44,7 +44,7 @@ function validateLink(url) {
const RECODE_HOSTNAME_FOR = [ 'http:', 'https:', 'mailto:' ]
-function normalizeLink(url) {
+function normalizeLink (url) {
const parsed = mdurl.parse(url, true)
if (parsed.hostname) {
@@ -64,7 +64,7 @@ function normalizeLink(url) {
return mdurl.encode(mdurl.format(parsed))
}
-function normalizeLinkText(url) {
+function normalizeLinkText (url) {
const parsed = mdurl.parse(url, true)
if (parsed.hostname) {
@@ -219,7 +219,7 @@ function normalizeLinkText(url) {
* ```
*
**/
-function MarkdownIt(presetName, options) {
+function MarkdownIt (presetName, options) {
if (!(this instanceof MarkdownIt)) {
return new MarkdownIt(presetName, options)
}
diff --git a/lib/parser_block.mjs b/lib/parser_block.mjs
index 28cc6ca..c7b7d7a 100644
--- a/lib/parser_block.mjs
+++ b/lib/parser_block.mjs
@@ -39,7 +39,7 @@ const _rules = [
/**
* new ParserBlock()
**/
-function ParserBlock() {
+function ParserBlock () {
/**
* ParserBlock#ruler -> Ruler
*
diff --git a/lib/parser_core.mjs b/lib/parser_core.mjs
index 2a98653..77a1379 100644
--- a/lib/parser_core.mjs
+++ b/lib/parser_core.mjs
@@ -33,7 +33,7 @@ const _rules = [
/**
* new Core()
**/
-function Core() {
+function Core () {
/**
* Core#ruler -> Ruler
*
diff --git a/lib/parser_inline.mjs b/lib/parser_inline.mjs
index 4cfcdbd..6add04e 100644
--- a/lib/parser_inline.mjs
+++ b/lib/parser_inline.mjs
@@ -61,7 +61,7 @@ const _rules2 = [
/**
* new ParserInline()
**/
-function ParserInline() {
+function ParserInline () {
/**
* ParserInline#ruler -> Ruler
*
diff --git a/lib/renderer.mjs b/lib/renderer.mjs
index 53cc486..19fa4b0 100644
--- a/lib/renderer.mjs
+++ b/lib/renderer.mjs
@@ -126,7 +126,7 @@ default_rules.html_inline = function (tokens, idx /*, options, env */) {
*
* Creates new [[Renderer]] instance and fill [[Renderer#rules]] with defaults.
**/
-function Renderer() {
+function Renderer () {
/**
* Renderer#rules -> Object
@@ -165,7 +165,7 @@ function Renderer() {
*
* Render token attributes to string.
**/
-Renderer.prototype.renderAttrs = function renderAttrs(token) {
+Renderer.prototype.renderAttrs = function renderAttrs (token) {
let i, l, result
if (!token.attrs) { return '' }
@@ -189,7 +189,7 @@ Renderer.prototype.renderAttrs = function renderAttrs(token) {
* Default token renderer. Can be overriden by custom function
* in [[Renderer#rules]].
**/
-Renderer.prototype.renderToken = function renderToken(tokens, idx, options) {
+Renderer.prototype.renderToken = function renderToken (tokens, idx, options) {
const token = tokens[idx]
let result = ''
diff --git a/lib/ruler.mjs b/lib/ruler.mjs
index ec056c9..42156ab 100644
--- a/lib/ruler.mjs
+++ b/lib/ruler.mjs
@@ -20,7 +20,7 @@
/**
* new Ruler()
**/
-function Ruler() {
+function Ruler () {
// List of added rules. Each element is:
//
// {
diff --git a/lib/rules_block/blockquote.mjs b/lib/rules_block/blockquote.mjs
index 705b145..14edc14 100644
--- a/lib/rules_block/blockquote.mjs
+++ b/lib/rules_block/blockquote.mjs
@@ -2,7 +2,7 @@
import { isSpace } from '../common/utils.mjs'
-export default function blockquote(state, startLine, endLine, silent) {
+export default function blockquote (state, startLine, endLine, silent) {
let pos = state.bMarks[startLine] + state.tShift[startLine]
let max = state.eMarks[startLine]
diff --git a/lib/rules_block/code.mjs b/lib/rules_block/code.mjs
index a6bfb4d..52926c9 100644
--- a/lib/rules_block/code.mjs
+++ b/lib/rules_block/code.mjs
@@ -1,6 +1,6 @@
// Code block (4 spaces padded)
-export default function code(state, startLine, endLine/*, silent*/) {
+export default function code (state, startLine, endLine/*, silent*/) {
if (state.sCount[startLine] - state.blkIndent < 4) { return false }
let nextLine = startLine + 1
diff --git a/lib/rules_block/fence.mjs b/lib/rules_block/fence.mjs
index fcbc84e..59d49f5 100644
--- a/lib/rules_block/fence.mjs
+++ b/lib/rules_block/fence.mjs
@@ -1,6 +1,6 @@
// fences (``` lang, ~~~ lang)
-export default function fence(state, startLine, endLine, silent) {
+export default function fence (state, startLine, endLine, silent) {
let pos = state.bMarks[startLine] + state.tShift[startLine]
let max = state.eMarks[startLine]
diff --git a/lib/rules_block/heading.mjs b/lib/rules_block/heading.mjs
index 3227a32..6a971fa 100644
--- a/lib/rules_block/heading.mjs
+++ b/lib/rules_block/heading.mjs
@@ -2,7 +2,7 @@
import { isSpace } from '../common/utils.mjs'
-export default function heading(state, startLine, endLine, silent) {
+export default function heading (state, startLine, endLine, silent) {
let pos = state.bMarks[startLine] + state.tShift[startLine]
let max = state.eMarks[startLine]
diff --git a/lib/rules_block/hr.mjs b/lib/rules_block/hr.mjs
index f648f08..a776c7d 100644
--- a/lib/rules_block/hr.mjs
+++ b/lib/rules_block/hr.mjs
@@ -2,7 +2,7 @@
import { isSpace } from '../common/utils.mjs'
-export default function hr(state, startLine, endLine, silent) {
+export default function hr (state, startLine, endLine, silent) {
const max = state.eMarks[startLine]
// if it's indented more than 3 spaces, it should be a code block
if (state.sCount[startLine] - state.blkIndent >= 4) { return false }
diff --git a/lib/rules_block/html_block.mjs b/lib/rules_block/html_block.mjs
index a261154..f44da53 100644
--- a/lib/rules_block/html_block.mjs
+++ b/lib/rules_block/html_block.mjs
@@ -17,7 +17,7 @@ const HTML_SEQUENCES = [
]
-export default function html_block(state, startLine, endLine, silent) {
+export default function html_block (state, startLine, endLine, silent) {
let pos = state.bMarks[startLine] + state.tShift[startLine]
let max = state.eMarks[startLine]
diff --git a/lib/rules_block/lheading.mjs b/lib/rules_block/lheading.mjs
index 8bfdb49..6776c6b 100644
--- a/lib/rules_block/lheading.mjs
+++ b/lib/rules_block/lheading.mjs
@@ -1,6 +1,6 @@
// lheading (---, ===)
-export default function lheading(state, startLine, endLine/*, silent*/) {
+export default function lheading (state, startLine, endLine/*, silent*/) {
const terminatorRules = state.md.block.ruler.getRules('paragraph')
// if it's indented more than 3 spaces, it should be a code block
diff --git a/lib/rules_block/list.mjs b/lib/rules_block/list.mjs
index d1670ca..97e8b3a 100644
--- a/lib/rules_block/list.mjs
+++ b/lib/rules_block/list.mjs
@@ -4,7 +4,7 @@ import { isSpace } from '../common/utils.mjs'
// Search `[-+*][\n ]`, returns next pos after marker on success
// or -1 on fail.
-function skipBulletListMarker(state, startLine) {
+function skipBulletListMarker (state, startLine) {
const max = state.eMarks[startLine]
let pos = state.bMarks[startLine] + state.tShift[startLine]
@@ -30,7 +30,7 @@ function skipBulletListMarker(state, startLine) {
// Search `\d+[.)][\n ]`, returns next pos after marker on success
// or -1 on fail.
-function skipOrderedListMarker(state, startLine) {
+function skipOrderedListMarker (state, startLine) {
const start = state.bMarks[startLine] + state.tShift[startLine]
const max = state.eMarks[startLine]
let pos = start
@@ -76,7 +76,7 @@ function skipOrderedListMarker(state, startLine) {
return pos
}
-function markTightParagraphs(state, idx) {
+function markTightParagraphs (state, idx) {
const level = state.level + 2
for (let i = idx + 2, l = state.tokens.length - 2; i < l; i++) {
@@ -89,7 +89,7 @@ function markTightParagraphs(state, idx) {
}
-export default function list(state, startLine, endLine, silent) {
+export default function list (state, startLine, endLine, silent) {
let max,
pos,
start,
diff --git a/lib/rules_block/paragraph.mjs b/lib/rules_block/paragraph.mjs
index 521f885..f451215 100644
--- a/lib/rules_block/paragraph.mjs
+++ b/lib/rules_block/paragraph.mjs
@@ -1,6 +1,6 @@
// Paragraph
-export default function paragraph(state, startLine, endLine) {
+export default function paragraph (state, startLine, endLine) {
const terminatorRules = state.md.block.ruler.getRules('paragraph')
const oldParentType = state.parentType
let nextLine = startLine + 1
diff --git a/lib/rules_block/reference.mjs b/lib/rules_block/reference.mjs
index cf398dc..be65dda 100644
--- a/lib/rules_block/reference.mjs
+++ b/lib/rules_block/reference.mjs
@@ -1,6 +1,6 @@
import { isSpace, normalizeReference } from '../common/utils.mjs'
-export default function reference(state, startLine, _endLine, silent) {
+export default function reference (state, startLine, _endLine, silent) {
let lines = 0
let pos = state.bMarks[startLine] + state.tShift[startLine]
diff --git a/lib/rules_block/state_block.mjs b/lib/rules_block/state_block.mjs
index 9cc59ad..7a07c7d 100644
--- a/lib/rules_block/state_block.mjs
+++ b/lib/rules_block/state_block.mjs
@@ -4,7 +4,7 @@ import Token from '../token.mjs'
import { isSpace } from '../common/utils.mjs'
-function StateBlock(src, md, env, tokens) {
+function StateBlock (src, md, env, tokens) {
this.src = src
// link to parser instance
@@ -111,11 +111,11 @@ StateBlock.prototype.push = function (type, tag, nesting) {
return token
}
-StateBlock.prototype.isEmpty = function isEmpty(line) {
+StateBlock.prototype.isEmpty = function isEmpty (line) {
return this.bMarks[line] + this.tShift[line] >= this.eMarks[line]
}
-StateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {
+StateBlock.prototype.skipEmptyLines = function skipEmptyLines (from) {
for (let max = this.lineMax; from < max; from++) {
if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) {
break
@@ -125,7 +125,7 @@ StateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {
}
// Skip spaces from given position.
-StateBlock.prototype.skipSpaces = function skipSpaces(pos) {
+StateBlock.prototype.skipSpaces = function skipSpaces (pos) {
for (let max = this.src.length; pos < max; pos++) {
const ch = this.src.charCodeAt(pos)
if (!isSpace(ch)) { break }
@@ -134,7 +134,7 @@ StateBlock.prototype.skipSpaces = function skipSpaces(pos) {
}
// Skip spaces from given position in reverse.
-StateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos, min) {
+StateBlock.prototype.skipSpacesBack = function skipSpacesBack (pos, min) {
if (pos <= min) { return pos }
while (pos > min) {
@@ -144,7 +144,7 @@ StateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos, min) {
}
// Skip char codes from given position
-StateBlock.prototype.skipChars = function skipChars(pos, code) {
+StateBlock.prototype.skipChars = function skipChars (pos, code) {
for (let max = this.src.length; pos < max; pos++) {
if (this.src.charCodeAt(pos) !== code) { break }
}
@@ -152,7 +152,7 @@ StateBlock.prototype.skipChars = function skipChars(pos, code) {
}
// Skip char codes reverse from given position - 1
-StateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code, min) {
+StateBlock.prototype.skipCharsBack = function skipCharsBack (pos, code, min) {
if (pos <= min) { return pos }
while (pos > min) {
@@ -162,7 +162,7 @@ StateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code, min) {
}
// cut lines range from source.
-StateBlock.prototype.getLines = function getLines(begin, end, indent, keepLastLF) {
+StateBlock.prototype.getLines = function getLines (begin, end, indent, keepLastLF) {
if (begin >= end) {
return ''
}
diff --git a/lib/rules_block/table.mjs b/lib/rules_block/table.mjs
index 38c9f4c..dac69c8 100644
--- a/lib/rules_block/table.mjs
+++ b/lib/rules_block/table.mjs
@@ -2,14 +2,14 @@
import { isSpace } from '../common/utils.mjs'
-function getLine(state, line) {
+function getLine (state, line) {
const pos = state.bMarks[line] + state.tShift[line],
max = state.eMarks[line]
return state.src.slice(pos, max)
}
-function escapedSplit(str) {
+function escapedSplit (str) {
const result = []
const max = str.length
@@ -45,7 +45,7 @@ function escapedSplit(str) {
}
-export default function table(state, startLine, endLine, silent) {
+export default function table (state, startLine, endLine, silent) {
// should have at least two lines
if (startLine + 2 > endLine) { return false }
diff --git a/lib/rules_core/block.mjs b/lib/rules_core/block.mjs
index 6701fb7..0774897 100644
--- a/lib/rules_core/block.mjs
+++ b/lib/rules_core/block.mjs
@@ -1,4 +1,4 @@
-export default function block(state) {
+export default function block (state) {
let token
if (state.inlineMode) {
diff --git a/lib/rules_core/inline.mjs b/lib/rules_core/inline.mjs
index f84105b..efd6c07 100644
--- a/lib/rules_core/inline.mjs
+++ b/lib/rules_core/inline.mjs
@@ -1,4 +1,4 @@
-export default function inline(state) {
+export default function inline (state) {
const tokens = state.tokens
// Parse inlines
diff --git a/lib/rules_core/linkify.mjs b/lib/rules_core/linkify.mjs
index 6797fff..b6576b9 100644
--- a/lib/rules_core/linkify.mjs
+++ b/lib/rules_core/linkify.mjs
@@ -6,15 +6,15 @@
import { arrayReplaceAt } from '../common/utils.mjs'
-function isLinkOpen(str) {
+function isLinkOpen (str) {
return /^\s]/i.test(str)
}
-function isLinkClose(str) {
+function isLinkClose (str) {
return /^<\/a\s*>/i.test(str)
}
-export default function linkify(state) {
+export default function linkify (state) {
const blockTokens = state.tokens
if (!state.md.options.linkify) { return }
diff --git a/lib/rules_core/normalize.mjs b/lib/rules_core/normalize.mjs
index e416ebb..9f1b88d 100644
--- a/lib/rules_core/normalize.mjs
+++ b/lib/rules_core/normalize.mjs
@@ -6,7 +6,7 @@ const NEWLINES_RE = /\r\n?|\n/g
const NULL_RE = /\0/g
-export default function normalize(state) {
+export default function normalize (state) {
let str
// Normalize newlines
diff --git a/lib/rules_core/replacements.mjs b/lib/rules_core/replacements.mjs
index ee9735a..15678fa 100644
--- a/lib/rules_core/replacements.mjs
+++ b/lib/rules_core/replacements.mjs
@@ -26,11 +26,11 @@ const SCOPED_ABBR = {
tm: '™'
}
-function replaceFn(match, name) {
+function replaceFn (match, name) {
return SCOPED_ABBR[name.toLowerCase()]
}
-function replace_scoped(inlineTokens) {
+function replace_scoped (inlineTokens) {
let i, token, inside_autolink = 0
for (i = inlineTokens.length - 1; i >= 0; i--) {
@@ -50,7 +50,7 @@ function replace_scoped(inlineTokens) {
}
}
-function replace_rare(inlineTokens) {
+function replace_rare (inlineTokens) {
let i, token, inside_autolink = 0
for (i = inlineTokens.length - 1; i >= 0; i--) {
@@ -83,7 +83,7 @@ function replace_rare(inlineTokens) {
}
-export default function replace(state) {
+export default function replace (state) {
let blkIdx
if (!state.md.options.typographer) { return }
diff --git a/lib/rules_core/smartquotes.mjs b/lib/rules_core/smartquotes.mjs
index 92a39dc..a3a436d 100644
--- a/lib/rules_core/smartquotes.mjs
+++ b/lib/rules_core/smartquotes.mjs
@@ -8,11 +8,11 @@ const QUOTE_RE = /['"]/g
const APOSTROPHE = '\u2019' /* ’ */
-function replaceAt(str, index, ch) {
+function replaceAt (str, index, ch) {
return str.slice(0, index) + ch + str.slice(index + 1)
}
-function process_inlines(tokens, state) {
+function process_inlines (tokens, state) {
let j
const stack = []
@@ -180,7 +180,7 @@ function process_inlines(tokens, state) {
}
-export default function smartquotes(state) {
+export default function smartquotes (state) {
/*eslint max-depth:0*/
if (!state.md.options.typographer) { return }
diff --git a/lib/rules_core/state_core.mjs b/lib/rules_core/state_core.mjs
index 831440a..655604c 100644
--- a/lib/rules_core/state_core.mjs
+++ b/lib/rules_core/state_core.mjs
@@ -3,7 +3,7 @@
import Token from '../token.mjs'
-function StateCore(src, md, env) {
+function StateCore (src, md, env) {
this.src = src
this.env = env
this.tokens = []
diff --git a/lib/rules_core/text_join.mjs b/lib/rules_core/text_join.mjs
index 431e595..288c05e 100644
--- a/lib/rules_core/text_join.mjs
+++ b/lib/rules_core/text_join.mjs
@@ -6,7 +6,7 @@
// For example, `\:)` shouldn't be replaced with an emoji.
//
-export default function text_join(state) {
+export default function text_join (state) {
let curr, last
const blockTokens = state.tokens
const l = blockTokens.length
diff --git a/lib/rules_inline/autolink.mjs b/lib/rules_inline/autolink.mjs
index be4b048..ddfcbe3 100644
--- a/lib/rules_inline/autolink.mjs
+++ b/lib/rules_inline/autolink.mjs
@@ -5,7 +5,7 @@ const EMAIL_RE = /^([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-
const AUTOLINK_RE = /^([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)$/
-export default function autolink(state, silent) {
+export default function autolink (state, silent) {
let pos = state.pos
if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false }
diff --git a/lib/rules_inline/backticks.mjs b/lib/rules_inline/backticks.mjs
index 6faeab4..5b926d0 100644
--- a/lib/rules_inline/backticks.mjs
+++ b/lib/rules_inline/backticks.mjs
@@ -1,6 +1,6 @@
// Parse backticks
-export default function backtick(state, silent) {
+export default function backtick (state, silent) {
let pos = state.pos
const ch = state.src.charCodeAt(pos)
diff --git a/lib/rules_inline/balance_pairs.mjs b/lib/rules_inline/balance_pairs.mjs
index 223e6ef..a0ed3cf 100644
--- a/lib/rules_inline/balance_pairs.mjs
+++ b/lib/rules_inline/balance_pairs.mjs
@@ -1,7 +1,7 @@
// For each opening emphasis-like marker find a matching closing one
//
-function processDelimiters(delimiters) {
+function processDelimiters (delimiters) {
const openersBottom = {}
const max = delimiters.length
@@ -111,7 +111,7 @@ function processDelimiters(delimiters) {
}
-export default function link_pairs(state) {
+export default function link_pairs (state) {
const tokens_meta = state.tokens_meta
const max = state.tokens_meta.length
diff --git a/lib/rules_inline/emphasis.mjs b/lib/rules_inline/emphasis.mjs
index 9a1b619..60d5f4f 100644
--- a/lib/rules_inline/emphasis.mjs
+++ b/lib/rules_inline/emphasis.mjs
@@ -3,7 +3,7 @@
// Insert each marker as a separate text token, and add it to delimiter list
//
-function emphasis_tokenize(state, silent) {
+function emphasis_tokenize (state, silent) {
const start = state.pos
const marker = state.src.charCodeAt(start)
@@ -49,7 +49,7 @@ function emphasis_tokenize(state, silent) {
}
-function postProcess(state, delimiters) {
+function postProcess (state, delimiters) {
const max = delimiters.length
for (let i = max - 1; i >= 0; i--) {
@@ -106,7 +106,7 @@ function postProcess(state, delimiters) {
// Walk through delimiter list and replace text tokens with tags
//
-function emphasis_post_process(state) {
+function emphasis_post_process (state) {
const tokens_meta = state.tokens_meta
const max = state.tokens_meta.length
diff --git a/lib/rules_inline/entity.mjs b/lib/rules_inline/entity.mjs
index 9364e6c..2ef149d 100644
--- a/lib/rules_inline/entity.mjs
+++ b/lib/rules_inline/entity.mjs
@@ -8,7 +8,7 @@ const DIGITAL_RE = /^((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i
const NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i
-export default function entity(state, silent) {
+export default function entity (state, silent) {
const pos = state.pos
const max = state.posMax
diff --git a/lib/rules_inline/escape.mjs b/lib/rules_inline/escape.mjs
index 7037ece..c63ee5d 100644
--- a/lib/rules_inline/escape.mjs
+++ b/lib/rules_inline/escape.mjs
@@ -10,7 +10,7 @@ for (let i = 0; i < 256; i++) { ESCAPED.push(0) }
.split('').forEach(function (ch) { ESCAPED[ch.charCodeAt(0)] = 1 })
-export default function escape(state, silent) {
+export default function escape (state, silent) {
let pos = state.pos
const max = state.posMax
diff --git a/lib/rules_inline/fragments_join.mjs b/lib/rules_inline/fragments_join.mjs
index 6b71aa1..1831e07 100644
--- a/lib/rules_inline/fragments_join.mjs
+++ b/lib/rules_inline/fragments_join.mjs
@@ -7,7 +7,7 @@
// into opening/closing tags (which messes up levels inside).
//
-export default function fragments_join(state) {
+export default function fragments_join (state) {
let curr, last,
level = 0
const tokens = state.tokens
diff --git a/lib/rules_inline/html_inline.mjs b/lib/rules_inline/html_inline.mjs
index f6b1e6b..7eaabb2 100644
--- a/lib/rules_inline/html_inline.mjs
+++ b/lib/rules_inline/html_inline.mjs
@@ -3,22 +3,22 @@
import { HTML_TAG_RE } from '../common/html_re.mjs'
-function isLinkOpen(str) {
+function isLinkOpen (str) {
return /^\s]/i.test(str)
}
-function isLinkClose(str) {
+function isLinkClose (str) {
return /^<\/a\s*>/i.test(str)
}
-function isLetter(ch) {
+function isLetter (ch) {
/*eslint no-bitwise:0*/
const lc = ch | 0x20 // to lower case
return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */)
}
-export default function html_inline(state, silent) {
+export default function html_inline (state, silent) {
if (!state.md.options.html) { return false }
// Check start
diff --git a/lib/rules_inline/image.mjs b/lib/rules_inline/image.mjs
index 560cd75..0e4c1bf 100644
--- a/lib/rules_inline/image.mjs
+++ b/lib/rules_inline/image.mjs
@@ -3,7 +3,7 @@
import { normalizeReference, isSpace } from '../common/utils.mjs'
-export default function image(state, silent) {
+export default function image (state, silent) {
let code,
content,
label,
diff --git a/lib/rules_inline/link.mjs b/lib/rules_inline/link.mjs
index a3e1f37..c1854c5 100644
--- a/lib/rules_inline/link.mjs
+++ b/lib/rules_inline/link.mjs
@@ -2,7 +2,7 @@
import { normalizeReference, isSpace } from '../common/utils.mjs'
-export default function link(state, silent) {
+export default function link (state, silent) {
let code,
label,
res,
diff --git a/lib/rules_inline/linkify.mjs b/lib/rules_inline/linkify.mjs
index 480a325..50d898a 100644
--- a/lib/rules_inline/linkify.mjs
+++ b/lib/rules_inline/linkify.mjs
@@ -4,7 +4,7 @@
const SCHEME_RE = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i
-export default function linkify(state, silent) {
+export default function linkify (state, silent) {
if (!state.md.options.linkify) return false
if (state.linkLevel > 0) return false
diff --git a/lib/rules_inline/newline.mjs b/lib/rules_inline/newline.mjs
index 60df243..f20b904 100644
--- a/lib/rules_inline/newline.mjs
+++ b/lib/rules_inline/newline.mjs
@@ -2,7 +2,7 @@
import { isSpace } from '../common/utils.mjs'
-export default function newline(state, silent) {
+export default function newline (state, silent) {
let pos = state.pos
if (state.src.charCodeAt(pos) !== 0x0A/* \n */) { return false }
diff --git a/lib/rules_inline/state_inline.mjs b/lib/rules_inline/state_inline.mjs
index 42e8fb1..c07eba0 100644
--- a/lib/rules_inline/state_inline.mjs
+++ b/lib/rules_inline/state_inline.mjs
@@ -3,7 +3,7 @@
import Token from '../token.mjs'
import { isWhiteSpace, isPunctChar, isMdAsciiPunct } from '../common/utils.mjs'
-function StateInline(src, md, env, outTokens) {
+function StateInline (src, md, env, outTokens) {
this.src = src
this.env = env
this.md = md
diff --git a/lib/rules_inline/strikethrough.mjs b/lib/rules_inline/strikethrough.mjs
index 3076831..3b639bb 100644
--- a/lib/rules_inline/strikethrough.mjs
+++ b/lib/rules_inline/strikethrough.mjs
@@ -3,7 +3,7 @@
// Insert each marker as a separate text token, and add it to delimiter list
//
-function strikethrough_tokenize(state, silent) {
+function strikethrough_tokenize (state, silent) {
const start = state.pos
const marker = state.src.charCodeAt(start)
@@ -45,7 +45,7 @@ function strikethrough_tokenize(state, silent) {
}
-function postProcess(state, delimiters) {
+function postProcess (state, delimiters) {
let token
const loneMarkers = []
const max = delimiters.length
@@ -111,7 +111,7 @@ function postProcess(state, delimiters) {
// Walk through delimiter list and replace text tokens with tags
//
-function strikethrough_postProcess(state) {
+function strikethrough_postProcess (state) {
const tokens_meta = state.tokens_meta
const max = state.tokens_meta.length
diff --git a/lib/rules_inline/text.mjs b/lib/rules_inline/text.mjs
index 0a72426..2b50abc 100644
--- a/lib/rules_inline/text.mjs
+++ b/lib/rules_inline/text.mjs
@@ -8,7 +8,7 @@
// !!!! Don't confuse with "Markdown ASCII Punctuation" chars
// http://spec.commonmark.org/0.15/#ascii-punctuation-character
-function isTerminatorChar(ch) {
+function isTerminatorChar (ch) {
switch (ch) {
case 0x0A/* \n */:
case 0x21/* ! */:
@@ -39,7 +39,7 @@ function isTerminatorChar(ch) {
}
}
-export default function text(state, silent) {
+export default function text (state, silent) {
let pos = state.pos
while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) {
diff --git a/lib/token.mjs b/lib/token.mjs
index 2c5f70c..606271b 100644
--- a/lib/token.mjs
+++ b/lib/token.mjs
@@ -9,7 +9,7 @@
*
* Create new token and fill passed properties.
**/
-function Token(type, tag, nesting) {
+function Token (type, tag, nesting) {
/**
* Token#type -> String
*
@@ -119,7 +119,7 @@ function Token(type, tag, nesting) {
*
* Search attribute index by name.
**/
-Token.prototype.attrIndex = function attrIndex(name) {
+Token.prototype.attrIndex = function attrIndex (name) {
if (!this.attrs) { return -1 }
const attrs = this.attrs
@@ -136,7 +136,7 @@ Token.prototype.attrIndex = function attrIndex(name) {
*
* Add `[ name, value ]` attribute to list. Init attrs if necessary
**/
-Token.prototype.attrPush = function attrPush(attrData) {
+Token.prototype.attrPush = function attrPush (attrData) {
if (this.attrs) {
this.attrs.push(attrData)
} else {
@@ -150,7 +150,7 @@ Token.prototype.attrPush = function attrPush(attrData) {
*
* Set `name` attribute to `value`. Override old value if exists.
**/
-Token.prototype.attrSet = function attrSet(name, value) {
+Token.prototype.attrSet = function attrSet (name, value) {
const idx = this.attrIndex(name),
attrData = [ name, value ]
@@ -167,7 +167,7 @@ Token.prototype.attrSet = function attrSet(name, value) {
*
* Get the value of attribute `name`, or null if it does not exist.
**/
-Token.prototype.attrGet = function attrGet(name) {
+Token.prototype.attrGet = function attrGet (name) {
const idx = this.attrIndex(name)
let value = null
if (idx >= 0) {
@@ -183,7 +183,7 @@ Token.prototype.attrGet = function attrGet(name) {
* Join value to existing attribute via space. Or create new attribute if not
* exists. Useful to operate with token classes.
**/
-Token.prototype.attrJoin = function attrJoin(name, value) {
+Token.prototype.attrJoin = function attrJoin (name, value) {
const idx = this.attrIndex(name)
if (idx < 0) {
diff --git a/support/build_demo.mjs b/support/build_demo.mjs
index ced82fa..5d11869 100644
--- a/support/build_demo.mjs
+++ b/support/build_demo.mjs
@@ -3,7 +3,7 @@
import shell from 'shelljs'
import { readFileSync, writeFileSync } from 'fs'
-function escape(input) {
+function escape (input) {
return input
.replaceAll('&', '&')
.replaceAll('<', '<')
diff --git a/support/demo_template/index.mjs b/support/demo_template/index.mjs
index 83066c5..042bfdd 100644
--- a/support/demo_template/index.mjs
+++ b/support/demo_template/index.mjs
@@ -62,7 +62,7 @@ defaults.highlight = function (str, lang) {
return '' + esc(str) + '
'
}
-function setOptionClass(name, val) {
+function setOptionClass (name, val) {
if (val) {
$('body').addClass('opt_' + name)
} else {
@@ -70,7 +70,7 @@ function setOptionClass(name, val) {
}
}
-function setResultView(val) {
+function setResultView (val) {
$('body').removeClass('result-as-html')
$('body').removeClass('result-as-src')
$('body').removeClass('result-as-debug')
@@ -78,7 +78,7 @@ function setResultView(val) {
defaults._view = val
}
-function mdInit() {
+function mdInit () {
if (defaults._strict) {
mdHtml = window.markdownit('commonmark')
mdSrc = window.markdownit('commonmark')
@@ -120,7 +120,7 @@ function mdInit() {
//
// - We track only headings and paragraphs on first level. That's enough.
// - Footnotes content causes jumps. Level limit filter it automatically.
- function injectLineNumbers(tokens, idx, options, env, slf) {
+ function injectLineNumbers (tokens, idx, options, env, slf) {
let line
if (tokens[idx].map && tokens[idx].level === 0) {
line = tokens[idx].map[0]
@@ -133,7 +133,7 @@ function mdInit() {
mdHtml.renderer.rules.paragraph_open = mdHtml.renderer.rules.heading_open = injectLineNumbers
}
-function setHighlightedlContent(selector, content, lang) {
+function setHighlightedlContent (selector, content, lang) {
if (window.hljs) {
$(selector).html(window.hljs.highlight(content, { language: lang }).value)
} else {
@@ -141,7 +141,7 @@ function setHighlightedlContent(selector, content, lang) {
}
}
-function updateResult() {
+function updateResult () {
const source = $('.source').val()
// Update only active view to avoid slowdowns
@@ -181,7 +181,7 @@ function updateResult() {
// Build offsets for each line (lines can be wrapped)
// That's a bit dirty to process each line everytime, but ok for demo.
// Optimizations are required only for big texts.
-function buildScrollMap() {
+function buildScrollMap () {
const textarea = $('.source')
const sourceLikeDiv = $('').css({
@@ -295,7 +295,7 @@ const syncSrcScroll = _.debounce(function () {
}, 50, { maxWait: 50 })
-function loadPermalink() {
+function loadPermalink () {
if (!location.hash) { return }
diff --git a/support/rollup.config.mjs b/support/rollup.config.mjs
index 7020ae0..dc0cc9b 100644
--- a/support/rollup.config.mjs
+++ b/support/rollup.config.mjs
@@ -43,7 +43,7 @@ export default {
nodeResolve({ preferBuiltins: true }),
commonjs(),
{
- banner() {
+ banner () {
return `/*! ${pkg.name} ${pkg.version} https://github.com/${pkg.repository} @license ${pkg.license} */`
}
}
diff --git a/support/specsplit.mjs b/support/specsplit.mjs
index b70ed31..407b589 100755
--- a/support/specsplit.mjs
+++ b/support/specsplit.mjs
@@ -33,13 +33,13 @@ const options = cli.parse_args()
////////////////////////////////////////////////////////////////////////////////
-function normalize(text) {
+function normalize (text) {
return text.replace(/\n<\/blockquote>/g, '')
}
////////////////////////////////////////////////////////////////////////////////
-function readFile(filename, encoding, callback) {
+function readFile (filename, encoding, callback) {
if (options.file === '-') {
// read from stdin
diff --git a/test/commonmark.mjs b/test/commonmark.mjs
index f04591a..e45c6e3 100644
--- a/test/commonmark.mjs
+++ b/test/commonmark.mjs
@@ -5,12 +5,12 @@ import markdownit from '../index.mjs'
import { assert } from 'chai'
-function normalize(text) {
+function normalize (text) {
return text.replace(/\n<\/blockquote>/g, '')
}
-function generate(path, md) {
+function generate (path, md) {
load(path, function (data) {
data.meta = data.meta || {}
diff --git a/test/misc.mjs b/test/misc.mjs
index 160e9d3..e44d76f 100644
--- a/test/misc.mjs
+++ b/test/misc.mjs
@@ -30,7 +30,7 @@ describe('API', function () {
it('plugin', function () {
let succeeded = false
- function plugin(slf, opts) { if (opts === 'bar') { succeeded = true } }
+ function plugin (slf, opts) { if (opts === 'bar') { succeeded = true } }
const md = markdownit()
@@ -410,7 +410,7 @@ describe('smartquotes', function () {
describe('Ordered list info', function () {
const md = markdownit()
- function type_filter(tokens, type) {
+ function type_filter (tokens, type) {
return tokens.filter(function (t) { return t.type === type })
}
diff --git a/test/pathological.mjs b/test/pathological.mjs
index 8d5143c..666901c 100644
--- a/test/pathological.mjs
+++ b/test/pathological.mjs
@@ -5,7 +5,7 @@ import { Worker as JestWorker } from 'jest-worker'
import { readFileSync } from 'fs'
-async function test_pattern(str) {
+async function test_pattern (str) {
const worker = new JestWorker(
new URL('./pathological_worker.js', import.meta.url),
{
diff --git a/test/ruler.mjs b/test/ruler.mjs
index 966d4b7..e649f4f 100644
--- a/test/ruler.mjs
+++ b/test/ruler.mjs
@@ -7,8 +7,8 @@ describe('Ruler', function () {
const ruler = new Ruler()
let res = 0
- ruler.push('test', function foo() { res = 1 })
- ruler.at('test', function bar() { res = 2 })
+ ruler.push('test', function foo () { res = 1 })
+ ruler.at('test', function bar () { res = 2 })
const rules = ruler.getRules('')
@@ -22,9 +22,9 @@ describe('Ruler', function () {
const ruler = new Ruler()
let res = 0
- ruler.push('test', function foo() { res = 1 })
- ruler.before('test', 'before_test', function fooBefore() { res = -10 })
- ruler.after('test', 'after_test', function fooAfter() { res = 10 })
+ ruler.push('test', function foo () { res = 1 })
+ ruler.before('test', 'before_test', function fooBefore () { res = -10 })
+ ruler.after('test', 'after_test', function fooAfter () { res = 10 })
const rules = ruler.getRules('')
@@ -42,8 +42,8 @@ describe('Ruler', function () {
const ruler = new Ruler()
let rules
- ruler.push('test', function foo() {})
- ruler.push('test2', function bar() {})
+ ruler.push('test', function foo () {})
+ ruler.push('test2', function bar () {})
rules = ruler.getRules('')
assert.strictEqual(rules.length, 2)
@@ -68,8 +68,8 @@ describe('Ruler', function () {
const ruler = new Ruler()
let rules
- ruler.push('test', function foo() {})
- ruler.push('test2', function bar() {})
+ ruler.push('test', function foo () {})
+ ruler.push('test2', function bar () {})
ruler.disable([ 'test', 'test2' ])
rules = ruler.getRules('')
@@ -83,8 +83,8 @@ describe('Ruler', function () {
it('should enable rules by whitelist', function () {
const ruler = new Ruler()
- ruler.push('test', function foo() {})
- ruler.push('test2', function bar() {})
+ ruler.push('test', function foo () {})
+ ruler.push('test2', function bar () {})
ruler.enableOnly('test')
const rules = ruler.getRules('')
@@ -96,9 +96,9 @@ describe('Ruler', function () {
const ruler = new Ruler()
let rules
- ruler.push('test', function foo() {})
- ruler.push('test2', function bar() {}, { alt: [ 'alt1' ] })
- ruler.push('test2', function bar() {}, { alt: [ 'alt1', 'alt2' ] })
+ ruler.push('test', function foo () {})
+ ruler.push('test2', function bar () {}, { alt: [ 'alt1' ] })
+ ruler.push('test2', function bar () {}, { alt: [ 'alt1', 'alt2' ] })
rules = ruler.getRules('')
assert.strictEqual(rules.length, 3)
@@ -112,16 +112,16 @@ describe('Ruler', function () {
it('should fail on invalid rule name', function () {
const ruler = new Ruler()
- ruler.push('test', function foo() {})
+ ruler.push('test', function foo () {})
assert.throws(function () {
- ruler.at('invalid name', function bar() {})
+ ruler.at('invalid name', function bar () {})
})
assert.throws(function () {
- ruler.before('invalid name', function bar() {})
+ ruler.before('invalid name', function bar () {})
})
assert.throws(function () {
- ruler.after('invalid name', function bar() {})
+ ruler.after('invalid name', function bar () {})
})
assert.throws(function () {
ruler.enable('invalid name')
@@ -135,7 +135,7 @@ describe('Ruler', function () {
it('should not fail on invalid rule name in silent mode', function () {
const ruler = new Ruler()
- ruler.push('test', function foo() {})
+ ruler.push('test', function foo () {})
assert.doesNotThrow(function () {
ruler.enable('invalid name', true)