Comments (7)
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.
from nuclide.
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.
from nuclide.
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:
This is because linter
requires you to get a superclass from the Atom package itself:
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.
from nuclide.
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.
from nuclide.
@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.
from nuclide.
@bolinfest The original linter has been depreciated and will be removed soon, all packages are advised to switch to plus API.
from nuclide.
Fixed in 1fc2358.
Though please take note of https://github.com/AtomLinter/linter-plus/issues/87.
from nuclide.
Related Issues (20)
- Fail to load nuclide package. Cannot find module 'fb-appsession-observer' HOT 5
- apm install [email protected] not working
- nuclide-js-imports-server/nuclide-js-imports-client doesn't work HOT 1
- Nuclide 0.360.0 update doesn't work HOT 5
- I have try to install nuclide package. after that i got this issue HOT 1
- Is Nuclide-definition-preview supposed to be working with remote Nuclide server?
- where do I disable this git coloring ?
- Output from Eslint missing HOT 7
- [Ubuntu] Flow was not found when attempting to start it in
- CMake C project and compile_commands.json
- Uncaught TypeError: Cannot read property 'children' of undefined
- nuclide-buck unable to find @accent-text-color HOT 6
- Failed to load the nuclide-buck package HOT 2
- Spotty Remote Connection
- Uncaught TypeError: Cannot read property 'bind' of undefined
- Uncaught Error: Connection Closed
- `atom .` doesn't work w/ v366 terminal
- No Typechecking in Fresh Install of Nuclide + Hack HOT 2
- [email protected] – Cannot find module se.node' HOT 2
- Uncaught RpcTimeoutError: Timeout after 60000 for id: 3, Calling function FileSystemService/findN...
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuclide.