Registry / testing / eslint-plugin-return-type

eslint-plugin-return-type

JSON →
library1.0.35jsnpmunverified

An ESLint plugin that enforces the access of specific return types in TypeScript code. Current stable version is 1.0.35. This plugin requires a tsconfig.json file and provides a single rule, enforce-access, which ensures that functions return specified types. It is a niche linter tool aimed at TypeScript projects that need strict return type enforcement, differentiating itself by its focus on return type access rather than general type checking.

npm install eslint-plugin-return-type
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-RETU
E
eslint-plugin-return-type
testingjavascriptv1.0.35
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plugin
import plugin from 'eslint-plugin-return-type'
const plugin = require('eslint-plugin-return-type')
Default import works for ESM and CJS via bundler.
rules
const { rules } = require('eslint-plugin-return-type')
CommonJS require for accessing rules object.
configs
import { configs } from 'eslint-plugin-return-type'
import configs from 'eslint-plugin-return-type'
configs is a named export, not default.

Configures ESLint with the return-type plugin and enforce-access rule to require functions return types matching 'SomeType' or any type ending in 'Error'.

// .eslintrc.js module.exports = { plugins: ['return-type'], rules: { 'return-type/enforce-access': ['error', { typeNames: ['SomeType', '\w*Error'] }] } };
Debug
Known issues
gotchatsconfig.json must be present at project root; plugin will fail without it.
fix
Ensure tsconfig.json exists in the project root directory.
affects: >=0.0.0
breakingPlugin only supports TypeScript; does not work on plain JavaScript files.
fix
Use only on .ts/.tsx files; configure ESLint overrides.
affects: >=0.0.0
deprecatedNo deprecations noted as of version 1.0.35.
fix
N/A
affects: none
Errors
Common errors & fixes
Could not find tsconfig.json. Please make sure tsconfig.json exists.
Missing tsconfig.json in the project root.
fix
Create a tsconfig.json file or run tsc --init.
Definition for rule 'return-type/enforce-access' was not found.
Plugin not installed or not listed in plugins array.
fix
Run npm install eslint-plugin-return-type --save-dev and add 'return-type' to plugins.
Type 'string | undefined' is not assignable to type 'string[]'.
typeNames option is missing or not an array.
fix
Specify typeNames as an array of strings in the rule options.
Upgrade
Version history
1.0.35latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-return-type — npm install eslint-plugin-return-type · libregistry