{"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,"search_vec":"'1.2.0':15 'across':44 'android':48 'anim':8,27 'appear':62 'cadenc':61 'catch':56 'check':17 'ci/cd':53 'compat':21 'current':11 'design':49 'differenti':29 'earli':59 'error':24,36 'featur':43 'file':10 'granular':31 'identifi':41 'incompat':39,42 'info':38 'initi':70 'io':46 'irregular':63 'issu':20,58 'javascript':72 'json':9 'key':28 'level':35 'lint':2,4,74 'lotti':1,7,26,57,73 'minor':67 'perform':19,75 'pipelin':54 'platform':45 'problem':22 'provid':30 'releas':60,71 'report':32 'sever':34 'sinc':69 'stabl':12 'tool':5 'use':51 'version':13,68 'warn':37 'web':47","created_at":"2026-05-01T13:47:11.195686+00:00","updated_at":"2026-05-01T13:47:11.195686+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"lottie-lint","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/lottie-lint","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}