@smarlhens/opinionated-safe-code-normalizer

1.1.1 • Public • Published

Opinionated safe code normalizer

TypeScript opinionated safe code normalizer using ts-morph & ESLint.

GitHub CI node-current (scoped) GitHub license Commitizen friendly code style: prettier Conventional Commits

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-normalizer

Usage

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.

$ oscn

Example

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 {}
}

Package Sidebar

Install

npm i @smarlhens/opinionated-safe-code-normalizer

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

109 kB

Total Files

22

Last publish

Collaborators

  • smarlhens