-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃彈 Ensure that forbidden term allowlists are updated #33490
Conversation
Hey @erwinmombay, @jridgewell! These files were changed:
|
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.
LGTM with one suggestion. Job well done!
// Terms are defined in this file. | ||
/* eslint-disable local/no-forbidden-terms */ | ||
|
||
// Ensures that file is up-to-date. | ||
/* eslint "local/forbidden-terms-config": 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.
For maintainability, would it make sense to move these two rules to a new file build-system/test-configs/.eslintrc.js
?
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.
Sure, moved. It also happens to speed up linting. File-level rules seem to only ignore reports, but still run.
TIMING=1 npx eslint build-system/test-configs/forbidden-terms.js
Rule | Time (ms)
:-----------------------------|----------:
prettier/prettier | 248.790
local/forbidden-terms-config | 34.043
- local/no-forbidden-terms | 30.997
+ jsdoc/check-types | 16.759
@@ -1235,8 +1103,6 @@ const forbiddenTermsSrcInclusive = { | |||
'extensions/amp-ad-network-adsense-impl/0.1/amp-ad-network-adsense-impl.js', | |||
'extensions/amp-iframe/0.1/amp-iframe.js', | |||
'extensions/amp-script/0.1/amp-script.js', | |||
'extensions/amp-sidebar/0.1/amp-sidebar.js', | |||
'extensions/amp-sidebar/0.2/amp-sidebar.js', |
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.
Bravo! I don't think this kind of a cleanup would've been possible (or would've ever happened) earlier.
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.
} | ||
} | ||
|
||
function* removeFromArray(fixer, node) { |
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 think you can just fixer.remove(node)
and let eslint automatically fix formatting?
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.
Unfortunately that won't remove the trailing comma nor the whitespace.
I also want to remove comments on the same line, since context for those is lost.
Adds a lint rule `local/forbidden-terms-config` that's used on one file: - Term keys should be string literals. - Allowlist items should be string literals. - Allowed files should contain the term. - `allowlist` property should be removed if empty.
Adds a lint rule
local/forbidden-terms-config
that's used on one file:allowlist
property should be removed if empty.