Skip to content

Instantly share code, notes, and snippets.

@kexline4710
Created November 16, 2022 15:23
Show Gist options
  • Save kexline4710/ac641696da94b5a08f16a928115543b4 to your computer and use it in GitHub Desktop.
Save kexline4710/ac641696da94b5a08f16a928115543b4 to your computer and use it in GitHub Desktop.
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Enforce Brandon and Ashlynn as unified function",
recommended: true,
url: "https://eslint.org/docs/rules/together-forever"
},
schema: []
},
create: (context) => ({
FunctionDeclaration(node) {
if (node.id.name === "brandon") {
context.report({
node: node,
message: "Append this function with 'AndAshlynn'"
})
}
}
}
};
@kexline4710
Copy link
Author

kexline4710 commented Nov 16, 2022

Hi lovely reviewers! My goal is to make a cute and (mostly) valid custom eslint rule into a print as a small gift for B and A's wedding. I'm trying to keep it simple and under 25 lines. This proposed rule hypothetically enforces any brandon() function be appended with AndAshlynn. I know the CallExpression and ArrowFunctionExpression nodes are also relevant, but didn't add those for brevity.

Reviewer Asks

  • Did I capture the required options in a custom eslint rule? Should I add or remove anything?
  • Do you know of any styling preferences he has around quotations/indentations/other? PUT YOUR NITPICKY BRANDON HATS ON. Is there aannnnnyyyything here that would bother the crap out of him?
  • Long shot, but do you happen to know any details about his terminal styling? I can picture it in my head, but will likely just go with a dark mode styling (dark charcoal background, light foreground) if I don't have those details.
  • Anything else you suggest I adjust? Or even a different and better type of rule?

Thanks!

@atareshawty
Copy link

I added this to the herbie web project and needed to fix a small syntax error ⬇️

'use strict';

module.exports = {
	meta: {
		type: 'suggestion',
		docs: {
			description: 'Enforce Brandon and Ashlynn as unified function',
			recommended: true,
			url: 'https://eslint.org/docs/rules/together-forever',
		},
		schema: [],
	},
	create: (context) => ({
		FunctionDeclaration: (node) => {
			if (node.id.name === 'brandon') {
				context.report({
					node,
					message: "Append this function with 'AndAshlynn'",
				});
			}
		},
	}),
};

@sullivanashton
Copy link

sullivanashton commented Nov 16, 2022

I LOVE THIS SO MUCH 😍

Do you know of any styling preferences he has around quotations/indentations/other? PUT YOUR NITPICKY BRANDON HATS ON. Is there aannnnnyyyything here that would bother the crap out of him?

If you compare this to Brandon's published eslint config, I think you're all set! He's a pretty big comment guy, so it might fun to slip one in there somewhere? (or maybe a TODO 🤔 )

Long shot, but do you happen to know any details about his terminal styling? I can picture it in my head, but will likely just go with a dark mode styling (dark charcoal background, light foreground) if I don't have those details.

Based on the pics I sent in the text thread, my guess is that he uses a portion of the One Dark Pro theme?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment