-
-
Notifications
You must be signed in to change notification settings - Fork 16
Description
When we make changes to this repo, we need to go into each of our other repos and add those changes to them as well. This is time-consuming and error-prone work, as it must be done manually. Automating such changes would ensure that all of our repos match the template.
In addition, our repos were created at different times and may be in various states of change. It is entirely possible that some repos do not match the template 100%, and currently, we have no way of knowing.
To address this, we should add a script to this repo which lints a project for consistency between that project and this template. If there are any files which are missing, or if there are any major differences in known files that are missing, then the script should report an error. Additionally there should be a --fix option similar to ESLint which will apply any changes which are auto-fixable. Then we can run this script across all of our projects (locally).
Note that we can make the script somewhat intelligent when it comes to certain kinds of files:
- For configuration files which contain JSON or JSON-compatible objects (
package.json, GitHub workflow files, etc.), we can determine a difference between objects rather than difference between lines. - For configuration files which export objects (
.eslintrc.js, etc.) we may have to write a codemod to parse the AST of the file, read the object being exported, determine a difference between objects, update the AST, then generate a new file. - For text-based files we could do a diff. If the diff applies cleanly then the file is autofixable, if not then the developer would have to apply that diff manually.