Etherpad ESLint Shareable Config

raw JSON →
4.0.5 verified Sat Apr 25 auth: no javascript

ESLint shareable config used by Etherpad and its plugins. Version 4.0.5 (stable). This package provides multiple config presets (etherpad, etherpad/node, etherpad/browser, etherpad/tests, etc.) and a plugin-oriented config that automatically applies the correct presets based on file location. It includes a workaround for ESLint's modern module resolution issue (ESLint #3458). Key differentiator: tailored specifically for Etherpad ecosystem, handles backend/frontend/test code separately, and requires explicit peer dependency on ep_etherpad-lite to satisfy Node.js plugin checks.

error Error: Failed to load plugin 'something' declared in '...'
cause Missing the modern-module-resolution patch require() call in .eslintrc.cjs.
fix
Add 'require('eslint-config-etherpad/patch/modern-module-resolution');' at the top of your ESLint config file.
error Parsing error: Cannot find module 'typescript'
cause TypeScript is not installed as a peer dependency.
fix
Run 'npm install --save-dev typescript'.
error Warning: Rule 'no-undef' encountered an unknown global '...'
cause Missing appropriate env or global definitions for the file type (e.g., browser globals in test files).
fix
Use the proper sub-config like 'etherpad/browser' or add env in overrides.
error Error: Cannot find module 'eslint-config-etherpad'
cause Package not installed or module resolution fails without the patch.
fix
Ensure 'eslint-config-etherpad' is installed and the patch require() is called.
gotcha Patch required: The require('eslint-config-etherpad/patch/modern-module-resolution') call is necessary for ESLint to resolve plugins correctly. Omitting it causes 'Failed to load plugin' errors.
fix Add 'require('eslint-config-etherpad/patch/modern-module-resolution');' at the top of .eslintrc.cjs.
gotcha Peer dependency ep_etherpad-lite must be manually installed and symlinked; npm install removes the symlink.
fix Run 'npm install --no-save ep_etherpad-lite@file:/path/to/etherpad-lite/src' after each npm install.
deprecated The 'etherpad/plugin' config may become outdated as ESLint evolves; always check compatibility with your ESLint version.
fix Ensure ESLint version matches the peer dependency range specified in package.json.
gotcha ESLint version mismatch: The shareable config may require a specific ESLint version. Using an incompatible version can cause rule errors.
fix Refer to peerDependencies in package.json and install a compatible ESLint version.
npm install eslint-config-etherpad
yarn add eslint-config-etherpad
pnpm add eslint-config-etherpad

Creates a .eslintrc.cjs file that extends the etherpad/plugin config and adds an override for shared Node/browser files.

// .eslintrc.cjs
'use strict';

// Workaround for https://github.com/eslint/eslint/issues/3458
require('eslint-config-etherpad/patch/modern-module-resolution');

module.exports = {
  root: true,
  extends: 'etherpad/plugin',
  overrides: [
    {
      files: ['static/js/shared/**/*'],
      env: {
        'shared-node-browser': true,
      },
    },
  ],
};