any-eslint-parser
raw JSON → 1.0.1 verified Sat Apr 25 auth: no javascript
Check any file type with ESLint using a parser that ignores AST-based rules, allowing text-based rules like eol-last and no-tabs to be applied to non-JavaScript files (e.g. JSON, YAML, Markdown, XML, etc.). Current stable version is 1.0.1. The package has no release cadence documented and is a niche tool for leveraging ESLint's text-based rules across diverse file formats. Differentiators include zero AST dependency for linting, compatibility with eslint-plugin-regex, and ability to use existing ESLint configuration infrastructure.
Common errors
error Parsing error: The keyword 'import' is reserved ↓
cause Parser tries to parse non-JavaScript file as JavaScript because default parser is espree.
fix
Set parser to 'any-eslint-parser' in the ESLint config for the file patterns.
error Error: Failed to load parser 'any-eslint-parser' ↓
cause any-eslint-parser is not installed; missing npm package.
fix
Run 'npm install --save-dev any-eslint-parser' to install the parser.
error No ESLint configuration found ↓
cause Using --no-eslintrc without providing a config file via --config.
fix
Specify the config file with '--config /path/to/.eslintrc-any.json'.
Warnings
gotcha AST-based rules like no-unused-vars are ignored silently; no error is thrown but they produce no effect. ↓
fix Use only text-based rules (e.g. eol-last, no-tabs, eslint-plugin-regex rules) in the parser's config.
gotcha Using any-eslint-parser without --no-eslintrc may cause unexpected behavior if parent configs contain AST rules. ↓
fix Pass --no-eslintrc to eslint to ignore all other config files, or use a dedicated eslintrc file for any-eslint-parser.
deprecated No deprecation warnings in package.
breaking No breaking changes documented; version 1.0.1 is the only release.
Install
npm install any-eslint-parser yarn add any-eslint-parser pnpm add any-eslint-parser Imports
- any-eslint-parser wrong
Using "parser": "any-eslint-parser" in a JavaScript file (it's a config option, not an import)correctIn .eslintrc: { "parser": "any-eslint-parser" } - eslint wrong
eslint "**/*.json" (without specifying the parser config)correctnpx eslint --config .eslintrc-any.json --no-eslintrc "**/*.json" - defaultParser wrong
import anyEslintParser from 'any-eslint-parser'correctNot applicable; there is no exported symbol.
Quickstart
// 1. Install dependencies
// npm install --save-dev any-eslint-parser eslint
// 2. Create .eslintrc-any.json with parser and text-based rules
// { "parser": "any-eslint-parser", "rules": { "eol-last": "error", "no-tabs": "error" } }
// 3. Run eslint with the custom config
// npx eslint --config .eslintrc-any.json --no-eslintrc "**/*.+(json|yml|xml|md|txt|sh)"
// Example output for a JSON file with tabs:
// 1:1 error Unexpected tab character no-tabs
// 2:1 error Newline required at end of file but not found eol-last