bet365 / override-linting-rule Goto Github PK
View Code? Open in Web Editor NEWTypeScript linting rule to force marking of method and property overrides.
License: Apache License 2.0
TypeScript linting rule to force marking of method and property overrides.
License: Apache License 2.0
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.
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)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.