|
@ -41,7 +41,7 @@ const options = { |
|
|
|
|
|
|
|
|
export const runESLint = ( |
|
|
export const runESLint = ( |
|
|
doc: Text |
|
|
doc: Text |
|
|
): {errors: any[]; codeMirrorPayload: Diagnostic[]} => { |
|
|
): {errors: any[]; codeMirrorErrors: Diagnostic[]} => { |
|
|
const codeString = doc.toString(); |
|
|
const codeString = doc.toString(); |
|
|
const errors = linter.verify(codeString, options) as any[]; |
|
|
const errors = linter.verify(codeString, options) as any[]; |
|
|
|
|
|
|
|
@ -50,7 +50,7 @@ export const runESLint = ( |
|
|
2: 'error', |
|
|
2: 'error', |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const codeMirrorPayload = errors |
|
|
const codeMirrorErrors = errors |
|
|
.map((error) => { |
|
|
.map((error) => { |
|
|
if (!error) return undefined; |
|
|
if (!error) return undefined; |
|
|
|
|
|
|
|
@ -65,6 +65,7 @@ export const runESLint = ( |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
|
|
|
ruleId: error.ruleId, |
|
|
from, |
|
|
from, |
|
|
to, |
|
|
to, |
|
|
severity: severity[error.severity], |
|
|
severity: severity[error.severity], |
|
@ -74,7 +75,7 @@ export const runESLint = ( |
|
|
.filter(Boolean) as Diagnostic[]; |
|
|
.filter(Boolean) as Diagnostic[]; |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
codeMirrorPayload, |
|
|
codeMirrorErrors, |
|
|
errors: errors.map((item) => { |
|
|
errors: errors.map((item) => { |
|
|
return { |
|
|
return { |
|
|
...item, |
|
|
...item, |
|
|