1.0.0 • Published 4 years ago

learning-tslint v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Learning TSLint

Just one of the things I'm learning. https://github.com/hchiam/learning

Followed this tutorial: https://blog.bitsrc.io/extending-tslint-to-add-custom-rules-b30ca96158ee?gi=31845781f87c

Another example for reference: https://github.com/JKillian/tslint-custom-rule-example/blob/master/src/noNumberPremadeRule.ts

From scratch

npm init -y
npm install typescript tslint tsutils jest ts-jest @types/jest @types/node

And then:

touch index.js # and add in code to refer to files inside /rulesDirectory
mkdir rulesDirectory
cd rulesDirectory
touch classNamePascalCaseRule.ts
tsc classNamePascalCaseRule.ts

And finally:

npm publish

Starting by testing out this repo

Triple-click the following to select all:

git clone https://github.com/hchiam/learning-tslint.git; cd learning-tslint; npm install; # and then ...

Notes

  • Rule identifier ruleName: kebab-case, and correspond to rule file name (minus "Rule" at the end).
  • Rule file name: camelCase, end name with "Rule".
  • Exported class: just named Rule.
  • Exported class: extends Lint.Rules.AbstractRule.