Registry / testing / advpl-lint

advpl-lint

JSON →
library7.0.3jsnpmunverified

A linting tool for ADVPL (Advanced Protheus Language) source code, providing static analysis and error detection for .prw files. Current stable version is 7.0.3, released with TypeScript support. It integrates directly into Node.js workflows, offering programmatic control through a Linter class. Key differentiators include its focus on the niche ADVPL ecosystem and file-level analysis rather than real-time IDE feedback. Alternative tools are scarce, making this the primary linter for ADVPL developers using Protheus/Totvs environments.

npm install advpl-lint
INSTALL
IMPORT
SIG · ADVPL-LINT
A
advpl-lint
testingjavascriptv7.0.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.

Linter
import { Linter } from 'advpl-lint'
const Linter = require('advpl-lint').Linter
Package is ESM-first; avoid CommonJS require which may not work in Node ESM contexts.
Linter
import type { Linter } from 'advpl-lint'
If you only need the type, use type import to avoid runtime side effects.
default import
import advplLint from 'advpl-lint'
const advplLint = require('advpl-lint')
No default export; the above import will fail. Use named import instead.

Creates a Linter instance, runs analysis on an ADVPL file, and logs any errors found.

import { Linter } from 'advpl-lint'; import * as fs from 'fs'; const content = fs.readFileSync('file.prw', 'latin1'); const linter = new Linter([{ name: 'file.prw', content: content, }]); linter.runAnalisys().then(() => { console.log(linter.sourceList[0].errors); });
advpl-lint --version
Debug
Known issues
breakingMethod name typo: 'runAnalisys' is misspelled (should be 'runAnalysis').
fix
Update to version 8.0.0+ where the method is renamed to 'runAnalysis' or manually call the correct method name.
affects: >=1.0.0 <8.0.0
gotchaFile encoding must be 'latin1' (ISO-8859-1) for ADVPL files; UTF-8 may cause incorrect parsing.
fix
Always read files with encoding 'latin1' (e.g., fs.readFileSync(path, 'latin1')).
affects: >=1.0.0
gotchaThe Linter constructor expects an array of objects with 'name' and 'content' properties; omitting either will cause runtime errors.
fix
Provide exactly { name: string, content: string } for each file.
affects: >=1.0.0
deprecatedThe 'sourceList' property may be deprecated in future versions; use the return value of 'runAnalisys' instead.
fix
Access errors directly from the promise result or via a new API if introduced.
affects: >=5.0.0
Errors
Common errors & fixes
Cannot find module 'advpl-lint'
Package not installed or import path incorrect in TypeScript (missing resolution).
fix
Run 'npm install advpl-lint' and ensure tsconfig.json has 'moduleResolution': 'node'.
TypeError: linter.runAnalisys is not a function
Spelling mismatch due to typo in method name 'runAnalisys' (should be 'runAnalysis' in future versions).
fix
Ensure you are calling the exact method name 'runAnalisys' as provided in v7.x. Update package when renamed.
Error: Invalid file content: expected a string
File content passed is not a string (e.g., undefined or Buffer).
fix
Read file synchronously with proper encoding: fs.readFileSync(path, 'latin1').toString() or ensure string.
TypeError: Cannot read properties of undefined (reading 'errors')
Running 'runAnalisys' is async; accessing 'linter.sourceList[0].errors' before promise resolves.
fix
Access errors inside the .then() callback or await the promise.
Upgrade
Version history
7.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
46 hits · last 30 days
node
38
OpenAI (training)
1
Resources
advpl-lint — npm install advpl-lint · libregistry