Registry / testing / eslint-plugin-canonical

eslint-plugin-canonical

JSON →
library5.1.3jsnpmunverified

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.

npm install eslint-plugin-canonical
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-CANO
E
eslint-plugin-canonical
testingjavascriptv5.1.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

canonical
import plugin from 'eslint-plugin-canonical' (or use in extends/plugins via 'plugin:canonical/recommended')
import { canonical } from 'eslint-plugin-canonical'
Plugin is default-exported; named export only for rules object.
configs
import { configs } from 'eslint-plugin-canonical'
import config from 'eslint-plugin-canonical/configs'
configs is a named export containing 'recommended' and other configs.
rules
import { rules } from 'eslint-plugin-canonical'
const rules = require('eslint-plugin-canonical').rules
Both ESM and CommonJS supported; rules map accessible via named import.

Configures ESLint with Canonical plugin and recommended rules, plus custom rules for filename matching and inline type imports.

// .eslintrc.json { "parser": "@typescript-eslint/parser", "plugins": ["canonical"], "extends": ["plugin:canonical/recommended"], "rules": { "canonical/filename-match-exported": "error", "canonical/prefer-inline-type-import": "error" } }
Debug
Known issues
breakingVersion 3.0.0 dropped support for Node <12; requires ESLint >=6.
fix
Upgrade Node to >=12, ESLint to >=6.
affects: >=3.0.0 <4.0.0
deprecatedRule 'no-use-extend-native' deprecated in v4.0.0.
fix
Use ESLint's built-in 'no-extend-native' rule instead.
affects: >=4.0.0
gotchaRequires @typescript-eslint/parser; using other parsers (e.g., babel-eslint) breaks rule functionality.
fix
Set parser to '@typescript-eslint/parser' in ESLint config.
affects: >=1.0.0
breakingVersion 5.0.0 changed rule 'destructuring-property-newline' defaults.
fix
Review rule options; previously allowed all on same line by default.
affects: >=5.0.0
gotchaPlugin rule names require 'canonical/' prefix in ESLint config.
fix
Use 'canonical/rule-name' instead of just 'rule-name'.
affects: >=1.0.0
deprecatedRule 'id-match' deprecated in favor of built-in ESLint 'id-match' with custom options.
fix
Remove 'canonical/id-match' and use ESLint's 'id-match' rule.
affects: >=5.0.0
Errors
Common errors & fixes
Error: Failed to load plugin 'canonical' declared in 'extends'
Missing 'eslint-plugin-canonical' in devDependencies or incorrect installation.
fix
Run 'npm install eslint-plugin-canonical --save-dev'
Error: Cannot find module '@typescript-eslint/parser'
Missing required parser dependency.
fix
Run 'npm install @typescript-eslint/parser --save-dev'
TypeError: Cannot read properties of undefined (reading 'someRule')
Using invalid rule name or misspelled prefix (e.g., 'canonical/some-rule' wrong).
fix
Check rule names in documentation; they must match exactly.
Parsing error: 'parserOptions.project' has been set for @typescript-eslint/parser but the project does not exist.
Missing tsconfig.json path in parserOptions.
fix
Set 'parserOptions.project' to './tsconfig.json' or adjust path.
Upgrade
Version history
5.1.3latest on npm
Audit
Dependencies
@typescript-eslint/parserrequiredRequired as ESLint parser for TypeScript syntax
eslintrequiredPeer dependency; the plugin is an ESLint extension
Agent activity
2 hits · last 30 days
node
2
Resources