React: Add inline syntax errors to website editor

Created on 4 Oct 2017  路  6Comments  路  Source: facebook/react

@tsriram suggested a proof of concept in

I like that. I wonder if we can do it with the new editor.

Most helpful comment

Maybe there's a custom format we could define that would enable the user to inject error messages with a row and (optional) column number that would be sufficiently compiler-agnostic?

type compilationErrors = Array<{
  message: string,
  rowNumber: number,
  columnNumber?: number
}>

All 6 comments

We use the LiveEditor from FormidableLabs/react-live for the left hand side of the new editor, so we'd need to either re-implement this component ourselves (not ideal) or add this functionality upstream. Not sure if they'd be interested in the latter, given they already have a LiveError component.

cc @philpl for thoughts 馃槃

@bvaughn I鈥檇 be super up for it! 馃槻

The biggest conflict I see is with adding custom transpilers. The implementation of this feature might vary slightly depending on what transpiler is used unfortunately 馃

Also the site is currently using a fully custom transpiler on top of Babel-standalone.

But once we reconcile these problems, I鈥檓 sure it鈥檚 not too hard to add

Maybe there's a custom format we could define that would enable the user to inject error messages with a row and (optional) column number that would be sufficiently compiler-agnostic?

type compilationErrors = Array<{
  message: string,
  rowNumber: number,
  columnNumber?: number
}>

@bvaughn that'd be great! Could just be added to the Editor without much effort.

Not sure how soon I'll have time for this. Do you mind copying this issue with the suggested API over into an issue on react-live please? :)

You got it! FormidableLabs/react-live/issues/41

Moved to reactjs/reactjs.org/issues/10

Was this page helpful?
0 / 5 - 0 ratings