Linting

A note about linting: We use oxlint to check that the styleguide is being followed. Rules are configured in .oxlint/ and loaded through oxlint.config.mjs. It runs in a pre-commit hook and as a part of the tests, but most contributors integrate it with their code editors for real-time feedback.

Run node scripts/lint [paths...] to lint files (the whole repo when no paths are given), and add --fix to apply automatic fixes. Pass explicit files or directories; globs are not expanded.

For editor integration, install the Oxc extension for your editor. The oxlint editor guide lists the available extensions.

Another tool we use for enforcing consistent coding style is EditorConfig, which can be set up by installing a plugin in your editor that dynamically updates its configuration. Take a look at the EditorConfig site to find a plugin for your editor, and browse our .editorconfig file to see what config rules we set up.

Install the Oxc VS Code extension. It reports oxlint errors as you type in JavaScript and TypeScript files. Oxlint does not discover oxlint.config.mjs automatically; bootstrap (node scripts/update_vscode_config) points the extension at it in your workspace settings:

"oxc.configPath": "${workspaceFolder}/oxlint.config.mjs"
		

The extension can automatically fix trivial lint errors when you save a file by adding this line in your settings.

"editor.codeActionsOnSave": {
   "source.fixAll.oxc": "always"
}
		

The ESLint extension is not needed; Kibana no longer runs ESLint.

Code formatting is handled by oxfmt, not by oxlint. The configuration lives in .oxfmtrc.json and applies to JavaScript and TypeScript files only. Run node scripts/oxfmt [paths...] to format files, or node scripts/oxfmt --check to report unformatted files without changing them; CI runs the latter. When fixing lint errors from the command line, run node scripts/lint --fix first and node scripts/oxfmt second so the lint fixes get formatted.

Bootstrap also sets the Oxc extension as the default formatter for JavaScript and TypeScript in your workspace settings, so Prettier extensions don't reformat these files. For format-on-save, install the Oxc VS Code extension (other editors are covered in the oxfmt editor guide) and enable it in your settings:

"editor.formatOnSave": true
		

Avoid using the Prettier extension/IDE plugin while maintaining the Kibana project. Its output differs from oxfmt's in places and it would format files that the project deliberately leaves untouched.