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

react-no-dangerous-html threw an error #880

Closed
cyberhck opened this issue Jul 3, 2019 · 2 comments
Closed

react-no-dangerous-html threw an error #880

cyberhck opened this issue Jul 3, 2019 · 2 comments

Comments

@cyberhck
Copy link
Contributor

cyberhck commented Jul 3, 2019

Not sure if this is a bug, design decision or something changed in tslint parsing of options.

I had part of tslint.json like this:

    "react-no-dangerous-html": [
      true,
      {
        "file": "./src/app/containers/Html.tsx",
        "method": "render",
        "comment": "string comes from trusted source - our initial state"
      }
    ]

I got error which said: "ctx.options.exceptions.forEach is not a function" I did some debugging by adding console.logs into node_modules/tslint-microsoft-contrib/... and figured something has changed, I just updated tslint-microsoft-contrib so it's safe to say I'm definitely on latest version as of now.

I did find a workaround:

    "react-no-dangerous-html": [
      true,
      [
        {
          "file": "./src/app/containers/Html.tsx",
          "method": "render",
          "comment": "string comes from trusted source - our initial state"
        }
      ]
    ]

which is basically wrapping in an array of which now makes sense but I couldn't find any documentation on this. Wiki page still shows the old style (the one I posted earlier)

I just want to know if this is a bug in this repo or signature has changed so I'd know how to move forward.

Thanks.

@IllusionMH IllusionMH added the Status: Needs Investigation We're not sure whether this a good thing to do. label Jul 3, 2019
@IllusionMH
Copy link
Contributor

@cyberhck rule was migrated to new rule format, but I don't think that change was intentional. Will need to look closer what actually changed in options parsing logic, since checks for instanceof Array are still in place.

Thanks for reporting.

@JoshuaKGoldberg
Copy link

💀 It's time! 💀

TSLint is deprecated and no longer accepting pull requests other than security fixes. See #876. ☠️
We recommend you instead use typescript-eslint to lint your TypeScript code with ESLint. ✅

👋 It was a pleasure open sourcing with you!

@JoshuaKGoldberg JoshuaKGoldberg added 💀 R.I.P. 💀 and removed Status: Needs Investigation We're not sure whether this a good thing to do. labels Jan 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants