Skip to content

Commit

Permalink
[8.9] [Ops] Fix @kbn/imports/no_unused_imports rule (#164870) (#164907)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.9`:
- [[Ops] Fix @kbn/imports/no_unused_imports rule
(#164870)](#164870)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Alex
Szabo","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-08-25T23:13:57Z","message":"[Ops]
Fix @kbn/imports/no_unused_imports rule (#164870)\n\n##
Summary\r\n@jloleysens reported that ESLint breaks (probably in IDEs
only) because\r\nof this bug. When there's an unused import, linting
stops for the whole\r\nfile.\r\n\r\nBy adding this flag, it no longer
breaks on my machine, however,\r\nauto-fixing still doesn't work from
the CLI. The IDE auto-fixes because\r\nit also recognizes it as a
non-unsed variable.\r\n\r\n- add `meta.hasSuggestions` to
`@kbn/imports/no_unused_imports` prevent\r\nESLint from
breaking","sha":"d8d355dd7b4184127a760261178daf0f8a94af86","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["chore","Team:Operations","release_note:skip","backport:all-open","v8.11.0"],"number":164870,"url":"https://github.com/elastic/kibana/pull/164870","mergeCommit":{"message":"[Ops]
Fix @kbn/imports/no_unused_imports rule (#164870)\n\n##
Summary\r\n@jloleysens reported that ESLint breaks (probably in IDEs
only) because\r\nof this bug. When there's an unused import, linting
stops for the whole\r\nfile.\r\n\r\nBy adding this flag, it no longer
breaks on my machine, however,\r\nauto-fixing still doesn't work from
the CLI. The IDE auto-fixes because\r\nit also recognizes it as a
non-unsed variable.\r\n\r\n- add `meta.hasSuggestions` to
`@kbn/imports/no_unused_imports` prevent\r\nESLint from
breaking","sha":"d8d355dd7b4184127a760261178daf0f8a94af86"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/164870","number":164870,"mergeCommit":{"message":"[Ops]
Fix @kbn/imports/no_unused_imports rule (#164870)\n\n##
Summary\r\n@jloleysens reported that ESLint breaks (probably in IDEs
only) because\r\nof this bug. When there's an unused import, linting
stops for the whole\r\nfile.\r\n\r\nBy adding this flag, it no longer
breaks on my machine, however,\r\nauto-fixing still doesn't work from
the CLI. The IDE auto-fixes because\r\nit also recognizes it as a
non-unsed variable.\r\n\r\n- add `meta.hasSuggestions` to
`@kbn/imports/no_unused_imports` prevent\r\nESLint from
breaking","sha":"d8d355dd7b4184127a760261178daf0f8a94af86"}}]}]
BACKPORT-->

Co-authored-by: Alex Szabo <[email protected]>
  • Loading branch information
kibanamachine and delanni authored Aug 26, 2023
1 parent 79ce197 commit 651db1f
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function isTsOrEslintIgnore(comment: Comment) {

export const NoUnusedImportsRule: Rule.RuleModule = {
meta: {
hasSuggestions: true,
fixable: 'code',
docs: {
url: 'https://github.com/elastic/kibana/blob/main/packages/kbn-eslint-plugin-imports/README.mdx#kbnimportsno_unused_imports',
Expand Down

0 comments on commit 651db1f

Please sign in to comment.