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

Added no-dynamic-delete rule #3573

Merged
merged 4 commits into from
Jan 10, 2018
Merged

Added no-dynamic-delete rule #3573

merged 4 commits into from
Jan 10, 2018

Conversation

JoshuaKGoldberg
Copy link
Contributor

Equivalent to tslint-microsoft-contrib's no-delete-expression. Renamed because all deletes are technically of node kind DeleteExpression, though they may sometimes contain an expression as the argumentExpression.

Allowed string literals of invalid property accesses, numeric literals, and negative numeric literals because those can't be simplified.
Suggested fixes for converting valid string literals to direct lookups and simplified unnecessarily positive numbers (like +7 to 7).

Fixes #3553.

CHANGELOG.md entry:

[new-rule] no-dynamic-delete

Josh Goldberg added 3 commits December 22, 2017 14:07
Equivalent to tslint-microsoft-contrib's no-delete-expression. Renamed because all deletes are technically of node kind DeleteExpression, though they may sometimes contain an expression as the argumentExpression.

Allowed string literals of invalid property accesses, numeric literals, and negative numeric literals because those can't be simplified.
Suggested fixes for converting valid string literals to direct lookups and simplified unnecessarily positive numbers (like `+7` to `7`).
Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

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

generally lgtm, can you tweak the rule description?


export class Rule extends Lint.Rules.AbstractRule {
public static metadata: Lint.IRuleMetadata = {
description: "Enforces not deleting computed expressions.",
Copy link
Contributor

@adidahiya adidahiya Jan 9, 2018

Choose a reason for hiding this comment

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

"Bans usage of the delete operator with computed key expressions"

@adidahiya adidahiya added this to the TSLint v5.9 milestone Jan 9, 2018
@adidahiya adidahiya merged commit 82bf779 into palantir:master Jan 10, 2018
@JoshuaKGoldberg JoshuaKGoldberg deleted the no-dynamic-delete branch January 10, 2018 00:11
HyphnKnight pushed a commit to HyphnKnight/tslint that referenced this pull request Apr 9, 2018
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.

Port tslint-microsoft-contrib's no-delete-expression
2 participants