|
@@ -4,7 +4,20 @@ import {
|
|
|
packageSuggestionsForEnvironments,
|
|
packageSuggestionsForEnvironments,
|
|
|
} from './HumanReadableLogsPackageSuggestions'
|
|
} from './HumanReadableLogsPackageSuggestions'
|
|
|
|
|
|
|
|
-const rules = [
|
|
|
|
|
|
|
+interface Rule {
|
|
|
|
|
+ ruleId: string
|
|
|
|
|
+ types?: string[]
|
|
|
|
|
+ cascadesFrom?: string[]
|
|
|
|
|
+ newMessage?: string
|
|
|
|
|
+ regexToMatch: RegExp
|
|
|
|
|
+ contentRegex?: RegExp
|
|
|
|
|
+ improvedTitle?: (
|
|
|
|
|
+ currentTitle: string,
|
|
|
|
|
+ details?: [string]
|
|
|
|
|
+ ) => string | [string, JSX.Element]
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const rules: Rule[] = [
|
|
|
{
|
|
{
|
|
|
ruleId: 'hint_misplaced_alignment_tab_character',
|
|
ruleId: 'hint_misplaced_alignment_tab_character',
|
|
|
regexToMatch: /Misplaced alignment tab character \&/,
|
|
regexToMatch: /Misplaced alignment tab character \&/,
|
|
@@ -50,15 +63,17 @@ const rules = [
|
|
|
regexToMatch: /Undefined control sequence/,
|
|
regexToMatch: /Undefined control sequence/,
|
|
|
contentRegex:
|
|
contentRegex:
|
|
|
/^(?:l\.[0-9]+|<(?:recently read|inserted text|to be read again)>)\s*(\\\S+)/,
|
|
/^(?:l\.[0-9]+|<(?:recently read|inserted text|to be read again)>)\s*(\\\S+)/,
|
|
|
- improvedTitle: (currentTitle, details) => {
|
|
|
|
|
|
|
+ improvedTitle: (currentTitle: string, details?: [string]) => {
|
|
|
if (details?.length && packageSuggestionsForCommands.has(details[0])) {
|
|
if (details?.length && packageSuggestionsForCommands.has(details[0])) {
|
|
|
const command = details[0]
|
|
const command = details[0]
|
|
|
const suggestion = packageSuggestionsForCommands.get(command)
|
|
const suggestion = packageSuggestionsForCommands.get(command)
|
|
|
- return (
|
|
|
|
|
|
|
+ return [
|
|
|
|
|
+ `Is ${suggestion.command} missing?`,
|
|
|
|
|
+ // eslint-disable-next-line react/jsx-key
|
|
|
<span>
|
|
<span>
|
|
|
Is <code>{suggestion.command}</code> missing?
|
|
Is <code>{suggestion.command}</code> missing?
|
|
|
- </span>
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ </span>,
|
|
|
|
|
+ ]
|
|
|
}
|
|
}
|
|
|
return currentTitle
|
|
return currentTitle
|
|
|
},
|
|
},
|
|
@@ -67,18 +82,20 @@ const rules = [
|
|
|
ruleId: 'hint_undefined_environment',
|
|
ruleId: 'hint_undefined_environment',
|
|
|
regexToMatch: /LaTeX Error: Environment .+ undefined/,
|
|
regexToMatch: /LaTeX Error: Environment .+ undefined/,
|
|
|
contentRegex: /\\begin\{(\S+)\}/,
|
|
contentRegex: /\\begin\{(\S+)\}/,
|
|
|
- improvedTitle: (currentTitle, details) => {
|
|
|
|
|
|
|
+ improvedTitle: (currentTitle: string, details?: [string]) => {
|
|
|
if (
|
|
if (
|
|
|
details?.length &&
|
|
details?.length &&
|
|
|
packageSuggestionsForEnvironments.has(details[0])
|
|
packageSuggestionsForEnvironments.has(details[0])
|
|
|
) {
|
|
) {
|
|
|
const environment = details[0]
|
|
const environment = details[0]
|
|
|
const suggestion = packageSuggestionsForEnvironments.get(environment)
|
|
const suggestion = packageSuggestionsForEnvironments.get(environment)
|
|
|
- return (
|
|
|
|
|
|
|
+ return [
|
|
|
|
|
+ `Is ${suggestion.command} missing?`,
|
|
|
|
|
+ // eslint-disable-next-line react/jsx-key
|
|
|
<span>
|
|
<span>
|
|
|
Is <code>{suggestion.command}</code> missing?
|
|
Is <code>{suggestion.command}</code> missing?
|
|
|
- </span>
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ </span>,
|
|
|
|
|
+ ]
|
|
|
}
|
|
}
|
|
|
return currentTitle
|
|
return currentTitle
|
|
|
},
|
|
},
|