Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Consume Linter-Plus #12

Closed
steelbrain opened this issue May 27, 2015 · 7 comments
Closed

Consume Linter-Plus #12

steelbrain opened this issue May 27, 2015 · 7 comments

Comments

@steelbrain
Copy link

This is a meta bug about replacing AtomLinter with it's rewrite Linter-Plus, This rewrite features an extremely easy and flexible to use API along, which removes almost all of the limitations, including the complete project linting for hack.
Linter-Plus provides it's providers three types of messages

class LinterTrace
  constructor:(@Message, @File, @Position)
class LinterError
  constructor:(@Message, @File, @Position, @Trace)
class LinterWarning
  constructor:(@Message, @File, @Position, @Trace)

That, when consumed properly results like this
screenshot from 2015-05-27 09-02-29
Fixes #1
Fixes #5
Fixes #6
Fixes #7
Fixes #8
Blocked on AtomLinter/linter-plus#6 (it's ready to ship, will be shipped in a few hours maybe?)

@bolinfest
Copy link
Contributor

One objection I have to the linter-plus API is that it requires providers to use linter-plus's object model, which is awkward. Looking at https://github.com/steelbrain/Atom-Hack/blob/rewrite/lib/atom-hack.coffee, I'm not comfortable with how Trace or Error is injected. This makes it very hard to write an apm test for your provider.

By comparison, autocomplete-plus does not use inheritance or class-based types. It requires providers to return objects with properties of specific types. I think that is much cleaner.

@steelbrain
Copy link
Author

I fail to think of a reason to choose {type:"Error", file:Message.File, position: Message.Position, message: Message.desc} over new Error(Message.desc, Message.File, Message.Position).
that Error class however at some points make the codebase of linter-plus simpler.

@bolinfest
Copy link
Contributor

I should be able to write a unit test for my linter provider that does not depend on the consumer. If I were to do that today, I would have to mock out constructors for Error and Trace, which makes the test more tedious to write.

This is a real issue. Note that today we have to disable our tests for our FlowLinter because we have observed that tests that have to call activatePackage('linter') in beforeEach() are flaky:

https://github.com/facebook/nuclide/blob/9ed0ce4571baa7ba987118903f7ba3d46692191a/pkg/nuclide/flow/spec/FlowLinter-spec.js#L13-L14

This is because linter requires you to get a superclass from the Atom package itself:

https://github.com/facebook/nuclide/blob/9ed0ce4571baa7ba987118903f7ba3d46692191a/pkg/nuclide/flow/lib/FlowLinter.js#L13

The build flakiness is not worth it.

Also, passing in constructor functions is not the cleanest thing to do, IMHO. You could just as easily pass in some sort of factory with methods like createError(), etc., that would be cleaner. At least those would be easier to mock.

Further, your current contracts are not future-proof. That is, what happens when you want to start adding more parameters, more of which are optional? Your param list will become a mess. It would be easiest to represent each type as an object literal (at least from the provider's perspective) so that the consumer can recognize more properties over time, but older providers will still work.

In sum, let providers return object literals, and internally, you can convert them to Error, Trace, etc. Things will be more loosely coupled that way.

@steelbrain
Copy link
Author

Thank you for providing a valid reason. I agree that Error and Trace constructors are not future proof, It would introduce complications when we add new parameters to constructors.

On a side note, createError isn't really the cleanest way to do this, so I am gonna make linter-plus accept Error like Objects very soon after the PR mentioned above has been accepted.

@steelbrain
Copy link
Author

@bolinfest That new API has landed in the master branch. You can check out the new API in README. It's right according to what you suggested.

@steelbrain
Copy link
Author

@bolinfest The original linter has been depreciated and will be removed soon, all packages are advised to switch to plus API.

@bolinfest
Copy link
Contributor

Fixed in 1fc2358.

Though please take note of https://github.com/AtomLinter/linter-plus/issues/87.

ghost pushed a commit that referenced this issue Sep 23, 2016
… it re-renders

Summary: Needed for request sender modal.  Currently re-renders with a new initialValue prop don't actually cause the initialValue of the component to change....

Reviewed By: jgebhardt

Differential Revision: D3890809

fbshipit-source-id: 7c04319eeb3cb8615d04716c6c1405ee10b55057
facebook-github-bot pushed a commit that referenced this issue Oct 29, 2016
Summary:
This implements:

stepOver,
stepInto,
stepOut,
resume,
setPauseOnExceptions,
evaluateOnCallFrame,
Runtime.getProperties

So essentially everything important.  I've left out async break for now since it's kind of a hassle to implement correctly, and gives comparatively little benefit.

Reviewed By: jgebhardt

Differential Revision: D4093899

fbshipit-source-id: 4485affcccfaa34a66d05c5e354f9ac69a01b970
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants