Registry / testing / convention-lint

convention-lint

JSON →
library1.0.7jsnpmunverified

Convention Lint is a CLI and VS Code extension that enforces naming conventions for files, folders, and HTML/JSX/Vue/Svelte class and id attributes. Current stable version is 1.0.7. It provides real-time diagnostics in the Problems panel, Quick Fix actions, and support for kebab-case, camelCase, PascalCase, snake_case, and lowercase rules. Key differentiators include atomic CSS detection for utility-first frameworks, per-rule severity settings, and disable comments. It competes with tools like ESLint naming plugins but focuses specifically on file and attribute naming.

npm install convention-lint
INSTALL
IMPORT
SIG · CONVENTION-LINT
C
convention-lint
testingjavascriptv1.0.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

lintCLI
import { lintCLI } from 'convention-lint'
import conventionLint from 'convention-lint'
ESM-only; no default export.
check
import { check } from 'convention-lint'
const { check } = require('convention-lint')
ESM-only; CommonJS require is not supported.
typeConfig
import type { ConventionConfig } from 'convention-lint'
import { ConventionConfig } from 'convention-lint'
Type import for config types.

Installs the CLI globally, creates a configuration file, and runs lint on a directory and specific files.

// Install globally npm install -g convention-lint // Create .convention.json const fs = require('fs'); const config = { convention: { classNamingRule: 'kebab-case', idNamingRule: 'camelCase', fileNamingRule: 'kebab-case', folderNamingRule: 'lowercase', extensions: ['.html', '.vue', '.jsx', '.tsx', '.svelte', '.php'], ignoreAtomicCSS: true, severity: 'warning', ignore: ['node_modules', '.git', 'dist'], ignorePatterns: ['**/*.test.*'] } }; fs.writeFileSync('.convention.json', JSON.stringify(config, null, 2)); // Lint a directory convention-lint lint ./src // Check specific files for pre-commit convention-lint check ./src/index.html ./src/component.vue
convention-lint --version
Debug
Known issues
gotchaAtomic CSS detection may skip classes that are not in the built-in list; custom atomic classes should be added via 'customAtomicClasses' config.
fix
Add unknown utility classes to 'customAtomicClasses' in .convention.json.
affects: >=1.0.0
breakingVersion 1.0.0 changed the configuration file format from .conventionrc.json to .convention.json; old config files are ignored.
fix
Rename .conventionrc.json to .convention.json.
affects: >=1.0.0
gotchaCLI commands 'lint' and 'check' do not automatically ignore node_modules; you must specify in 'ignore' config or use --ignore flag.
fix
Add 'node_modules' to the 'ignore' array in .convention.json or run with '--ignore node_modules'.
affects: >=1.0.0
gotchaDisable comments must be exactly as documented; extra spaces or typo will be ignored.
fix
Use exactly '<!-- convention-lint-disable -->' (no extra spaces).
affects: >=1.0.0
deprecatedThe '--no-fail' flag in 'lint' is deprecated; use '--severity off' instead.
fix
Use 'convention-lint lint --severity off' instead of '--no-fail'.
affects: >=1.0.5
Errors
Common errors & fixes
Unrecognized token in .convention.json
Configuration file has syntax errors or unexpected keys.
fix
Validate JSON with 'jsonlint .convention.json' and ensure only 'convention' top-level key.
convention-lint: command not found
Package not installed globally or not in PATH.
fix
Run 'npm install -g convention-lint' and verify with 'which convention-lint'.
TypeError: conventionLint.lint is not a function
Using default import instead of named import in ESM.
fix
Use 'import { lint } from 'convention-lint'' instead of 'import conventionLint from 'convention-lint''.
Module not found: Can't resolve 'convention-lint'
Package not installed locally or missing in node_modules.
fix
Run 'npm install convention-lint --save-dev' in your project root.
Upgrade
Version history
1.0.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
1
Resources
convention-lint — npm install convention-lint · libregistry