{"id":19681,"library":"eslint-parser-plain","title":"eslint-parser-plain","description":"ESLint parser that allows linting of various plain text file types (e.g., Markdown, JSON, YAML) by treating them as plain text strings. Version 0.1.1 is the current stable release with a slow release cadence. It is designed for use with ESLint's parser option to enable linting rules (like prettier/prettier) in non-JavaScript files. Differentiates from @eslint/markdown by being simpler and file-type agnostic.","status":"active","version":"0.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/so1ve/eslint-parser-plain","tags":["javascript","eslint","eslint-parser","typescript"],"install":[{"cmd":"npm install eslint-parser-plain","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-parser-plain","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-parser-plain","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Exported since v0.1.1. Use to access parser metadata (e.g., name, version).","symbol":"parserMeta","correct":"import { parserMeta } from 'eslint-parser-plain'"},{"note":"The default export is an object with parse and parseForESLint methods. ESM-only; require() will fail in CJS contexts.","wrong":"const parser = require('eslint-parser-plain')","symbol":"default export (parser object)","correct":"import parser from 'eslint-parser-plain'"},{"note":"Named export for the ESLint parser API. Same ESM restriction applies.","wrong":"const { parseForESLint } = require('eslint-parser-plain')","symbol":"parseForESLint","correct":"import { parseForESLint } from 'eslint-parser-plain'"}],"quickstart":{"code":"// .eslintrc.cjs\nmodule.exports = {\n  overrides: [\n    {\n      files: ['*.md', '*.json'],\n      parser: 'eslint-parser-plain',\n      rules: {\n        'prettier/prettier': ['error', { parser: 'markdown' }],\n      },\n    },\n  ],\n};","lang":"javascript","description":"Configures ESLint to use eslint-parser-plain for .md and .json files, enabling prettier rules on them."},"warnings":[{"fix":"Ensure your files are syntactically valid before linting, or combine with another parser for validation.","message":"eslint-parser-plain does not perform syntax validation; it treats all input as plain text. This may hide syntax errors in files like JSON.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use import statements or dynamic import() in CJS contexts. Alternatively, configure ESLint to support ESM parsers.","message":"ESM-only package: using require('eslint-parser-plain') will throw 'ERR_REQUIRE_ESM'.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Do not rely on the AST structure; this parser is intended only for plain text string extraction.","message":"The package's parse method returns an object with an 'ast' property set to a minimal token (e.g., { type: 'Program', body: [] }), not a full AST. This may break tools expecting a standard ESTree AST.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"N/A","message":"No known deprecations; all current APIs are stable.","severity":"deprecated","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Change .eslintrc.cjs to .eslintrc.mjs and use import statements, or use dynamic import: const parser = await import('eslint-parser-plain');","cause":"ESLint config file (e.g., .eslintrc.cjs) uses require() for an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/eslint-parser-plain/dist/index.js from /path/to/.eslintrc.cjs not supported."},{"fix":"Run 'npm install eslint-parser-plain --save-dev' and ensure your ESLint configuration points to the correct package name.","cause":"The package is not installed or is not in node_modules.","error":"Parsing error: The parser 'eslint-parser-plain' is not found."},{"fix":"Use the named export parseForESLint or import the default as shown in the quickstart.","cause":"Importing default export incorrectly in a CommonJS context.","error":"TypeError: (0 , _default.parse) is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}