Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Fix eslint warnings #141

Merged
merged 1 commit into from
Feb 5, 2019
Merged

Fix eslint warnings #141

merged 1 commit into from
Feb 5, 2019

Conversation

kylef
Copy link
Member

@kylef kylef commented Feb 5, 2019

There are some eslint exceptions that can be fixed easily.

@@ -268,7 +267,7 @@ const refractedApi = {

describe('Nodes.js require', () => {
it('should work without needing to use `.default`', () => {
assert(require('../lib/fury').parse);
assert(fury.parse);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change sounds like it makes the test not do what it is described to do.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's testing whether .parse works without .default. The fury is const fury = require('../lib/fury');, so it's equivalent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@honzajavorek Ah, thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, although IMO I dislike the global version of Fury that is returned here. Personally I would like to consider dropping this functionality so that require('fury') returns the Fury class which the consumer must instansiate their own version and add the adapters. I don't like singleton state that is currently permitted.

Along with #32 we would be renaming the libraries and Fury would become API Elements Core. In that case, I think it would make sense to make "Fury" itself a Namespace and thus perhaps in the future we would have something like:

const { Namespace } = require('@apielements/core');
const APIBlueprintParser = require('@apielements/apib-parser');

const namespace = new Namespace();
namespace.use(APIBlueprintParser);

const parseResult = await namespace.parse({ source });

As the biggest consumers of Fury (Dredd/Docs) I would love to hear some feedback regarding these potential changes. I was thinking that Namespace here is actually a subclass of minim namespace (if Minim continues to exist standalone). It is a namespace with additional methods detect, validate, parse and compose/serialise.


I have also been pondering the idea of a complete API Elements JS package which incorporates all the adapters for all formats so you don't have to worry about individual support.

const { Namespace } = require('apielements');

const namespace = new Namespace();

const parseResult = await namespace.parse({ source });

In your cases it may make sense to depend on apielements whereas the separate core, and adapter packages are provided for consumers who wish to mix and match adapters. Although you both are not using the serialisers and this may add additional dependency bloat so it may not be desired.

Copy link
Contributor

@opichals opichals left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool then! :)

@kylef kylef mentioned this pull request Feb 5, 2019
@pksunkara pksunkara merged commit 939786d into master Feb 5, 2019
@pksunkara pksunkara deleted the kylef/fury-eslint branch February 5, 2019 15:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants