Skip to content

Meta: Simplify magic variables and avoid possible duplicate injection - #4010

Merged
fregante merged 7 commits into
mainfrom
features-cleanup
Feb 22, 2021
Merged

fregante merged 7 commits into
mainfrom
features-cleanup

Conversation

@fregante

@fregante fregante commented Feb 22, 2021 •

Copy link
Copy Markdown
Member

Extracting some unrelated changes from #4009

  • Keep a simple array of feature names so they're easy to find
  • Instead of magic variables, use features.list and features.meta where available (don't import features/index.tsx in background/options though)

@fregante fregante added the meta Related to Refined GitHub itself label Feb 22, 2021
@fregante
fregante marked this pull request as ready for review February 22, 2021 04:16
Comment thread source/features/index.tsx Outdated
/* Feature filtering and running */
const options = await globalReady;
if (options[`feature:${id}`] === false) {
if (id !== __filebasename && !options[`feature:${id as unknown as string}`]) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This wasn't necessary before because the FeatureConfig type was string | boolean due to some TypeScript restrictions. The current code allows for correct types so XO correctly complained about this.

However index now needs its own check because options.['feature:index'] isn't false, but still falsy.

@fregante
fregante requested a review from yakov116 February 22, 2021 07:00
@fregante
fregante merged commit 028d402 into main Feb 22, 2021
@fregante
fregante deleted the features-cleanup branch February 22, 2021 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta Related to Refined GitHub itself

Development

Successfully merging this pull request may close these issues.

2 participants