{"id":24893,"library":"advpl-lint","title":"ADVPL Linter","description":"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.","status":"active","version":"7.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/robsonrosilva/Lint-ADVPL","tags":["javascript","typescript"],"install":[{"cmd":"npm install advpl-lint","lang":"bash","label":"npm"},{"cmd":"yarn add advpl-lint","lang":"bash","label":"yarn"},{"cmd":"pnpm add advpl-lint","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-first; avoid CommonJS require which may not work in Node ESM contexts.","wrong":"const Linter = require('advpl-lint').Linter","symbol":"Linter","correct":"import { Linter } from 'advpl-lint'"},{"note":"If you only need the type, use type import to avoid runtime side effects.","wrong":"","symbol":"Linter","correct":"import type { Linter } from 'advpl-lint'"},{"note":"No default export; the above import will fail. Use named import instead.","wrong":"const advplLint = require('advpl-lint')","symbol":"default import","correct":"import advplLint from 'advpl-lint'"}],"quickstart":{"code":"import { Linter } from 'advpl-lint';\nimport * as fs from 'fs';\n\nconst content = fs.readFileSync('file.prw', 'latin1');\nconst linter = new Linter([{\n  name: 'file.prw',\n  content: content,\n}]);\n\nlinter.runAnalisys().then(() => {\n  console.log(linter.sourceList[0].errors);\n});\n","lang":"typescript","description":"Creates a Linter instance, runs analysis on an ADVPL file, and logs any errors found."},"warnings":[{"fix":"Update to version 8.0.0+ where the method is renamed to 'runAnalysis' or manually call the correct method name.","message":"Method name typo: 'runAnalisys' is misspelled (should be 'runAnalysis').","severity":"breaking","affected_versions":">=1.0.0 <8.0.0"},{"fix":"Always read files with encoding 'latin1' (e.g., fs.readFileSync(path, 'latin1')).","message":"File encoding must be 'latin1' (ISO-8859-1) for ADVPL files; UTF-8 may cause incorrect parsing.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Provide exactly { name: string, content: string } for each file.","message":"The Linter constructor expects an array of objects with 'name' and 'content' properties; omitting either will cause runtime errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Access errors directly from the promise result or via a new API if introduced.","message":"The 'sourceList' property may be deprecated in future versions; use the return value of 'runAnalisys' instead.","severity":"deprecated","affected_versions":">=5.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install advpl-lint' and ensure tsconfig.json has 'moduleResolution': 'node'.","cause":"Package not installed or import path incorrect in TypeScript (missing resolution).","error":"Cannot find module 'advpl-lint'"},{"fix":"Ensure you are calling the exact method name 'runAnalisys' as provided in v7.x. Update package when renamed.","cause":"Spelling mismatch due to typo in method name 'runAnalisys' (should be 'runAnalysis' in future versions).","error":"TypeError: linter.runAnalisys is not a function"},{"fix":"Read file synchronously with proper encoding: fs.readFileSync(path, 'latin1').toString() or ensure string.","cause":"File content passed is not a string (e.g., undefined or Buffer).","error":"Error: Invalid file content: expected a string"},{"fix":"Access errors inside the .then() callback or await the promise.","cause":"Running 'runAnalisys' is async; accessing 'linter.sourceList[0].errors' before promise resolves.","error":"TypeError: Cannot read properties of undefined (reading 'errors')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}