Giter Club home page Giter Club logo

override-linting-rule's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

override-linting-rule's Issues

How to install and use in an existing Typescript project

Hello, thanks for developing this plugin. Unfortunately I can't understand from the readme how to use it.

I have an existing Typescript project which is already using tslint and I want to add this check.

I tried npm install --save-dev https://github.com/bet365/override-linting-rule on that project, which installed it and added it to the package.json of my project.

But when I run tslint, it doesn't automatically use the rule. How do I get tslint to know about and use the installed override-linting-rule that is under my node_modules folder of my project.

I'd rather not install it globally, I have Typescript and tslint as dev dependencies of this specific project, and would like to be able to use your rule just in the context of that project folder.

I also tried adding node_modules/override-linting-rule and/or node_modules/override-linting-rule/src to the rulesDirectory mentioned in my tslint.json file, but then just got errors that there were no rules in that directory.

TypeError: Cannot read property 'getText' of undefined

When linting a TypeScript file, the rules fails with
TypeError: Cannot read property 'getText' of undefined

I could fix the problem for my source file by making the following changes to
overrideTestRule.ts#178

OLD:
if (mb.kind !== ts.SyntaxKind.Constructor &&
NEW:
if (mb.kind !== ts.SyntaxKind.SemicolonClassElement && mb.kind !== ts.SyntaxKind.Constructor &&

Full stacktrace:
The 'overrideTest' rule threw an error in 'file.ts':
TypeError: Cannot read property 'getText' of undefined
at OverrideWalker.getHeritageMembers (C:\dev\Java\Sources\Origo-Magicwerk\Getu\GetuApp\rules\overrideTestRule.js:197:56)
at OverrideWalker.visitNode (C:\dev\Java\Sources\Origo-Magicwerk\Getu\GetuApp\rules\overrideTestRule.js:129:69)
at visitNodes (C:\dev\Java\Sources\Origo-Magicwerk\Getu\GetuApp\node_modules\typescript\lib\typescript.js:16224:30)
at Object.forEachChild (C:\dev\Java\Sources\Origo-Magicwerk\Getu\GetuApp\node_modules\typescript\lib\typescript.js:16524:21)
at OverrideWalker.visitNode (C:\dev\Java\Sources\Origo-Magicwerk\Getu\GetuApp\rules\overrideTestRule.js:125:16)
at visitNodes (C:\dev\Java\Sources\Origo-Magicwerk\Getu\GetuApp\node_modules\typescript\lib\typescript.js:16224:30)
at Object.forEachChild (C:\dev\Java\Sources\Origo-Magicwerk\Getu\GetuApp\node_modules\typescript\lib\typescript.js:16452:24)
at OverrideWalker.walk (C:\dev\Java\Sources\Origo-Magicwerk\Getu\GetuApp\rules\overrideTestRule.js:115:12)
at Rule.AbstractRule.applyWithWalker (C:\dev\Java\Sources\Origo-Magicwerk\Getu\GetuApp\node_modules\tslint\lib\language\rule\abstractRule.js:31:16)
at Rule.applyWithProgram (C:\dev\Java\Sources\Origo-Magicwerk\Getu\GetuApp\rules\overrideTestRule.js:62:21)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.