ESLint rules and configs used by Matrix.org projects
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-12 12:13:42 +01:00
.github Add zizmor CI 2026-06-11 09:40:54 -04:00
rules add copyright to copyright rule 2022-01-26 09:57:23 +01:00
.gitignore Switch from yarn classic to pnpm 2026-06-11 09:14:30 -04:00
.prettierrc.js Add prettier (#35) 2022-12-09 10:47:29 +01:00
a11y.js add jsx-a11y config 2021-12-21 20:50:19 +01:00
babel.js Adjust style to match other files 2021-05-28 10:38:44 +01:00
index.js Add Jest linting (#33) 2023-02-07 16:47:19 +01:00
javascript.js Fix for eslint<9 2025-10-15 10:37:25 +01:00
jest.js Add Jest linting (#33) 2023-02-07 16:47:19 +01:00
package.json Switch from yarn classic to pnpm 2026-06-11 09:14:30 -04:00
pnpm-lock.yaml Switch from yarn classic to pnpm 2026-06-11 09:14:30 -04:00
react.js Fix react rules 2024-10-16 16:39:49 +01:00
README.md Update README to suggest any package manager 2026-06-11 09:14:30 -04:00
typescript.js Enable consistent-type-imports typescript eslint rule 2025-01-14 10:30:19 +00:00

eslint-plugin-matrix-org

eslint-plugin-matrix-org contains ESLint rules and configs used by Matrix.org projects. It codifies https://github.com/vector-im/element-web/blob/develop/code_style.md.

This package contains several main ESLint configs for different project styles:

  • matrix-org/javascript: The style for native JavaScript projects.
  • matrix-org/babel: The style for Babel JavaScript projects. It extends matrix-org/javascript.
  • matrix-org/typescript: The style for TypeScript projects. It extends matrix-org/javascript.

There are also some mixin configs that can be used together with any of the above:

  • matrix-org/react: The style for React projects.
  • matrix-org/jest: The style for projects that use Jest for testing.

Getting started

Add this package as a development dependency with your package manager of choice:

yarn add eslint-plugin-matrix-org --dev
# or
pnpm add -D eslint-plugin-matrix-org
# etc

You can then add any of the following to your ESLint config:

Standard native JavaScript

{
    plugins: [
        "matrix-org",
    ],
    extends: [
        "plugin:matrix-org/javascript",
    ]
}

Standard Babel JavaScript

{
    plugins: [
        "matrix-org",
    ],
    extends: [
        "plugin:matrix-org/babel",
    ]
}

Standard TypeScript

{
    plugins: [
        "matrix-org",
    ],
    extends: [
        "plugin:matrix-org/typescript",
    ]
}

Standard native JavaScript with React

{
    plugins: [
        "matrix-org",
    ],
    extends: [
        "plugin:matrix-org/javascript",
        "plugin:matrix-org/react",
    ]
}

Standard Babel JavaScript with React

{
    plugins: [
        "matrix-org",
    ],
    extends: [
        "plugin:matrix-org/babel",
        "plugin:matrix-org/react",
    ]
}

Standard TypeScript with React

{
    plugins: [
        "matrix-org",
    ],
    extends: [
        "plugin:matrix-org/typescript",
        "plugin:matrix-org/react",
    ]
}

Standard TypeScript with React, jsx a11y, and Jest

{
    plugins: [
        "matrix-org",
    ],
    extends: [
        "plugin:matrix-org/typescript",
        "plugin:matrix-org/react",
        "plugin:matrix-org/a11y"
        "plugin:matrix-org/jest"
    ]
}

To require a copyright header:

{
    plugins: [
        "matrix-org",
    ],
    rules: [
        "matrix-org/require-copyright-header": "error",
        // provide a header template as a string to insert on --fix
        // the current year can be inserted into the template with the placeholder `%%CURRENT_YEAR%%`
        "matrix-org/require-copyright-header": ["error", HEADER_TEMPLATE]
    ]
}

This package does not hold any dependencies itself, as it causes conflicts the versions of the same dependencies downstream and also would imply installing the union of all tools. You should expect that you may need to add some of the following depending on the configs you enable:

  • @babel/core
  • @babel/eslint-parser
  • @babel/eslint-plugin
  • @typescript-eslint/eslint-plugin
  • @typescript-eslint/parser
  • eslint
  • eslint-config-google
  • eslint-config-prettier
  • eslint-plugin-deprecate
  • eslint-plugin-jest
  • eslint-plugin-jsx-a11y
  • eslint-plugin-react
  • eslint-plugin-react-hooks
  • eslint-plugin-import
  • eslint-plugin-unicorn
  • prettier
  • typescript

Releasing

Use "Run workflow". Refer to SemVer for versioning semantics. This workflow will bump the version, publish NPM, and create a GitHub release.