Canonical is a comprehensive code style linter and formatter for JavaScript, SCSS/CSS and JSON, built on ESLint and custom plugins. Version 3.2.1 (latest) is stable with moderate release cadence. It enforces over 500 rules from eslint-config-canonical, including custom JSDoc and FlowType rules, aiming for consistent style, reduced VCS noise, and adoption of latest ES features. Compared to alternatives like Standard or Airbnb, Canonical is more opinionated and extensive, but may require more setup.
npm install canonicalNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates CLI usage and programmatic linting and fixing with Canonical, showing both default and named imports.
Ensure your project uses ESM (type: module in package.json) or use dynamic import('canonical').Prefer npx canonical lint ... to avoid global install conflicts.
Use only Canonical's config or carefully override rules after loading eslint-config-canonical.
Install canonical with npm install canonical and use import canonical from 'canonical' (ESM) or dynamic import().
Configure ESLint to extend 'canonical' in your .eslintrc.js: module.exports = { extends: ['canonical'] };Use canonical.lint({ files: [...] }) or import { lint } from 'canonical'.