Registry / devops / java-lint

java-lint

JSON →
library0.3.0jsnpmunverified

A Java lint utility library focused on removing unused imports. Current version 0.3.0 ships TypeScript types and requires Node.js ^18.13.0 || >=20.2.0. It uses java-parser for AST parsing. The package has been superseded by eslint-plugin-java-lang starting at v0.4.0, which converts the project into an ESLint plugin format. Key differentiators: lightweight, focused only on unused import removal, but with caveats about false negatives due to lazy global identifier collection.

npm install java-lint
INSTALL
IMPORT
SIG · JAVA-LINT
J
java-lint
devopsjavascriptv0.3.0
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.

removeUnusedImports
import { removeUnusedImports } from 'java-lint'
const removeUnusedImports = require('java-lint').removeUnusedImports;
ESM-only since v0.1.0; no CommonJS wrapper provided.

Demonstrates removing an unused import from a Java source string using removeUnusedImports.

import { removeUnusedImports } from 'java-lint'; const source = `package my.project; import my.project.pack.Unused; class Foo {}`; const cleaned = removeUnusedImports(source); console.log(cleaned); // Output: "package my.project;\n\nclass Foo {}"
Debug
Known issues
deprecatedThis package is superseded by eslint-plugin-java-lang as of v0.4.0.
fix
Migrate to eslint-plugin-java-lang.
affects: <=0.3.0
gotchaFalse negatives possible: global identifiers collection is lazy.
fix
Review results manually or consider using eslint-plugin-java-lang.
affects: >=0.0.1 <=0.3.0
gotchaRequires Node.js ^18.13.0 || >=20.2.0
fix
Ensure Node.js version compatibility.
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: removeUnusedImports is not a function
Using CommonJS require which returns an object with default export?
fix
Use ESM import: import { removeUnusedImports } from 'java-lint'
Upgrade
Version history
0.3.0latest on npm
Audit
Dependencies
java-parserrequiredUsed for parsing Java source code into an AST for lint analysis
Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources
java-lint — npm install java-lint · libregistry