-
-
Notifications
You must be signed in to change notification settings - Fork 8
node
first, test
second
#6
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
Comments
@ChristianMurphy What do you think of this? Example usevar is = require('unist-util-is')
var node = {type: 'strong'}
var parent = {type: 'paragraph', children: [node]}
is() // => false
is({children: []}) // => false
is(node) // => true
is(node, 'strong') // => true
is(node, 'emphasis') // => false
is(node, node) // => true
is(parent, {type: 'paragraph'}) // => true
is(parent, {type: 'strong'}) // => false
is(node, test) // => false
is(node, test, 4, parent) // => false
is(node, test, 5, parent) // => true
function test(node, n) {
return n === 5
} Reasoning:
Downside:
|
An interesting idea 🤔 It seems like it may overlap a bit with https://github.com/tc39/proposal-pattern-matching
It makes sense to bring these in alignment.
I've typically created the test as it's own named function. To me: is(test, node);
is(node, test); are pretty close in readability. 🤷♂️ I can see where a more complex condition, put inline could make putting the test after more attractive. is((n) => {
/* some
* complex
* conditionals */
},
node
)
is(node, (n) => {
/* some
* complex
* conditionals */
}
)
There may be an opportunity to create a code mod to help people upgrade. E.G. from the react community https://github.com/reactjs/react-codemod |
Another thing that gives me pause, there are 62 packages that would need to be updated https://github.com/syntax-tree/unist-util-is/network/dependents?dependent_type=PACKAGE Which is partly why I'd be interested in a code mod. |
I made a list of the 13 projects under syntax-tree that are using this, and they can almost all be moved to I think code mods are interesting, but wonder how much time would go into creating and managing them? Makes sense for big user-facing stuff like React of course, but as the unified collective (except for MDX) is so low level and changes are infrequent... |
Makes sense
Semi-related, would there be interest in leveraging https://dependabot.com or https://renovatebot.com to help automate part of the process? |
Closes GH-6. Closes GH-8. Reviewed-by: Christian Murphy <[email protected]>
Yes! But it has to not be annoying! I switched to use greenkeeper everywhere, before, but that made PRs for everything, all the time. I’m maintaining about 400 projects and if I update remark-cli I don’t want to deal with 400 PRs 😅 I believe renovatebot (and maybe dependabot, or even greenkeeper now) have better support from the setup I saw you use, such as sending PRs every X span of time? Mostly I think I’d be interest in something that only checks dependencies, not dev-dependencies. Is that possible? |
It is, it could look something like {
"extends": [
"config:base",
":preserveSemverRanges", // keep ~ and ^ ranges
"schedule:weekly" // only open PRs early monday morning
],
"devDependencies": {
"enabled": false // don't auto update dev dependencies
}
} There'd also be the option to group PRs from Unified repos. {
"extends": [
"config:base",
":preserveSemverRanges", // keep ~ and ^ ranges
"schedule:weekly" // only open PRs early monday morning
],
"devDependencies": {
"enabled": false // don't auto update dev dependencies
},
"packageRules": [ // group unified project dependencies together
{
"groupName": "unified",
"packagePatterns": [
"^unified"
]
},
{
"groupName": "remark",
"packagePatterns": [
"^remark"
]
},
{
"groupName": "rehype",
"packagePatterns": [
"^rehype"
]
},
{
"groupName": "redot",
"packagePatterns": [
"^redot"
]
}
]
} there'd also be the option to create a |
Dependabot allows for scheduling update PRs to be opened weekly. |
@wooorm What would be the next step for this? |
So here are my thoughts, what do you think? I’d say try it out for a month and circle back how it went?! We could start out in just one org, syntax-tree, try a config in a repo there (could we use |
Unist utilities operate on nodes. Makes more sense passing the Node first. Then the test. Optionally other stuff.
The text was updated successfully, but these errors were encountered: