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

"class-name" rule broken with typescript@next #926

Closed
andy-hanson opened this issue Jan 20, 2016 · 4 comments
Closed

"class-name" rule broken with typescript@next #926

andy-hanson opened this issue Jan 20, 2016 · 4 comments
Milestone

Comments

@andy-hanson
Copy link
Contributor

tslint.json:

{
    "rules": {
        "class-name": true
    }
}

package.json:

{
    "scripts": {
        "lint": "tslint foo.ts"
    },
    "devDependencies": {
        "tslint": "3.2.2",
        "typescript": "1.8.0-dev.20160119"
    }
}

foo.ts:

const x = 1

output:

TypeError: Cannot read property 'getText' of undefined
    at NameWalker.visitInterfaceDeclaration (/home/andy/git/TSLINT/node_modules/tslint/lib/rules/classNameRule.js:34:38)
    at NameWalker.SyntaxWalker.visitNode (/home/andy/git/TSLINT/node_modules/tslint/lib/language/walker/syntaxWalker.js:329:22)
    at /home/andy/git/TSLINT/node_modules/tslint/lib/language/walker/syntaxWalker.js:440:63
    at visitNode (/home/andy/git/TSLINT/node_modules/typescript/lib/typescript.js:7020:20)
    at Object.forEachChild (/home/andy/git/TSLINT/node_modules/typescript/lib/typescript.js:7194:21)
    at NameWalker.SyntaxWalker.walkChildren (/home/andy/git/TSLINT/node_modules/tslint/lib/language/walker/syntaxWalker.js:440:12)
    at NameWalker.SyntaxWalker.visitIfStatement (/home/andy/git/TSLINT/node_modules/tslint/lib/language/walker/syntaxWalker.js:105:14)
    at NameWalker.SyntaxWalker.visitNode (/home/andy/git/TSLINT/node_modules/tslint/lib/language/walker/syntaxWalker.js:317:22)
    at /home/andy/git/TSLINT/node_modules/tslint/lib/language/walker/syntaxWalker.js:440:63
    at visitEachNode (/home/andy/git/TSLINT/node_modules/typescript/lib/typescript.js:7032:30)

The rule works if you revert to either tslint@3.2.2-dev.1 or typescript@1.7.5.

@adidahiya adidahiya added this to the TSLint 3.3 milestone Jan 20, 2016
@adidahiya
Copy link
Contributor

tslint@latest is not intended to work with typescript@next, but it probably should work anyway.

this looks similar to the const enum issue in #832, which I thought would no longer occur with typescript >= 1.7.3. will need some investigation.

@adidahiya adidahiya removed the P1 label Jan 20, 2016
@jkillian
Copy link
Contributor

Just to clarify for you @andy-hanson (and this admittedly isn't obvious) the .dev releases aren't actually "older versions", they're versions designed to work with TypeScript nightlies and in fact sometimes contain features before the regular releases.

This bug seems strange though, we'll look into it more.

@jkillian
Copy link
Contributor

Thanks for the report on this @andy-hanson. At it turns out, the fix for the const enum issue is in TypeScript 1.8.x but not in 1.7.x and TSLint v3.2.2 was compiled with TypeScript 1.7.5. We should be able to take care of this in the next TSLint release

@jkillian
Copy link
Contributor

Now fixed in TSLint v3.3.0

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