{"id":25904,"library":"lottie-lint","title":"Lottie Lint","description":"A linting tool for Lottie animation JSON files. Current stable version is 1.2.0. It checks for performance issues, compatibility problems, and errors in Lottie animations. Key differentiators: provides granular reports with severity levels (error, warn, info, incompatible) and identifies incompatible features across platforms (iOS, Web, Android). Designed for use in CI/CD pipelines to catch Lottie issues early. Release cadence appears irregular, with a few minor versions since initial release.","status":"active","version":"1.2.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","lottie","lint","performance"],"install":[{"cmd":"npm install lottie-lint","lang":"bash","label":"npm"},{"cmd":"yarn add lottie-lint","lang":"bash","label":"yarn"},{"cmd":"pnpm add lottie-lint","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package exports a default function, not a named export.","wrong":"import { linter } from 'lottie-lint';","symbol":"default","correct":"import linter from 'lottie-lint';"},{"note":"In Node.js with CommonJS, access the default export via .default property.","wrong":"const linter = require('lottie-lint');","symbol":"default (require)","correct":"const linter = require('lottie-lint').default;"},{"note":"Destructure both json and reports from the returned object. json is the parsed JSON, reports is the array of lint issues.","wrong":"const result = linter(lottieJson); const reports = result.reports;","symbol":"linter return value","correct":"const { json, reports } = linter(lottieJson);"}],"quickstart":{"code":"import linter from 'lottie-lint';\nimport fs from 'fs';\n\n// Read a Lottie JSON file\nconst lottieJson = JSON.parse(fs.readFileSync('animation.json', 'utf-8'));\n\n// Run the linter\nconst { json, reports } = linter(lottieJson);\n\n// Print each report\nreports.forEach(report => {\n  console.log(`[${report.type}] ${report.rule}: ${report.message}`);\n  if (report.incompatible.length > 0) {\n    console.log(`  Incompatible on: ${report.incompatible.join(', ')}`);\n  }\n});\n\n// Check if there are any errors\nconst errors = reports.filter(r => r.type === 'error');\nif (errors.length > 0) {\n  process.exit(1);\n}","lang":"typescript","description":"Demonstrates how to import the linter, run it on a Lottie JSON object, and process the resulting reports."},"warnings":[{"fix":"Clone the JSON before passing to linter if preservation is needed: linter(JSON.parse(JSON.stringify(animation)))","message":"The linter function mutates the input JSON object (adds internal properties).","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Parse JSON string with JSON.parse() before calling linter.","message":"The default export is a function that expects a JSON object, not a string. Passing a string will cause an error.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use JSON.stringify() to get a JSON string if needed.","message":"The 'json' property in the return value is the input object (possibly mutated). It is not a JSON string.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"N/A","message":"No deprecated warnings known for this package.","severity":"deprecated","affected_versions":"N/A"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use: const linter = require('lottie-lint').default;","cause":"Using default import incorrectly with CommonJS (require) without .default.","error":"TypeError: linter is not a function"},{"fix":"Parse the string first: linter(JSON.parse(jsonString))","cause":"Passing a JSON string instead of a parsed object to the linter.","error":"Cannot read property 'length' of undefined"},{"fix":"Ensure variable names match: const { reports } = linter(data);","cause":"Destructuring incorrectly; linter returns an object, not an array.","error":"undefined is not an object (evaluating 'reports.forEach')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}