observablehq / inspector

The Observable standard inspector.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add linting while writing code?

dgrcode opened this issue · comments

I'm not sure if this issue goes into this repo. Please let me know if it belongs to a different one and I'll be happy to move it.

The idea is that we would get linting warnings and errors while writing code on the notebooks. Initially this could be style agnostic and just show warnings or errors in code that would not compile or that is known as bad practice (typeof null, non-strict comparisons, etc.), but it could also support getting an .eslintrc by fetching or uploading a file.

I'd be more than happy working in getting this feature available.

Hi @dgrcode - yep, this repo probably isn't the best for this conversation. notebook-inspector inspects the output values of Observable notebooks, like allowing you to explore objects and arrays - it doesn't have any role in terms of authoring those notebooks. We have an active forum for other discussions.

Per linters - well, our current focus is on adding prettier, which is nearly complete except for a performance fix that we’d like to implement for prettier. We might spend some more time making some helpful suggestions or auto-fixers, but the philosophy isn't so much about bringing more JavaScript/editor features into Observable than imagining whether we can implement something simpler and more consistent. Prettier, for example, is only available with the default settings and will have no configuration - it’s just on or off.

I think some checkers are useful, but for newcomers to JavaScript and especially for short chunks of code, best practices aren't necessarily worthwhile - if the code runs, it works. Best practices are super useful for larger applications, but often they don't scale down and they have the unfortunate side effect of making projects and such less accessible to newbies.