{"id":26084,"library":"polymer-linter","title":"Polymer Linter","description":"Polymer Linter (v3.0.1) is a library for finding suspicious patterns and errors in web projects using Polymer custom elements. It is built on the Polymer Analyzer and provides AST-based linting with high-level feature queries. The linter is typically run via Polymer CLI or integrated into editors like VS Code. It offers rule collections (e.g., polymer-2-hybrid) and individual rules. Release cadence is low, as the project is in maintenance mode. Key differentiators: Polymer-specific linting rules (e.g., attribute checks, behaviors spelling) and tight integration with Polymer toolchain.","status":"deprecated","version":"3.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/Polymer/tools","tags":["javascript","polymer","lint","linter","typescript"],"install":[{"cmd":"npm install polymer-linter","lang":"bash","label":"npm"},{"cmd":"yarn add polymer-linter","lang":"bash","label":"yarn"},{"cmd":"pnpm add polymer-linter","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides Document and AST for lint rules","package":"polymer-analyzer","optional":false}],"imports":[{"note":"ESM only; named export.","wrong":"const Linter = require('polymer-linter').Linter","symbol":"Linter","correct":"import { Linter } from 'polymer-linter'"},{"note":"Named export for warning types.","wrong":"const Warning = require('polymer-linter').Warning","symbol":"Warning","correct":"import { Warning } from 'polymer-linter'"},{"note":"Named export for rule registry.","wrong":"import registry from 'polymer-linter'","symbol":"registry","correct":"import { registry } from 'polymer-linter'"}],"quickstart":{"code":"import { Linter } from 'polymer-linter';\nimport { Analyzer } from 'polymer-analyzer';\n\nconst analyzer = new Analyzer({ urlLoader: { canLoad: () => false, load: () => '', request: () => '' } });\nconst linter = new Linter(analyzer);\n\n// See available rules\nconsole.log(linter.registry.rules);\n\n// Create a lint result\nconst doc = await analyzer.analyze('file.html');\nconst warnings = await linter.lint(doc, { rules: ['polymer-2-hybrid'] });\nfor (const warning of warnings) {\n  console.log(warning.message);\n}","lang":"typescript","description":"Shows how to programmatically use Polymer Linter: create an Analyzer, instantiate Linter, and lint a document with a rule collection."},"warnings":[{"fix":"Migrate to lit-analyzer or eslint-plugin-lit for Polymer 3 and LitElement projects.","message":"Polymer Linter is deprecated and no longer maintained. Polymer 3+ does not use this linter.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Instantiate polymer-analyzer and pass it to Linter.","message":"The API changed significantly from v2 to v3. Linter constructor now requires an Analyzer instance.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Pass rules as array in options object.","message":"Rule collections are now specified as strings in an array (e.g., ['polymer-2-hybrid']), not as separate arguments.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Provide a custom urlLoader or use polymer-cli to run it.","message":"The linter depends on polymer-analyzer which loads files via URL loader. No built-in file system loader.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"npm install polymer-analyzer","cause":"Missing dependency polymer-analyzer when using polymer-linter programmatically.","error":"Error: Cannot find module 'polymer-analyzer'"},{"fix":"Update code to: linter.lint(document, { rules: ['polymer-2-hybrid'] })","cause":"Using old v2 API where lint was called differently; v3 lint method expects (document, options).","error":"TypeError: linter.lint is not a function"},{"fix":"Check rule names in registry; use correct string like 'polymer-2-hybrid'.","cause":"Specified rule collection name is misspelled or not registered.","error":"Warning: No rules matched; nothing to lint."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}