Registry / testing / eslint-plugin-strict-null-checks

eslint-plugin-strict-null-checks

JSON →
library0.1.3jsnpmunverified

ESLint plugin that reproduces TypeScript's strictNullChecks behavior as lint rules, enabling incremental migration from strictNullChecks: false to true. Version 0.1.3 (stable, low activity) depends on typescript >=3.9.4. Unlike native tsconfig strictNullChecks, allows warnings instead of errors and can be gradually applied per file via ESLint config. Requires @typescript-eslint/parser with project option pointing to a separate tsconfig with strictNullChecks: true.

npm install eslint-plugin-strict-null-checks
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-STRI
E
eslint-plugin-strict-null-checks
testingjavascriptv0.1.3
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
plugins: ['strict-null-checks']
plugins: ['eslint-plugin-strict-null-checks']
In ESLint config, plugin names omit the eslint-plugin- prefix.
rule
rules: { 'strict-null-checks/all': 'warn' }
rules: { 'strict-null-checks': 'warn' }
The rule is namespaced with 'all' as the rule name.
parserOptions
parserOptions: { project: './tsconfig.strictNullChecks.json' }
parserOptions: { project: './tsconfig.json' }
Requires a separate tsconfig with strictNullChecks: true to avoid affecting the rest of the project.

Configure ESLint to gradually enforce strict null checks using a separate tsconfig.

// .eslintrc.js module.exports = { parser: '@typescript-eslint/parser', parserOptions: { project: './tsconfig.strictNullChecks.json', }, plugins: ['strict-null-checks'], rules: { 'strict-null-checks/all': 'warn', }, ignorePatterns: ['.eslintrc.js'], }; // tsconfig.strictNullChecks.json { "compilerOptions": { "strictNullChecks": true }, "include": ["src/**/*.ts", "src/**/*.tsx"] } // Then run: npx eslint src/
Debug
Known issues
breakingRequires a separate tsconfig file with strictNullChecks: true, which may conflict with existing project configuration.
fix
Create tsconfig.strictNullChecks.json and set parserOptions.project to that file.
affects: >=0.0.0
gotchaParsing error: "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config: .eslintrc.js. The file must be included in at least one of the projects provided.
fix
Add ignorePatterns: ['.eslintrc.js'] to your ESLint config, or include .eslintrc.js in tsconfig.strictNullChecks.json with allowJs: true.
affects: >=0.0.0
gotchaThe plugin only works with @typescript-eslint/parser, not the default Espree parser.
fix
Install @typescript-eslint/parser and set parser in ESLint config.
affects: >=0.0.0
breakingThe 'all' rule may produce false positives for code that intentionally uses null/undefined in ways TypeScript allows when strictNullChecks is off.
fix
Use warning level and manually review each violation before committing to fix.
affects: >=0.0.0
Errors
Common errors & fixes
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config: .eslintrc.js.
ESLint config file is not covered by tsconfig.strictNullChecks.json.
fix
Add ignorePatterns: ['.eslintrc.js'] to ESLint config, or include the file in tsconfig.
Cannot find module 'eslint-plugin-strict-null-checks'
Plugin not installed.
fix
Run npm install eslint-plugin-strict-null-checks --save-dev
Configuration for rule 'strict-null-checks/all' is invalid: Unknown rule strict-null-checks/all
The plugin is not loaded in plugins section.
fix
Add 'strict-null-checks' to plugins array in ESLint config.
TypeError: Cannot read properties of undefined (reading 'getTypeArguments')
Incompatible @typescript-eslint/parser version or missing project.
fix
Ensure @typescript-eslint/parser is installed and parserOptions.project points to valid tsconfig.
Upgrade
Version history
0.1.3latest on npm
Audit
Dependencies
typescriptrequiredPeer dependency for TypeScript type checking
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-strict-null-checks — npm install eslint-plugin-strict-null-checks · libregistry