Skip to content

[babel] Remove @elastic/eslint-config-kibana and babel-eslint-plugin - #6808

Merged
cee-chen merged 6 commits into
elastic:mainfrom
cee-chen:babel/eslint-config-kibana
May 24, 2023
Merged

cee-chen merged 6 commits into
elastic:mainfrom
cee-chen:babel/eslint-config-kibana

Conversation

@cee-chen

@cee-chen cee-chen commented May 24, 2023 •

Copy link
Copy Markdown
Contributor

Summary

Meta issue: #6652

The only dependency using babel-eslint-plugin was @elastic/eslint-config-kibana, which appears to have been deprecated / archived at some point, and was instead moved directly to within Kibana. I spoke to Tiago and he confirmed that it doesn't make sense for EUI to try and import a @kbn package, but instead that we should keep our eslint configurations separate (as EUI and Kibana are generally seperate repos).

This PR handles removing the two aforementioned dependencies and recreating the eslint config as specified in https://github.com/elastic/eslint-config-kibana/blob/master/.eslintrc.js. I made one or two opinionated changes (see commit messages) and excluded some rules that were already handled by Prettier or by @typescript/eslint.

QA

General checklist

  • yarn lint passes

- `eslint-plugin-babel` is not used by anything in our repo except for:
- `@elastic/eslint-config-kibana` is no longer supported/maintained, and exists in Kibana now. It doesn't make sense for us to import from Kibana, so we should likely just maintain our own eslint config settings
@cee-chen cee-chen added skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation) tech debt labels May 24, 2023
@cee-chen
cee-chen requested a review from a team May 24, 2023 21:17
@kibanamachine

Copy link
Copy Markdown
Contributor

@1Copenut 1Copenut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM! I pulled the branch, then ran yarn &&. yarn lint. Passed with no issues.

@1Copenut 1Copenut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM! I pulled the branch, then ran yarn &&. yarn lint. Passed with no issues.

@cee-chen
cee-chen force-pushed the babel/eslint-config-kibana branch from 4f3f077 to 0f72bcb Compare May 24, 2023 21:59
cee-chen added 5 commits May 24, 2023 15:02
@see https://github.com/elastic/eslint-config-kibana/blob/master/.eslintrc.js

- excluding rules that overlap w/ Prettier (spacing, quotes, indentation, etc)
- excluded `no-undef`, `no-redeclare` - `@typescript/eslint` already handles these without throwing errors on globals and type exports (see https://stackoverflow.com/a/64197516/4294462) - also allows removing `env` config
+ update eqeqeq rule and no-empty rule to allow empty catches

[opinionated]
- removed `no-nested-ternary`, as we use those plenty and Prettier styles them to be very readable
- also removed several rules which just don't come up for us often, e.g. `__proto__` and `__iterator__` checks
+ upgrade `mocha` eslint plugin to latest
+ remove unused import disable rules
+ remove `import/named` - it doesn't know how to handle types and `@typescript/eslint` already does it better
+ upgrade react eslint packages to latest

+ remove unused disable rules
+ remove unnecessary `jsx` import in Jest test
@cee-chen
cee-chen force-pushed the babel/eslint-config-kibana branch from 0f72bcb to 24b21ef Compare May 24, 2023 22:02
@cee-chen

Copy link
Copy Markdown
Contributor Author

Thanks Trevor! Rebases were me being annoying and just re-ordering a rule (not actually changing presence of any rules). Merging in

@cee-chen
cee-chen enabled auto-merge (squash) May 24, 2023 22:03
@kibanamachine

Copy link
Copy Markdown
Contributor

@cee-chen
cee-chen merged commit 437c2c0 into elastic:main May 24, 2023
@cee-chen
cee-chen deleted the babel/eslint-config-kibana branch May 24, 2023 22:40
@kibanamachine

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation) tech debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants