{"id":42088,"library":"textlint-message-to-codemirror","title":"textlint-message-to-codemirror","description":"Convert textlint's messages to CodeMirror lint annotations. Current stable version is 1.0.0. This package is a small utility with no active release cadence (last release is original). It provides a simple function to transform textlint result objects into CodeMirror-compatible lint objects, mapping severity numbers (1 warning, 2 error) and converting from 1-based line/column to 0-based positions. It is a niche tool for integrating textlint linting output into CodeMirror editors.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/packages/textlint-message-to-codemirror","tags":["javascript","textlint","codemirror"],"install":[{"cmd":"npm install textlint-message-to-codemirror","lang":"bash","label":"npm"},{"cmd":"yarn add textlint-message-to-codemirror","lang":"bash","label":"yarn"},{"cmd":"pnpm add textlint-message-to-codemirror","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package uses CommonJS exports (module.exports). It does not support ES modules. In Node.js, use require(). If you need ESM, consider using createRequire or a bundler.","wrong":"import textlintToCodeMirror from 'textlint-message-to-codemirror'","symbol":"textlintToCodeMirror","correct":"const textlintToCodeMirror = require('textlint-message-to-codemirror')"},{"note":"The package exports a single function as default. Named import will not work. Use default require.","wrong":"import { textlintToCodeMirror } from 'textlint-message-to-codemirror'","symbol":"default import","correct":"const textlintToCodeMirror = require('textlint-message-to-codemirror')"},{"note":"There are no TypeScript type definitions. You may need to declare module or use require with any type.","wrong":"import textlintToCodeMirror from 'textlint-message-to-codemirror' with @types/","symbol":"no TypeScript","correct":"No TypeScript types provided. Use @types/ or create your own."}],"quickstart":{"code":"const textlintToCodeMirror = require('textlint-message-to-codemirror');\nconst textlintResult = {\n  message: \"This is a warning\",\n  severity: 1,\n  line: 2,\n  column: 5\n};\nconst codemirrorAnnotation = textlintToCodeMirror(textlintResult);\nconsole.log(codemirrorAnnotation);\n// Output:\n// {\n//   from: { ch: 4, line: 1 },\n//   to: { ch: 5, line: 1 },\n//   message: \"This is a warning\",\n//   severity: \"warning\"\n// }","lang":"javascript","description":"Shows how to convert a single textlint message object into a CodeMirror lint annotation using CommonJS require and logging the result."},"warnings":[{"fix":"Verify that input line/column are 1-based. The function handles conversion internally.","message":"Line and column are 1-based in textlint but CodeMirror expects 0-based. The conversion subtracts 1, but only from line and column for 'from', and adds 1 to column for 'to'. Ensure your textlint messages are 1-based.","severity":"gotcha","affected_versions":"<=1.0.0"},{"fix":"Understand that the range length is always 1 character. For multi-character ranges, you need to handle yourself or use a different approach.","message":"The 'to' position is always set to column (1-based) and line (1-based) but incremented only on column? Actually 'to' is { ch: column, line: line }, where column is the original input column (1-based). That means the range covers exactly one character starting at (line-1, column-1).","severity":"gotcha","affected_versions":"<=1.0.0"}],"env_vars":null,"search_vec":"'0':64 '1':53,60 '1.0.0':18 '2':55 'activ':27 'annot':13 'base':61,65 'cadenc':29 'codemirror':5,11,46,78,82 'codemirror-compat':45 'compat':47 'convert':6,58 'current':14 'editor':79 'error':56 'function':38 'integr':73 'javascript':80 'last':30 'line/column':62 'lint':12,48,75 'map':50 'messag':3,9 'nich':70 'number':52 'object':43,49 'origin':33 'output':76 'packag':20 'posit':66 'provid':35 'releas':28,31 'result':42 'sever':51 'simpl':37 'small':23 'stabl':15 'textlint':2,7,41,74,81 'textlint-message-to-codemirror':1 'tool':71 'transform':40 'util':24 'version':16 'warn':54","created_at":"2026-06-04T18:55:33.830817+00:00","updated_at":"2026-06-04T18:55:33.830817+00:00","problems":[{"fix":"Use require('textlint-message-to-codemirror') or configure bundler to handle CommonJS.","cause":"Using ES module import syntax (import ... from) on a CommonJS module without default interop.","error":"TypeError: textlintToCodeMirror is not a function"},{"fix":"Run 'npm install textlint-message-to-codemirror' or add it to package.json dependencies.","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'textlint-message-to-codemirror'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/packages/textlint-message-to-codemirror","github":"https://github.com/packages/textlint-message-to-codemirror","docs":null,"changelog":null,"pypi":null,"npm":"textlint-message-to-codemirror","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}