{"id":26143,"library":"razor-vue-lint","title":"razor-vue-lint","description":"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.","status":"active","version":"1.1.10","language":"javascript","source_language":"en","source_url":"https://github.com/kristianmandrup/razor-vue-lint","tags":["javascript","vue","vuejs","razor","mvc","eslint","linting","lint","template"],"install":[{"cmd":"npm install razor-vue-lint","lang":"bash","label":"npm"},{"cmd":"yarn add razor-vue-lint","lang":"bash","label":"yarn"},{"cmd":"pnpm add razor-vue-lint","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM; named export only. Wrong: destructuring from require works but is not standard ESM pattern.","wrong":"const razorVueLint = require('razor-vue-lint'); razorVueLint.esLintEscapeRazorExpressions(code);","symbol":"esLintEscapeRazorExpressions","correct":"import { esLintEscapeRazorExpressions } from 'razor-vue-lint'"},{"note":"Historical alias for esLintEscapeRazorExpressions? Not documented.","wrong":"import { esLintEscapeRazorExpressions } from 'razor-vue-lint'; // wrong function name","symbol":"addIgnoreEsLintBlocksForRazorExpressions","correct":"import { addIgnoreEsLintBlocksForRazorExpressions } from 'razor-vue-lint'"},{"note":"No default export; only named exports.","wrong":"import { default } from 'razor-vue-lint';","symbol":"default","correct":"import razorVueLint from 'razor-vue-lint'; razorVueLint.esLintEscapeRazorExpressions(code);"}],"quickstart":{"code":"import { esLintEscapeRazorExpressions } from 'razor-vue-lint';\nimport { readFileSync, writeFileSync } from 'fs';\nimport { globSync } from 'glob';\n\nconst files = globSync('**/*.cshtml');\nfor (const file of files) {\n  const original = readFileSync(file, 'utf-8');\n  const lintSafe = esLintEscapeRazorExpressions(original);\n  writeFileSync(file.replace('.cshtml', '.lint.cshtml'), lintSafe);\n  console.log(`Processed ${file}`);\n}","lang":"typescript","description":"Recursively processes all .cshtml files in a project, escaping Razor expressions with ESLint ignore comments and saving to .lint.cshtml files."},"warnings":[{"fix":"Contribute custom matchers via options or manually wrap unsupported expressions with /* eslint-disable */ and /* eslint-enable */.","message":"Not all Razor expression patterns are supported; only those terminated by newline, closing tag, or single quotes. Complex expressions may not be escaped.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Replace addIgnoreEsLintBlocksForRazorExpressions with esLintEscapeRazorExpressions.","message":"Function addIgnoreEsLintBlocksForRazorExpressions is undocumented and may be removed. Use esLintEscapeRazorExpressions instead.","severity":"deprecated","affected_versions":"<=1.1.10"},{"fix":"Consider writing a custom ESLint plugin or preprocessor for .cshtml files instead.","message":"Package has not been updated since initial release; no active maintenance. Could break with future ESLint versions.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install @types/razor-vue-lint (if available) or create a declaration file: declare module 'razor-vue-lint';","cause":"TypeScript project not finding types; package has no bundled types.","error":"Cannot find module 'razor-vue-lint' or its corresponding type declarations."},{"fix":"Use import instead of require(): import { esLintEscapeRazorExpressions } from 'razor-vue-lint';","cause":"Using require() in an ESM context; the package is ESM-only.","error":"Uncaught SyntaxError: The requested module 'razor-vue-lint' does not provide an export named 'esLintEscapeRazorExpressions'"},{"fix":"Use import { esLintEscapeRazorExpressions } from 'razor-vue-lint'; not import razorVueLint from 'razor-vue-lint';","cause":"Importing the default export instead of named export.","error":"TypeError: esLintEscapeRazorExpressions is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}