{"id":25506,"library":"eslint-plugin-doc-code-blocks","title":"eslint-plugin-doc-code-blocks","description":"Lint JavaScript code embedded in block comments (e.g., JSDoc, YUIDoc code fences) using ESLint. Version 0.3.1 is the latest stable release; the package has low release cadence and is in maintenance mode. It does not provide its own rules but leverages existing ESLint configurations (eslint:recommended or eslint:all) on code blocks within comments. A key differentiator is enabling code quality checks on documentation examples, though it lacks active development and may not support ESLint versions beyond 8.x.","status":"maintenance","version":"0.3.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","eslint","eslintplugin","eslint-plugin","jsdoc","yuidoc","comments","code fences","comment code"],"install":[{"cmd":"npm install eslint-plugin-doc-code-blocks","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-doc-code-blocks","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-doc-code-blocks","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; required to run the plugin (ESLint >=4.0).","package":"eslint","optional":false}],"imports":[{"note":"ESLint plugin names omit the 'eslint-plugin-' prefix in config files.","wrong":"plugins: ['eslint-plugin-doc-code-blocks']","symbol":"plugin","correct":"plugins: ['doc-code-blocks']"},{"note":"Configs must include 'plugin:' prefix to reference plugin-provided configs.","wrong":"extends: ['doc-code-blocks/recommended']","symbol":"config","correct":"extends: ['plugin:doc-code-blocks/recommended']"},{"note":"Use a separate config file (e.g., .doc.eslintrc.js) to apply rules to code blocks.","wrong":"eslint -c doc-code-blocks your_files","symbol":"CLI","correct":"eslint --config .doc.eslintrc.js your_files"}],"quickstart":{"code":"// .eslintrc.js\nmodule.exports = {\n  plugins: ['doc-code-blocks'],\n};\n\n// .doc.eslintrc.js\nmodule.exports = {\n  extends: ['plugin:doc-code-blocks/recommended'],\n  plugins: ['doc-code-blocks'],\n  rules: {\n    'semi': ['error', 'always'],\n    'no-console': 'off'\n  }\n};\n\n// Run:\n// eslint --config .doc.eslintrc.js --no-eslintrc --ext .js .","lang":"javascript","description":"Configures the plugin and a separate config to lint code blocks with custom rules, then runs eslint with that config."},"warnings":[{"fix":"Consider using '@eslint/plugin-markdown' or 'eslint-plugin-markdown' for similar functionality with better maintenance.","message":"This plugin does not provide its own rules and relies on ESLint's built-in configs (eslint:all, eslint:recommended). It may not work with ESLint >=9.x due to flat config migration.","severity":"deprecated","affected_versions":">=0.3.1"},{"fix":"Prefer 'plugin:doc-code-blocks/recommended' which uses 'eslint:recommended', or define explicit rules.","message":"ESLint's 'eslint:all' config can break across minor releases; plugin extends 'all' in 'plugin:doc-code-blocks/all'.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Always run eslint with a dedicated config for code blocks (e.g., --config .doc.eslintrc.js).","message":"Rules are applied to code blocks only when using a separate config file; rules in the default .eslintrc do not affect code blocks.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Continue using .eslintrc.* files; plugin will not work with flat config introduced in ESLint 9.","message":"The plugin does not support ESLint flat config (eslint.config.js). Only legacy .eslintrc format is supported.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.3.1':22 '8':84 'activ':75 'beyond':83 'block':6,12,58 'cadenc':33 'check':68 'code':5,9,17,57,66,95,98 'comment':13,60,94,97 'configur':50 'develop':76 'differenti':63 'doc':4 'document':70 'e.g':14 'embed':10 'enabl':65 'eslint':2,20,49,51,54,81,87,90 'eslint-plugin':89 'eslint-plugin-doc-code-block':1 'eslintplugin':88 'exampl':71 'exist':48 'fenc':18,96 'javascript':8,86 'jsdoc':15,92 'key':62 'lack':74 'latest':25 'leverag':47 'lint':7 'low':31 'mainten':37 'may':78 'mode':38 'packag':29 'plugin':3,91 'provid':42 'qualiti':67 'recommend':52 'releas':27,32 'rule':45 'stabl':26 'support':80 'though':72 'use':19 'version':21,82 'within':59 'x':85 'yuidoc':16,93","created_at":"2026-05-01T13:45:07.222805+00:00","updated_at":"2026-05-01T13:45:07.222805+00:00","problems":[{"fix":"Install the plugin globally: npm i -g eslint-plugin-doc-code-blocks","cause":"Plugin not installed globally when ESLint is global.","error":"Error: Failed to load plugin 'doc-code-blocks' declared in '.eslintrc.js': Cannot find module 'eslint-plugin-doc-code-blocks'"},{"fix":"Ensure rule values are valid ESLint rule severity (e.g., 'error', 2) or an array: 'semi': ['error', 'always']","cause":"Using 'extends' from doc-code-blocks/all without proper rule config format.","error":"Error: Configuration for rule 'semi' is invalid: Value '\"always\"' is the wrong type (expected object or boolean)"},{"fix":"Set parserOptions: { 'sourceType': 'module' } in your .doc.eslintrc.js.","cause":"Source code in the code block uses ES modules, but ESLint parser is not set to 'eslint:recommended' or parserOptions for modules.","error":"Parsing error: The keyword 'import' is reserved"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/eslint-plugin-doc-code-blocks","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-05-01","next_check":"2026-07-30","install_tag":null}}