Registry / testing / eslint-plugin-redundant-undefined

eslint-plugin-redundant-undefined

JSON →
library1.0.0jsnpmunverified

An ESLint plugin (v1.0.0, single release so far) that forbids redundant `undefined` in TypeScript optional parameters and properties. It helps enforce cleaner optional types by flagging patterns like `s?: string | undefined` and offering a `followExactOptionalPropertyTypes` option for use with TypeScript's `exactOptionalPropertyTypes` setting. Requires `@typescript-eslint/parser` and ESLint >=8.46.0. Available on npm with MIT license.

npm install eslint-plugin-redundant-undefined
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-REDU
E
eslint-plugin-redundant-undefined
testingjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

redundant-undefined
// In .eslintrc: { "plugins": ["redundant-undefined"], "rules": { "redundant-undefined/redundant-undefined": "error" } }
require('eslint-plugin-redundant-undefined') or import syntax in config is not supported
Plugin is added via plugins array in ESLint config; rules are prefixed with 'redundant-undefined/'
default rule
rules: { "redundant-undefined/redundant-undefined": "error" }
Setting 'redundant-undefined' as a top-level rule like 'redundant-undefined': 'error' (missing slash) or using wrong rule name
Rule name is 'redundant-undefined/redundant-undefined' – the plugin name and rule name are identical but separated by a slash

Minimal ESLint config to enable the plugin and rule, plus an example of incorrect code.

// .eslintrc.json { "parser": "@typescript-eslint/parser", "plugins": ["redundant-undefined"], "rules": { "redundant-undefined/redundant-undefined": "error" } } // Install // npm i eslint-plugin-redundant-undefined @typescript-eslint/parser eslint --save-dev // Example code that will be flagged: // function f(s?: string | undefined): void {}
Debug
Known issues
gotchaRule only works with `@typescript-eslint/parser`; using default ESLint parser will cause parsing errors.
fix
Set parser to '@typescript-eslint/parser' in ESLint config.
affects: >=1.0.0
gotchaThe rule name is 'redundant-undefined/redundant-undefined' – users often try 'redundant-undefined' alone or forget the slash.
fix
Use the full prefixed name: 'redundant-undefined/redundant-undefined'.
affects: >=1.0.0
gotchaPlugin requires ESLint >=8.46.0 and Node.js ^16.0.0 or >=18.0.0; older versions will fail to load.
fix
Update ESLint and Node.js to supported versions.
affects: >=1.0.0
gotchaOption `followExactOptionalPropertyTypes` changes the rule behavior; enabling it without having `exactOptionalPropertyTypes: true` in tsconfig may cause unexpected lint errors.
fix
Ensure TypeScript's `exactOptionalPropertyTypes` is enabled if using this option.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Failed to load plugin 'redundant-undefined': Cannot find module 'eslint-plugin-redundant-undefined'
Plugin not installed or missing from node_modules.
fix
Run `npm install eslint-plugin-redundant-undefined @typescript-eslint/parser --save-dev`
Parsing error: 'parserOptions.project' has been set for @typescript-eslint/parser. The file does not match your project config: .eslintrc.json
ESLint is trying to parse the config file itself with TypeScript parser.
fix
Add `'ignorePatterns': ['.eslintrc.json']` to your ESLint config or use a .eslintrc.js file.
Error: Rule 'redundant-undefined' (or 'redundant-undefined/redundant-undefined') is not defined
Plugin not listed in 'plugins' array or rule name misspelled.
fix
Add 'redundant-undefined' to plugins and use 'redundant-undefined/redundant-undefined' as rule name.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
@typescript-eslint/parserrequiredPeer dependency required to parse TypeScript syntax
eslintrequiredPeer dependency; plugin is an ESLint rule
Agent activity
2 hits · last 30 days
node
2
Resources