-
Notifications
You must be signed in to change notification settings - Fork 839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore/8201 deprecate json tokens #8246
base: main
Are you sure you want to change the base?
Chore/8201 deprecate json tokens #8246
Conversation
04461a6
to
5cd5dd5
Compare
5cd5dd5
to
6a751f9
Compare
6a751f9
to
b8d7a96
Compare
Preview staging links for this PR:
|
💚 Build Succeeded
History
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thank you @weronikaolejniczak (also for the patience!)
I got this working locally without issues 👌
I added some comments, and I included [non-blocking]
in some of them, but thinking about it, all comments are non-blocking because they're mostly questions and ideas that could turn into improvements…
Let me know what you think and we can get this finally merged 🙂
type: 'problem', | ||
docs: { | ||
description: 'Disallow deprecated EUI imports.', | ||
category: 'Possible Errors', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[non-blocking] I couldn't find the category
props in the meta structure docs, is it needed?
meta: { | ||
type: 'problem', | ||
docs: { | ||
description: 'Disallow deprecated EUI imports.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rephrase this to something like "Discourage" or "Warn about", to me "disallow" sounds a bit authoritarian (I don't know if that makes sense 🙃)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@acstll that makes total sense 😄 I'll do that!
return { | ||
ImportDeclaration(node) { | ||
allPatterns.forEach(({ pattern, message }) => { | ||
const regex = new RegExp(pattern.replace('*', '.*')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to ask this because I'm not well-versed with globs — will this pattern.replace('*', '.*')
play nicely with any custom user patterns? (I think yes but I'm not sure)
@@ -0,0 +1,2 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[non-blocking] I think jest
will work without a config file (using the defaults?), maybe this file is not needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the same thing but couldn't run jest
without a config, maybe I was missing some param.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also wasn't sure, but it runs locally for me without it 🤔
Summary
I added a new rule to our ESLint plugin,
no-restricted-eui-imports
, that won't conflict with the inbuiltno-restricted-imports
rule and will allow us to define several error levels at once. I.e. we want some imports to be marked as warning and not an error, as it's done in Kibana.Context:
The JSON token imports in
@kbn/eslint/module_migration
need to be removed as well:https://github.com/elastic/kibana/blob/212b1926743ca5821992c2877d9c68f621e1875e/packages/kbn-eslint-config/.eslintrc.js#L131-L140
QA
yarn workspace @elastic/eslint-plugin-eui pack
"@elastic/eslint-plugin-eui": "file:path/to/the/package.tgz"
yarn
and bootstrap:yarn kbn bootstrap --no-validate
Unit tests:
yarn workspace @elastic/eslint-plugin-eui test