Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Question/Ask for documentation : No backbone get set outside model #708

Closed
VincentLanglet opened this issue Dec 29, 2018 · 12 comments
Closed
Labels
Domain: Documentation Rules or repository tasks related to how to document code. Good First Issue 🙌 Howdy, neighbor! Status: Accepting PRs

Comments

@VincentLanglet
Copy link

VincentLanglet commented Dec 29, 2018

Is it possible to document the rule no-backbone-get-set-outside-model ?

I don't know how to fix the errors I received from this rules.
For example, with the code

const response = await fetch(url);
const contentType = response.headers.get('content-type');

How to get rid of the get call ?

@JoshuaKGoldberg JoshuaKGoldberg added Status: Accepting PRs Good First Issue 🙌 Howdy, neighbor! Domain: Documentation Rules or repository tasks related to how to document code. labels Dec 29, 2018
@JoshuaKGoldberg
Copy link

👋 @VincentLanglet - agreed the rule's docs aren't enough! Accepting a PR to add to them.

In the meantime, this SO answer linked to #123 provides some more context. Is that what you were looking for?

@VincentLanglet
Copy link
Author

@JoshuaKGoldberg Thanks for your quick answer

I saw the answer on stackoverflow but I didn't understand enough to solve my case. That's why I was thinking that many examples and how to fix them could be great on the wiki.
For what I understood, I should have something like this.get('content-type') and response.headers.getContentType(), but I don't know how to get there.

Moreover, since the rule talk about backbone and models, I'm not sure I'm concern about this one since I don't use http://backbonejs.org/ and I was wondering why it's catching errors, it could be clearer if the rule catch only error for backbone models.

@JoshuaKGoldberg
Copy link

Oh, yes - if you don't use Backbone you should disable that rule.

@VincentLanglet
Copy link
Author

VincentLanglet commented Dec 29, 2018

What about removing this rule of the recommended ruleset and adding it in the paragraph

/**
 * Controversial/Configurable rules.
 */
'no-backbone-get-set-outside-model': false, // only enable this if you have backbone.js

It's seems weird to me to set a rule by default if it's designed for a specific library

@JoshuaKGoldberg
Copy link

Great idea! Filed #716 to track that as a breaking change in 7.0.

@VincentLanglet
Copy link
Author

@JoshuaKGoldberg no-backbone-get-set-outside-model is still active in the recommended ruleset.

I advised you here to create a all ruleset with the recommended and the latest one. This way, until the 7.0, you can turn off the rule in the latest config.

Are you still agree with this ?

@VincentLanglet
Copy link
Author

VincentLanglet commented Nov 30, 2019

@JoshuaKGoldberg Since #716 is closed but #672 is not ; what is the status of this issue ?

@Karthickbg
Copy link

Hi @JoshuaKGoldberg, I get this error for JavaScript's map.set() function.

var mapSet = new Map();
mapSet.set('base', {     
            id: 'base',
            label: 'label',
            type: 'type'
        }); // Error shown here: Backbone set() called outside of owning model: mapSet.set('base'...) (no-backbone-get-set-outside-model)

I have raised a question in StackOverflow. We are trying to get Microsoft visual certificate and it says that we can't override any rule. Is there any possible way to solve this issue?

@HamletDRC
Copy link
Member

@Karthickbg oof... this is a false positive in the rule... but PowerBI says you should not override rules.

I suggest you just add an ignore statement to the line

// tslint:disable-next-line:no-backbone-get-set-outside-model

@IllusionMH
Copy link
Contributor

Yep, that's false positive in rule, that can be removed from configuration only with major version bump.

We are trying to get Microsoft visual certificate and it says that we can't override any rule.

@HamletDRC do you know anything better to change requirements from almost deprecated TSLint to ESLint than raising issue for docs page?

I suggest you just add an ignore statement to the line

I hope that they don't check for disable comments 😄

@HamletDRC
Copy link
Member

PowerBI will audit your code... so the suppression is totally fine because they will see that Backbone is not being used.

I reached out to the PowerBI team via an issue raised on their docs page. I'll send an internal email as well.

@JoshuaKGoldberg
Copy link

☠️ It's time! ☠️

Per #876, this repository is no longer accepting feature pull requests. TSLint is being deprecated and we recommend you switch to https://typescript-eslint.io.

Thanks for open sourcing with us, everyone!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Domain: Documentation Rules or repository tasks related to how to document code. Good First Issue 🙌 Howdy, neighbor! Status: Accepting PRs
Projects
None yet
Development

No branches or pull requests

5 participants