Registry / devops / lintcn

lintcn

JSON →
library0.9.0jsnpmunverified

A CLI tool for browsing, installing, and managing custom TypeScript lint rules as local Go source files, inspired by shadcn for UI components. Current version 0.9.0; releases appear every 2–3 weeks. Unlike ESLint plugins or convention-based linters, lintcn copies rule source into your project so you fully own and can customize each rule. Powered by tsgolint (Go-based TypeScript linter with type-aware analysis). Minimizes false positives by running only explicitly added rules. Supports automatic fixes, warning severity, and snapshot testing.

npm install lintcn
INSTALL
IMPORT
SIG · LINTCN
L
lintcn
devopsjavascriptv0.9.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.

default
import lintcn from 'lintcn'
const lintcn = require('lintcn'); // CJS require fails: package is ESM-only
ESM-only since v0.1.0. TypeScript types are shipped. Do not use require().
CLI binary
npx lintcn add <url>
npx lintcn install <url> // 'install' is not a valid subcommand; use 'add'
The package is primarily a CLI tool. Subcommands: add, remove, lint, list, clean.
lintcn
import lintcn from 'lintcn'
import { lintcn } from 'lintcn' // Named export 'lintcn' does not exist; use default import
The package exports a single default object for programmatic use. The CLI is invoked via npx or the bin script.

Install lintcn, add a type-aware lint rule file from the tsgolint repository, run lint, and list installed rules.

const { execSync } = require('child_process'); // Install lintcn as devDependency execSync('npm install -D lintcn', { stdio: 'inherit' }); // Add a rule from tsgolint repository execSync('npx lintcn add https://github.com/oxc-project/tsgolint/blob/main/internal/rules/no_floating_promises/no_floating_promises.go', { stdio: 'inherit' }); // Lint the TypeScript project execSync('npx lintcn lint --tsconfig tsconfig.json', { stdio: 'inherit' }); // List installed rules execSync('npx lintcn list', { stdio: 'inherit' });
lintcn --version
Debug
Known issues
gotchalintcn lint exits with 0 when no .lintcn/ directory exists; prints a helpful message instead of failing. Do not rely on exit code for presence of rules.
fix
Check for .lintcn/ directory explicitly in CI scripts if you require rules to be installed.
affects: >=0.7.1
breakingRule folder structure changed from flat .lintcn/*.go to subfolders .lintcn/{rule_name}/*.go in v0.6.0. Existing rules must be moved to subfolders.
fix
For each rule file in .lintcn/, move it into a new subfolder named after the rule (snake_case). The Go package declaration inside the file should match the folder name.
affects: >=0.6.0 <0.7.0
gotchaBy default only warning rules with severity 'warn' do not fail CI; error severity rules exit with code 1 even if only one error is found.
fix
Use --all-warnings to see all warnings, and configure rule severity via // lintcn:severity warn in rule source.
affects: >=0.7.0
securityPath traversal vulnerability in --tsgolint-version flag allowed arbitrary file read via version string like '../../etc'. Fixed in v0.5.0 by validating version pattern.
fix
Update to v0.5.0 or later. If using older version, avoid using --tsgolint-version with untrusted input.
affects: >=0.2.0 <0.5.0
deprecatedRule import paths changed from 'internal/rule' to 'pkg/rule' in v0.4.0. Old rule files using internal/rule will fail to compile.
fix
Update rule Go files: replace 'github.com/typescript-eslint/tsgolint/internal/rule' with 'github.com/typescript-eslint/tsgolint/pkg/rule' (and similarly for internal/utils to pkg/utils).
affects: >=0.4.0
breakingIn v0.3.0, lintcn changed from running all 44 built-in tsgolint rules to running only custom rules in .lintcn/. Projects relying on built-in rules must explicitly add each rule needed.
fix
Use npx lintcn add to add each desired rule from the tsgolint repository. Alternatively, configure a separate tsgolint run for built-in rules.
affects: >=0.3.0
gotchaConcurrent lintcn lint runs can corrupt each other's Go build workspace if not using unique content-hash workspaces. Fixed in v0.5.0 via per-content-hash workspaces.
fix
Upgrade to v0.5.0 or later to avoid intermittent failures when running multiple lintcn processes simultaneously.
affects: <0.5.0
Errors
Common errors & fixes
Error: Cannot find module 'lintcn'
Attempting to import or require lintcn as a library without installing it.
fix
Run 'npm install -D lintcn' to add it as a devDependency.
Error: Unknown command: install
Using non-existent subcommand 'install' instead of 'add'.
fix
Use 'npx lintcn add <url>' to install a rule.
package declaration must match folder name
When writing a custom rule, the Go package name in the .go file must equal the folder name under .lintcn/.
fix
Rename the folder to match the package declaration, or edit the package declaration to match the folder name (e.g., package no_unhandled_error in folder .lintcn/no_unhandled_error/).
Rule import path 'internal/rule' not found
Using outdated import path for the tsgolint rule API (changed in v0.4.0).
fix
Replace 'github.com/typescript-eslint/tsgolint/internal/rule' with 'github.com/typescript-eslint/tsgolint/pkg/rule'.
lintcn lint: tsgolint version flag traversal detected
Providing an invalid --tsgolint-version value that doesn't match the expected pattern (e.g., starting with 'v' followed by digits and dots).
fix
Use a valid version like 'v0.9.2' for --tsgolint-version.
Upgrade
Version history
0.9.0latest on npm
Audit
Dependencies
nodeoptionalExecutes Go binary for linting; requires Go (or cached binary) at runtime
Agent activity
4 hits · last 30 days
node
4
Resources
lintcn — npm install lintcn · libregistry