{"id":19703,"library":"eslint-plugin-canonical","title":"eslint-plugin-canonical","description":"ESLint plugin enforcing Canonical style rules and TypeScript best practices. Current version 5.1.3 (stable, active development). Includes rules for filename conventions, import ordering, type import preferences, destructuring newlines, and identifier naming. Requires @typescript-eslint/parser. Provides recommended config. Differentiators: opinionated set of rules beyond standard ESLint/TypeScript-ESLint, promotes inline type imports, and strict naming conventions. Release cadence: multiple minor/patch releases per year.","status":"active","version":"5.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/gajus/eslint-plugin-canonical","tags":["javascript","eslint","plugin","canonical","typescript"],"install":[{"cmd":"npm install eslint-plugin-canonical","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-canonical","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-canonical","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required as ESLint parser for TypeScript syntax","package":"@typescript-eslint/parser","optional":false},{"reason":"Peer dependency; the plugin is an ESLint extension","package":"eslint","optional":false}],"imports":[{"note":"Plugin is default-exported; named export only for rules object.","wrong":"import { canonical } from 'eslint-plugin-canonical'","symbol":"canonical","correct":"import plugin from 'eslint-plugin-canonical' (or use in extends/plugins via 'plugin:canonical/recommended')"},{"note":"configs is a named export containing 'recommended' and other configs.","wrong":"import config from 'eslint-plugin-canonical/configs'","symbol":"configs","correct":"import { configs } from 'eslint-plugin-canonical'"},{"note":"Both ESM and CommonJS supported; rules map accessible via named import.","wrong":"const rules = require('eslint-plugin-canonical').rules","symbol":"rules","correct":"import { rules } from 'eslint-plugin-canonical'"}],"quickstart":{"code":"// .eslintrc.json\n{\n  \"parser\": \"@typescript-eslint/parser\",\n  \"plugins\": [\"canonical\"],\n  \"extends\": [\"plugin:canonical/recommended\"],\n  \"rules\": {\n    \"canonical/filename-match-exported\": \"error\",\n    \"canonical/prefer-inline-type-import\": \"error\"\n  }\n}","lang":"json","description":"Configures ESLint with Canonical plugin and recommended rules, plus custom rules for filename matching and inline type imports."},"warnings":[{"fix":"Upgrade Node to >=12, ESLint to >=6.","message":"Version 3.0.0 dropped support for Node <12; requires ESLint >=6.","severity":"breaking","affected_versions":">=3.0.0 <4.0.0"},{"fix":"Use ESLint's built-in 'no-extend-native' rule instead.","message":"Rule 'no-use-extend-native' deprecated in v4.0.0.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Set parser to '@typescript-eslint/parser' in ESLint config.","message":"Requires @typescript-eslint/parser; using other parsers (e.g., babel-eslint) breaks rule functionality.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Review rule options; previously allowed all on same line by default.","message":"Version 5.0.0 changed rule 'destructuring-property-newline' defaults.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Use 'canonical/rule-name' instead of just 'rule-name'.","message":"Plugin rule names require 'canonical/' prefix in ESLint config.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Remove 'canonical/id-match' and use ESLint's 'id-match' rule.","message":"Rule 'id-match' deprecated in favor of built-in ESLint 'id-match' with custom options.","severity":"deprecated","affected_versions":">=5.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install eslint-plugin-canonical --save-dev'","cause":"Missing 'eslint-plugin-canonical' in devDependencies or incorrect installation.","error":"Error: Failed to load plugin 'canonical' declared in 'extends'"},{"fix":"Run 'npm install @typescript-eslint/parser --save-dev'","cause":"Missing required parser dependency.","error":"Error: Cannot find module '@typescript-eslint/parser'"},{"fix":"Check rule names in documentation; they must match exactly.","cause":"Using invalid rule name or misspelled prefix (e.g., 'canonical/some-rule' wrong).","error":"TypeError: Cannot read properties of undefined (reading 'someRule')"},{"fix":"Set 'parserOptions.project' to './tsconfig.json' or adjust path.","cause":"Missing tsconfig.json path in parserOptions.","error":"Parsing error: 'parserOptions.project' has been set for @typescript-eslint/parser but the project does not exist."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}