Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Ban does not detect after 'new' Keyword. #4216

Closed
marvinside opened this issue Oct 10, 2018 · 4 comments
Closed

Ban does not detect after 'new' Keyword. #4216

marvinside opened this issue Oct 10, 2018 · 4 comments

Comments

@marvinside
Copy link

marvinside commented Oct 10, 2018

Bug Report

  • TSLint version: 5.11.0
  • TypeScript version: 3.2.0-dev.20181010
  • Running TSLint via: VSCode

TypeScript code being linted

const a:Error = new Error("ABC"); 	// fine
const b:Error = Error("ABC"); 		// TSLint shows Error as Expected

with tslint.json configuration:

"ban": [
	true,
	{"name": "Error", "message": "Use Meteor.Error instead."}
],

Actual behavior

Only the second Line is marked as an Error

Expected behavior

Both Lines (with and without new Keyword) should trigger an Error.

Background Information

We use meteor to develop. Meteor provides the Class Meteor.Error (which extends the Normal Error).
This allows to include more details into the Error, but usually just Error is used.
By banning the Normal Error, developers should use the Meteor.Error and provide better Error messages.

@stnwk
Copy link

stnwk commented Oct 16, 2018

I would also love to have a solution to this problem. Anyone got any ideas?

@JoshuaKGoldberg
Copy link
Contributor

Related: #2791

@JoshuaKGoldberg
Copy link
Contributor

💀 It's time! 💀

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

👋 It was a pleasure open sourcing with you!

@JoshuaKGoldberg
Copy link
Contributor

🤖 Beep boop! 👉 TSLint is deprecated 👈 (#4534) and you should switch to typescript-eslint! 🤖

🔒 This issue is being locked to prevent further unnecessary discussions. Thank you! 👋

@palantir palantir locked and limited conversation to collaborators Mar 20, 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