kibana/docs/extend/kibana-linting.md
Colleen McGinnis 1814c60017
[docs] Migrate docs from AsciiDoc to Markdown (#212558)
Migrate docs from AsciiDoc to Markdown. The preview can be built after
#212557 is merged.

@florent-leborgne please tag reviewers, add the appropriate label(s),
and take this out of draft when you're ready.

Note: More files are deleted than added here because the content from
some files was moved to
[elastic/docs-content](https://github.com/elastic/docs-content).

**What has moved to
[elastic/docs-content](https://github.com/elastic/docs-content)?**

Public-facing narrative and conceptual docs have moved. Most can now be
found under the following directories in the new docs:
- explore-analyze: Discover, Dashboards, Visualizations, Reporting,
Alerting, dev tools...
- deploy-manage: Stack management (Spaces, user management, remote
clusters...)
- troubleshooting: .... troubleshooting pages

**What is staying in the Kibana repo?**

- Reference content (= anything that is or could be auto-generated):
Settings, syntax references
- Release notes
- Developer guide

---------

Co-authored-by: Florent Le Borgne <florent.leborgne@elastic.co>
2025-03-04 14:56:07 +01:00

2.6 KiB
Raw Permalink Blame History

mapped_pages
https://www.elastic.co/guide/en/kibana/current/kibana-linting.html

Linting [kibana-linting]

A note about linting: We use eslint to check that the styleguide is being followed. 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.

Here are some hints for getting eslint setup in your favorite editor:

Editor Plugin
Sublime SublimeLinter-eslint
Atom linter-eslint
VSCode ESLint
IntelliJ Settings » Languages & Frameworks » JavaScript » Code QualityTools » ESLint
vi scrooloose/syntastic

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.

Setup Guide for VS Code Users [_setup_guide_for_vs_code_users]

Note that for VSCode, to enable "live" linting of TypeScript (and other) file types, you will need to modify your local settings, as shown below. The default for the ESLint extension is to only lint JavaScript file types.

"eslint.validate": [
  "javascript",
  "javascriptreact",
  "typescript",
  "typescriptreact",
]

Although, starting with ESLint v2.0.4, there is no need to use eslint.validate to parse typescript files as it works out of the box.

eslint can automatically fix trivial lint errors when you save a file by adding this line in your setting.

"editor.codeActionsOnSave": {
   "source.fixAll.eslint": true
}

Prettier extension/IDE plugin while maintaining the {{kib}} project. Formatting and styling roles are set in the multiple .eslintrc.js files across the project and some of them use the NPM version of Prettier. Using the IDE extension might cause conflicts, applying the formatting to too many files that shouldnt be prettier-ized and/or highlighting errors that are actually OK.