Registry / web-framework / razor-vue-lint

razor-vue-lint

JSON →
library1.1.10jsnpmunverified

An ESLint preprocessor for .NET Razor (.cshtml) views containing inline Vue.js templates. Version 1.1.10 wraps Razor expressions (e.g. @Html.PropertyFor) inside /* eslint-disable */ and /* eslint-enable */ comment blocks so that ESLint only lints the Vue template portions. It supports three expression patterns: newline-terminated, closing-tag-terminated, and attribute-enclosed. The library is extensible via custom regex matchers and matcher keys. Released on npm, with low release cadence. Key differentiator: solves a niche problem of linting Vue code embedded in C# Razor views. Not widely adopted; consider manual ESLint configuration as an alternative.

npm install razor-vue-lint
INSTALL
IMPORT
SIG · RAZOR-VUE-LINT
R
razor-vue-lint
web-frameworkjavascriptv1.1.10
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.

esLintEscapeRazorExpressions
✓ import { esLintEscapeRazorExpressions } from 'razor-vue-lint'
✗ const razorVueLint = require('razor-vue-lint'); razorVueLint.esLintEscapeRazorExpressions(code);
Package is ESM; named export only. Wrong: destructuring from require works but is not standard ESM pattern.
addIgnoreEsLintBlocksForRazorExpressions
✓ import { addIgnoreEsLintBlocksForRazorExpressions } from 'razor-vue-lint'
✗ import { esLintEscapeRazorExpressions } from 'razor-vue-lint'; // wrong function name
Historical alias for esLintEscapeRazorExpressions? Not documented.
default
✓ import razorVueLint from 'razor-vue-lint'; razorVueLint.esLintEscapeRazorExpressions(code);
✗ import { default } from 'razor-vue-lint';
No default export; only named exports.

Recursively processes all .cshtml files in a project, escaping Razor expressions with ESLint ignore comments and saving to .lint.cshtml files.

import { esLintEscapeRazorExpressions } from 'razor-vue-lint'; import { readFileSync, writeFileSync } from 'fs'; import { globSync } from 'glob'; const files = globSync('**/*.cshtml'); for (const file of files) { const original = readFileSync(file, 'utf-8'); const lintSafe = esLintEscapeRazorExpressions(original); writeFileSync(file.replace('.cshtml', '.lint.cshtml'), lintSafe); console.log(`Processed ${file}`); }
Debug
Known issues
gotchaNot all Razor expression patterns are supported; only those terminated by newline, closing tag, or single quotes. Complex expressions may not be escaped.
fix
Contribute custom matchers via options or manually wrap unsupported expressions with /* eslint-disable */ and /* eslint-enable */.
affects: >=0.0.0
deprecatedFunction addIgnoreEsLintBlocksForRazorExpressions is undocumented and may be removed. Use esLintEscapeRazorExpressions instead.
fix
Replace addIgnoreEsLintBlocksForRazorExpressions with esLintEscapeRazorExpressions.
affects: <=1.1.10
gotchaPackage has not been updated since initial release; no active maintenance. Could break with future ESLint versions.
fix
Consider writing a custom ESLint plugin or preprocessor for .cshtml files instead.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'razor-vue-lint' or its corresponding type declarations.
TypeScript project not finding types; package has no bundled types.
fix
Install @types/razor-vue-lint (if available) or create a declaration file: declare module 'razor-vue-lint';
Uncaught SyntaxError: The requested module 'razor-vue-lint' does not provide an export named 'esLintEscapeRazorExpressions'
Using require() in an ESM context; the package is ESM-only.
fix
Use import instead of require(): import { esLintEscapeRazorExpressions } from 'razor-vue-lint';
TypeError: esLintEscapeRazorExpressions is not a function
Importing the default export instead of named export.
fix
Use import { esLintEscapeRazorExpressions } from 'razor-vue-lint'; not import razorVueLint from 'razor-vue-lint';
Upgrade
Version history
1.1.10latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
razor-vue-lint — npm install razor-vue-lint · libregistry