Merge pull request #63 from erickwilder/add-linting-before-build
feat(package.json): Add yarn script to lint source code + make it a precondition to build all packages.
This commit is contained in:
@@ -15,7 +15,7 @@ export default class BoldMark extends Mark {
|
||||
},
|
||||
{
|
||||
tag: 'b',
|
||||
getAttrs: node => node.style.fontWeight != 'normal' && null,
|
||||
getAttrs: node => node.style.fontWeight !== 'normal' && null,
|
||||
},
|
||||
{
|
||||
style: 'font-weight',
|
||||
@@ -38,7 +38,7 @@ export default class BoldMark extends Mark {
|
||||
|
||||
inputRules({ type }) {
|
||||
return [
|
||||
markInputRule(/(?:\*\*|__)([^\*_]+)(?:\*\*|__)$/, type),
|
||||
markInputRule(/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/, type),
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ export default class ItalicMark extends Mark {
|
||||
|
||||
inputRules({ type }) {
|
||||
return [
|
||||
markInputRule(/(?:^|[^\*_])(?:\*|_)([^\*_]+)(?:\*|_)$/, type),
|
||||
markInputRule(/(?:^|[^*_])(?:\*|_)([^*_]+)(?:\*|_)$/, type),
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -22,37 +22,39 @@ function triggerCharacter({
|
||||
const textTo = $position.end()
|
||||
const text = $position.doc.textBetween(textFrom, textTo, '\0', '\0')
|
||||
|
||||
let match
|
||||
let match = regexp.exec(text)
|
||||
let position
|
||||
while (match !== null) {
|
||||
// JavaScript doesn't have lookbehinds; this hacks a check that first character is " "
|
||||
// or the line beginning
|
||||
const matchPrefix = match.input.slice(Math.max(0, match.index - 1), match.index)
|
||||
if (/^[\s\0]?$/.test(matchPrefix)) {
|
||||
// The absolute position of the match in the document
|
||||
const from = match.index + $position.start()
|
||||
let to = from + match[0].length
|
||||
|
||||
while ((match = regexp.exec(text))) {
|
||||
// Javascript doesn't have lookbehinds; this hacks a check that first character is " " or the line beginning
|
||||
const prefix = match.input.slice(Math.max(0, match.index - 1), match.index)
|
||||
if (!/^[\s\0]?$/.test(prefix)) {
|
||||
continue
|
||||
// Edge case handling; if spaces are allowed and we're directly in between
|
||||
// two triggers
|
||||
if (allowSpaces && suffix.test(text.slice(to - 1, to + 1))) {
|
||||
match[0] += ' '
|
||||
to += 1
|
||||
}
|
||||
|
||||
// If the $position is located within the matched substring, return that range
|
||||
if (from < $position.pos && to >= $position.pos) {
|
||||
position = {
|
||||
range: {
|
||||
from,
|
||||
to,
|
||||
},
|
||||
query: match[0].slice(char.length),
|
||||
text: match[0],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The absolute position of the match in the document
|
||||
const from = match.index + $position.start()
|
||||
let to = from + match[0].length
|
||||
|
||||
// Edge case handling; if spaces are allowed and we're directly in between two triggers
|
||||
if (allowSpaces && suffix.test(text.slice(to - 1, to + 1))) {
|
||||
match[0] += ' '
|
||||
to++
|
||||
}
|
||||
|
||||
// If the $position is located within the matched substring, return that range
|
||||
if (from < $position.pos && to >= $position.pos) {
|
||||
return {
|
||||
range: {
|
||||
from,
|
||||
to,
|
||||
},
|
||||
query: match[0].slice(char.length),
|
||||
text: match[0],
|
||||
}
|
||||
}
|
||||
}
|
||||
match = regexp.exec(text)
|
||||
}
|
||||
return position
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user