@smarlhens/opinionated-safe-code-normalizer
v1.1.1
Published
TypeScript opinionated safe code normalizer using ts-morph & ESLint
Maintainers
Readme
Opinionated safe code normalizer
TypeScript opinionated safe code normalizer using ts-morph & ESLint.
This tool helps you to add public keyword to your code methods, properties, getters & setters to be compliant with @typescript-eslint/explicit-member-accessibility rule.
Table of Contents
Prerequisites
- Node.JS version ^14.17.0 || >=16.0.0
Installation
Install globally:
npm install -g @smarlhens/opinionated-safe-code-normalizerUsage
Use inside a directory which contain an .eslintrc.js configuration file and **/*.ts files (can be in subdirectories of the working directory).
Using ts-morph & ESLint, your code will be updated adding public keyword to methods, properties, getters & setters.
$ oscnExample
class Foo {
private propA: string;
protected propB: string;
public propC?: string;
- propD?: string;
+ public propD?: string;
private _propE?: string;
- get propE(): string | undefined {
* public get propE(): string | undefined {
return this._propE;
}
- set propE(value: string | undefined) {
+ public set propE(value: string | undefined) {
this._propE = value;
}
constructor() {
this.propA = 'lorem';
this.propB = 'ispum';
}
- methodA(): void {}
+ public methodA(): void {}
}