You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In setRuleset() in spectral.ts, a check is done to confirm the ruleset is of the Ruleset class before setting it this.ruleset = ruleset instanceof Ruleset ? ruleset : new Ruleset(ruleset);
Unfortunately if the package is being used by another package, as in a plugin, there can be a mismatch where the ruleset was initialised using a (identical) Ruleset class from the root level node_modules, and then checked against the local node_modules, resulting in instanceof returning false, and then a failed attempt at converting a Ruleset into a Ruleset.
Is there a way to change the type narrowing to allow for this?
To Reproduce
Example:
Install spectral
Install a dependency that uses its own local copy of spectral (in our case)
Run and get error that linting has failed as ruleset is not an object.
Expected behavior
setRuleset() sees that the ruleset is of the Ruleset class
Describe the bug
In setRuleset() in spectral.ts, a check is done to confirm the ruleset is of the Ruleset class before setting it
this.ruleset = ruleset instanceof Ruleset ? ruleset : new Ruleset(ruleset);
Unfortunately if the package is being used by another package, as in a plugin, there can be a mismatch where the ruleset was initialised using a (identical) Ruleset class from the root level node_modules, and then checked against the local node_modules, resulting in instanceof returning false, and then a failed attempt at converting a Ruleset into a Ruleset.
Is there a way to change the type narrowing to allow for this?
To Reproduce
Example:
Expected behavior
setRuleset() sees that the ruleset is of the Ruleset class
Environment (remove any that are not applicable):
Additional context
Some further context here
The text was updated successfully, but these errors were encountered: