kibana/packages/kbn-eslint-plugin-disable
Gerard Soldevila 2a085e103a
Add ESLINT constraints to detect inter-group dependencies (#194810)
## Summary

Addresses https://github.com/elastic/kibana-team/issues/1175

As part of the **Sustainable Kibana Architecture** initiative, this PR
sets the foundation to start classifying plugins in isolated groups,
matching our current solutions / project types:

* It adds support for the following fields in the packages' manifests
(kibana.jsonc):
* `group?: 'search' | 'security' | 'observability' | 'platform' |
'common'`
  * `visibility?: 'private' | 'shared'`

* It proposes a folder structure to automatically infer groups:
```javascript
  'src/platform/plugins/shared': {
    group: 'platform',
    visibility: 'shared',
  },
  'src/platform/plugins/internal': {
    group: 'platform',
    visibility: 'private',
  },
  'x-pack/platform/plugins/shared': {
    group: 'platform',
    visibility: 'shared',
  },
  'x-pack/platform/plugins/internal': {
    group: 'platform',
    visibility: 'private',
  },
  'x-pack/solutions/observability/plugins': {
    group: 'observability',
    visibility: 'private',
  },
  'x-pack/solutions/security/plugins': {
    group: 'security',
    visibility: 'private',
  },
  'x-pack/solutions/search/plugins': {
    group: 'search',
    visibility: 'private',
  },
```

* If a plugin is moved to one of the specific locations above, the group
and visibility in the manifest (if specified) must match those inferred
from the path.
* Plugins that are not relocated are considered: `group: 'common',
visibility: 'shared'` by default. As soon as we specify a custom
`group`, the ESLINT rules will check violations against dependencies /
dependants.

The ESLINT rules are pretty simple:
* Plugins can only depend on:
  * Plugins in the same group
  * OR plugins with `'shared'` visibility
* Plugins in `'observability', 'security', 'search'` groups are
mandatorily `'private'`.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-10-22 06:34:19 -05:00
..
src Add ESLINT constraints to detect inter-group dependencies (#194810) 2024-10-22 06:34:19 -05:00
index.ts Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
jest.config.js Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kibana.jsonc
package.json Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
README.mdx
tsconfig.json

---
id: kibDevDocsOpsEslintPluginDisable
slug: /kibana-dev-docs/ops/kbn-eslint-plugin-disable
title: "@kbn/eslint-plugin-disable"
description: Custom ESLint rules for managing eslint rules disable in the Kibana repository
tags: ['kibana', 'dev', 'contributor', 'operations', 'eslint', 'disable']
---

`@kbn/eslint-plugin-disable` is an ESLint plugin providing custom rules to allow us to enforce specific eslint rules behaviours around eslint disables that we need to implement Bazel packages across the monorepo as our main development unit.

## `@kbn/disable/no_naked_eslint_disable`

Disallows the usage of naked eslint-disable comments without being specific about each rule to disable.

## `@kbn/disable/no_protected_eslint_disable`

Disallows the eslint-disable comments with specific protected rules that were built to not be disabled. Please contact the Kibana Operations team if you have a justifiable use case for disabling one of them.