Skip to content
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

Part 2 of task context refactoring #372

Merged
merged 9 commits into from
May 4, 2020
Merged

Part 2 of task context refactoring #372

merged 9 commits into from
May 4, 2020

Conversation

scalvert
Copy link
Contributor

@scalvert scalvert commented May 4, 2020

This adds the ability to pass task options from the config through to the task, and have the task correctly pluck off the options. It also changes the overall structure of task options to better match those of eslint and others.

The new Config structure is:

type CheckupConfig = {
    plugins: string[];
    tasks: {
        [fullyQualifiedTaskName: string]: "on" | "off" | ["on" | "off", unknown];
    };
}

As seen above, a task config can contain either

  • a string that denotes whether it's enabled or disabled ("on"/"off" respectively)
  • a tuple of string and unknown, where the string denotes whether it's enabled or disabled ("on"/"off" respectively), and the unknown value is the options to be passed to the task.

The task will only parse the options it owns; it won't parse any other config values for any other tasks, thus limiting the reach tasks have into one another's configs.

Examples

An example of disabling a configured task would be:

{
  "plugins": ["checkup-plugin-ember"],
  "tasks": {
	"ember/ember-types": "off"
  }
}

An example of passing options to a configured task would be:

{
  "plugins": ["checkup-plugin-ember"],
  "tasks": {
	"ember/ember-types": ["on", { "check-mixins": true }]
  }
}

TODO:

  • Update config loading to normalize plugin names to checkup-plugin-*, so that configs can eliminate the need to specify the fully qualified plugin name.
  • Pass in plugin name to task, so it can use the fully qualified plugin name to look up it's config, eg. ember/ember-types, where ember is checkup-plugin-ember

@scalvert scalvert changed the title Part 2 of task context refactoring WIP - Part 2 of task context refactoring May 4, 2020
@scalvert scalvert requested review from rwjblue and carakessler May 4, 2020 19:17
scalvert and others added 8 commits May 4, 2020 12:46
Co-authored-by: Robert Jackson <me@rwjblue.com>
Co-authored-by: Robert Jackson <me@rwjblue.com>
Co-authored-by: Robert Jackson <me@rwjblue.com>
Co-authored-by: Robert Jackson <me@rwjblue.com>
Co-authored-by: Robert Jackson <me@rwjblue.com>
@scalvert
Copy link
Contributor Author

scalvert commented May 4, 2020

I'm going to roll those TODOs over into a separate PR, to keep the scope of the PRs small.

@scalvert scalvert changed the title WIP - Part 2 of task context refactoring Part 2 of task context refactoring May 4, 2020
@scalvert scalvert merged commit 7e3f3e3 into master May 4, 2020
@scalvert scalvert deleted the task-context-part-2 branch May 4, 2020 20:35
@scalvert scalvert added the internal Internal infrastructure work label May 5, 2020
@scalvert scalvert added this to the MVP milestone May 5, 2020
@scalvert scalvert linked an issue May 5, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Internal infrastructure work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to provide options to tasks via config
2 participants