0.0.15 • Published 1 month ago

@sjoleee/eslint-plugin-function-return-type v0.0.15

Weekly downloads
-
License
ISC
Repository
github
Last release
1 month ago

eslint-plugin-function-return-type

The "function-return-type" plugin requires the return type to be stated when writing functions.

However, in the case of components (when the first letter of the function name is capitalized), it does not raise an error even if the return type is not specified.

This plugin does not guarantee accurate operation. It's being developed as a plugin for use within the author's organization, so it may behave in unexpected ways.

Rule Details

Examples of incorrect code for this rule:

const test = () => {
  return "test";
};

function test() {
  return "test";
}

const test = function () {
  return "test";
};

Examples of correct code for this rule:

const test = (): string => {
  return "test";
};

function test(): string {
  return "test";
}

const test = function (): string {
  return "test";
};

// Component(start with capital)
const Test = () => {
  return <></>;
};

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install @sjoleee/eslint-plugin-function-return-type:

npm install @sjoleee/eslint-plugin-function-return-type --save-dev

Usage

Add function-return-type to the plugins section of your .eslintrc configuration file.

{
  "plugins": ["@sjoleee/function-return-type"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "@sjoleee/function-return-type/function-return-type": "warn"
  }
}
0.0.11

1 month ago

0.0.12

1 month ago

0.0.13

1 month ago

0.0.14

1 month ago

0.0.15

1 month ago

0.0.10

3 months ago

0.0.7

3 months ago

0.0.6

3 months ago

0.0.5

3 months ago

0.0.4

3 months ago

0.0.3

3 months ago

0.0.2

3 months ago

0.0.1

3 months ago

0.0.0

3 months ago