Skip to content
This repository has been archived by the owner on Nov 7, 2019. It is now read-only.

Commit

Permalink
style(tsconfig): no implicit returns
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed Jun 7, 2016
1 parent e7524aa commit d75565f
Show file tree
Hide file tree
Showing 20 changed files with 60 additions and 37 deletions.
15 changes: 9 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ import escape from './escape'
import Tokenizer from './parse/tokenizer'; // tslint:disable-line
import {Node} from './node' // tslint:disable-line

export default {
parser: parse,
export const parser = parse
export const compiler = stringify
export const data = { escape }

export {
blockTokenizers,
inlineTokenizers,
compiler: stringify,
visitors,
data: {
escape,
},
Tokenizer,
}

export { ParserOptions } from './parse/parser'
export { CompilerOptions } from './stringify/compiler'
2 changes: 2 additions & 0 deletions src/parse/block-tokenizers/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ const tokenizeCode: Tokenizer = function (parser, value, silent) {

return parser.eat(subvalue)(renderCodeBlock(content))
}

return false
}

export default tokenizeCode
16 changes: 9 additions & 7 deletions src/parse/block-tokenizers/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const tokenizeDefinition: Tokenizer = function (parser, value, silent) {
character = value.charAt(index)

if (character !== '[') {
return
return false
}

index++
Expand All @@ -97,7 +97,7 @@ const tokenizeDefinition: Tokenizer = function (parser, value, silent) {
value.charAt(index) !== ']' ||
value.charAt(index + 1) !== ':'
) {
return
return false
}

const identifier = queue
Expand Down Expand Up @@ -142,7 +142,7 @@ const tokenizeDefinition: Tokenizer = function (parser, value, silent) {

if (character !== isEnclosedURLCharacter.delimiter) {
if (commonmark) {
return
return false
}

index -= queue.length + 1
Expand All @@ -169,7 +169,7 @@ const tokenizeDefinition: Tokenizer = function (parser, value, silent) {
}

if (!queue) {
return
return false
}

let url = queue
Expand Down Expand Up @@ -206,7 +206,7 @@ const tokenizeDefinition: Tokenizer = function (parser, value, silent) {
queue = ''
index = subvalue.length
} else if (!queue) {
return
return false
} else {
subvalue += queue + character
index = subvalue.length
Expand All @@ -224,7 +224,7 @@ const tokenizeDefinition: Tokenizer = function (parser, value, silent) {
character = value.charAt(index)

if (character === '\n' || character === test) {
return
return false
}

queue += '\n'
Expand All @@ -237,7 +237,7 @@ const tokenizeDefinition: Tokenizer = function (parser, value, silent) {
character = value.charAt(index)

if (character !== test) {
return
return false
}

beforeTitle = subvalue
Expand Down Expand Up @@ -280,6 +280,8 @@ const tokenizeDefinition: Tokenizer = function (parser, value, silent) {
url,
})
}

return false
}

tokenizeDefinition.onlyAtTop = true
Expand Down
3 changes: 2 additions & 1 deletion src/parse/block-tokenizers/new-line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const tokenizeNewline: Tokenizer = function (parser, value, silent) {
let character = value.charAt(0)

if (character !== '\n') {
return
return false
}

/* istanbul ignore if - never used (yet) */
Expand Down Expand Up @@ -46,6 +46,7 @@ const tokenizeNewline: Tokenizer = function (parser, value, silent) {
}

parser.eat(subvalue)
return true
}

export default tokenizeNewline
5 changes: 3 additions & 2 deletions src/parse/block-tokenizers/thematic-break.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const tokenizeThematicBreak: Tokenizer = function (parser, value, silent) {
}

if (!ruleMarkers.has(character)) {
return
return false
}

const marker = character
Expand Down Expand Up @@ -61,9 +61,10 @@ const tokenizeThematicBreak: Tokenizer = function (parser, value, silent) {
type: 'thematicBreak',
})
} else {
return
return false
}
}
return false
}

export default tokenizeThematicBreak
4 changes: 3 additions & 1 deletion src/parse/block-tokenizers/yaml-front-matter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const tokenizeYAMLFrontMatter: Tokenizer = function (parser, value, silent) {
value.charAt(2) !== '-' ||
value.charAt(3) !== '\n'
) {
return
return false
}

let subvalue = `${YAML_FENCE}\n`
Expand Down Expand Up @@ -62,6 +62,8 @@ const tokenizeYAMLFrontMatter: Tokenizer = function (parser, value, silent) {
queue = ''
}
}

return false
}

tokenizeYAMLFrontMatter.onlyAtStart = true
Expand Down
1 change: 1 addition & 0 deletions src/parse/eat/html-cdata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ export default function eatHTMLCDATA (value: string): string {
index++
}
}
return null
}
5 changes: 3 additions & 2 deletions src/parse/eat/html-closing-tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function eatHTMLClosingTag (value: string, isBlock?: boolean): st
subqueue = character = value.charAt(++index)

if (!isAlphabetic(character)) {
return
return null
}

index++
Expand All @@ -49,7 +49,7 @@ export default function eatHTMLClosingTag (value: string, isBlock?: boolean): st
}

if (isBlock && blockElements.indexOf(subqueue.toLowerCase()) === -1) {
return
return null
}

queue += subqueue
Expand All @@ -73,4 +73,5 @@ export default function eatHTMLClosingTag (value: string, isBlock?: boolean): st
return `${queue}>`
}
}
return null
}
5 changes: 3 additions & 2 deletions src/parse/eat/html-comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ function eatHTMLComment (value: string, settings: any): string {

if (commonmark) {
if (character === '>' && !hasNonDash) {
return
return null
}

if (character === '-') {
if (value.charAt(index + 1) === '-') {
return
return null
}
} else {
hasNonDash = true
Expand All @@ -50,6 +50,7 @@ function eatHTMLComment (value: string, settings: any): string {
index++
}
}
return null
}

export default eatHTMLComment
3 changes: 2 additions & 1 deletion src/parse/eat/html-declaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function eatHTMLDeclaration (value: string): string {
character = value.charAt(index)

if (!subqueue || !isWhiteSpace(character)) {
return
return null
}

queue += subqueue + character
Expand All @@ -58,4 +58,5 @@ export default function eatHTMLDeclaration (value: string): string {
index++
}
}
return null
}
9 changes: 5 additions & 4 deletions src/parse/eat/html-opening-tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default function eatHTMLOpeningTag (value: string, isBlock?: boolean): st
subqueue = character = value.charAt(++index)

if (!isAlphabetic(character)) {
return
return null
}

index++
Expand All @@ -98,7 +98,7 @@ export default function eatHTMLOpeningTag (value: string, isBlock?: boolean): st
}

if (isBlock && blockElements.indexOf(subqueue.toLowerCase()) === -1) {
return
return null
}

queue += subqueue
Expand Down Expand Up @@ -229,14 +229,14 @@ export default function eatHTMLOpeningTag (value: string, isBlock?: boolean): st

if (!test.delimiter) {
if (!subqueue.length) {
return
return null
}

index--
} else if (character === test.delimiter) {
subqueue += character
} else {
return
return null
}

queue += subqueue
Expand All @@ -263,4 +263,5 @@ export default function eatHTMLOpeningTag (value: string, isBlock?: boolean): st

return character === '>' ? queue + character : null
}
return null
}
1 change: 1 addition & 0 deletions src/parse/eat/html-processing-instructions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ function eatHTMLProcessingInstruction (value: string): string {
index++
}
}
return null
}
5 changes: 3 additions & 2 deletions src/parse/inline-tokenizers/break.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const tokenizeBreak: Tokenizer = function (parser, value, silent) {

if (character === '\n') {
if (!breaks && index < MIN_BREAK_LENGTH) {
return
return false
}

/* istanbul ignore if - never used (yet) */
Expand All @@ -39,11 +39,12 @@ const tokenizeBreak: Tokenizer = function (parser, value, silent) {
}

if (character !== ' ') {
return
return false
}

queue += character
}
return false
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/parse/inline-tokenizers/deletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const tokenizeDeletion: Tokenizer = function (parser, value, silent) {
value.charAt(1) !== '~' ||
isWhiteSpace(value.charAt(2))
) {
return
return false
}

let index = 1
Expand Down Expand Up @@ -57,6 +57,7 @@ const tokenizeDeletion: Tokenizer = function (parser, value, silent) {
preceding = previous
previous = character
}
return false
}

/**
Expand Down
7 changes: 4 additions & 3 deletions src/parse/inline-tokenizers/emphasis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const tokenizeEmphasis: Tokenizer = function (parser, value, silent) {
let character = value.charAt(index)

if (!~'*_'.indexOf(character)) {
return
return false
}

const pedantic = parser.options.pedantic
Expand All @@ -45,7 +45,7 @@ const tokenizeEmphasis: Tokenizer = function (parser, value, silent) {
let queue = character = ''

if (pedantic && isWhiteSpace(value.charAt(index))) {
return
return false
}

while (index < value.length) {
Expand All @@ -60,7 +60,7 @@ const tokenizeEmphasis: Tokenizer = function (parser, value, silent) {

if (character !== marker) {
if (!queue.trim() || prev === marker) {
return
return false
}

if (
Expand Down Expand Up @@ -95,6 +95,7 @@ const tokenizeEmphasis: Tokenizer = function (parser, value, silent) {
queue += character
index++
}
return false
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/parse/inline-tokenizers/escape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const tokenizeEscape: Tokenizer = function (parser, value, silent) {
)
}
}
return false
}

/*
Expand Down
7 changes: 4 additions & 3 deletions src/parse/inline-tokenizers/strong.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const tokenizeStrong: Tokenizer = function (parser, value, silent) {
!~'*_'.indexOf(character) ||
value.charAt(++index) !== character
) {
return
return false
}

const pedantic = parser.options.pedantic
Expand All @@ -32,7 +32,7 @@ const tokenizeStrong: Tokenizer = function (parser, value, silent) {
let queue = character = ''

if (pedantic && isWhiteSpace(value.charAt(index))) {
return
return false
}

let prev: string
Expand All @@ -49,7 +49,7 @@ const tokenizeStrong: Tokenizer = function (parser, value, silent) {

if (character !== marker) {
if (!queue.trim()) {
return
return false
}

/* istanbul ignore if - never used (yet) */
Expand All @@ -76,6 +76,7 @@ const tokenizeStrong: Tokenizer = function (parser, value, silent) {
queue += character
index++
}
return false
}

/**
Expand Down
Loading

0 comments on commit d75565f

Please sign in to comment.