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

field like "__xxx__" is not fixed correctly. #2965

Closed
jjeffcaii opened this issue Jun 28, 2017 · 2 comments · Fixed by #3184
Closed

field like "__xxx__" is not fixed correctly. #2965

jjeffcaii opened this issue Jun 28, 2017 · 2 comments · Fixed by #3184

Comments

@jjeffcaii
Copy link

Bug Report

  • TSLint version: 5.4.3
  • TypeScript version: 2.3.4
  • Running TSLint via: CLI

TypeScript code being linted

// code snippet
const obj = {};
obj["__id__"] = "foobar";
// then execute: tslint -c tslint.json 'src/**/*.ts' --fix

with tslint.json configuration:

{
  "extends": "tslint:recommended",
  "rules": {
    "interface-name": false,
    "new-parens": true,
    "no-arg": true,
    "no-bitwise": true,
    "no-conditional-assignment": true,
    "no-shadowed-variable": false,
    "no-console": true,
    "object-literal-sort-keys": false,
    "max-line-length": [
      true
    ]
  },
  "jsRules": {
    "max-line-length": [
      true
    ]
  }
}

Actual behavior

const obj = {};
obj.___id__ = "foobar";  //  three '_' 囧rz

Expected behavior

const obj = {};
obj.__id__ = "foobar";
@ajafff
Copy link
Contributor

ajafff commented Jun 28, 2017

There seems to be a bug in typescript's AST. I opened microsoft/TypeScript#16788 to track this.

@ajafff
Copy link
Contributor

ajafff commented Aug 30, 2017

Even though that bug is fixed with typescript@2.5.0, I added a fix for older version of typescript: #3184

ajafff added a commit that referenced this issue Aug 31, 2017
…res (#3184)

The AST contains the escaped name. That bug is fixed in typescript@2.5.0. This adds a fix for older versions.
Fixes: #2965
HyphnKnight pushed a commit to HyphnKnight/tslint that referenced this issue Apr 9, 2018
…res (palantir#3184)

The AST contains the escaped name. That bug is fixed in typescript@2.5.0. This adds a fix for older versions.
Fixes: palantir#2965
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 a pull request may close this issue.

2 participants