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

fix(prefer-arrow-functions): Allow allowStandaloneDeclarations by default #1719

Merged

Conversation

hyperupcall
Copy link
Contributor

@hyperupcall hyperupcall commented Aug 3, 2023

PR Checklist

Overview

Change the default of prefer-arrow/prefer-arrow-functions so allowStandaloneDeclarations is enabled.

@hyperupcall hyperupcall changed the title fix(prefer-arrow-functions): Allow allowStandaloneDeclarations by d… fix(prefer-arrow-functions): Allow allowStandaloneDeclarations by default Aug 3, 2023
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Sorry for marking the issue as accepted without resolving the discussion - looks like the option is opt-in? But thanks for getting started!

@@ -17,6 +17,11 @@ export const convertOnlyArrowFunctions: RuleConverter = (tslintRule) => {
rules: [
{
...(notices.length !== 0 && { notices }),
ruleArguments: [
{
allowStandaloneDeclarations: true,
Copy link
Member

Choose a reason for hiding this comment

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

I poked through the issue (what a throwback!) and TristonJ/eslint-plugin-prefer-arrow#16 as you'd linked - thanks for the info. It look to me like allowStandaloneDeclarations should only be output if "allow-declarations" is in the original rule. And we can get rid of the "ESLint does not support allowing standalone function declarations." notice.

@JoshuaKGoldberg JoshuaKGoldberg added the status: waiting for author The PR author should address requested changes label Aug 3, 2023
@hyperupcall
Copy link
Contributor Author

You're right - the property is opt-in - that's my mistake. The new logic fixes the conversion result

@JoshuaKGoldberg JoshuaKGoldberg removed the status: waiting for author The PR author should address requested changes label Oct 9, 2023
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

🆒 thanks!

@JoshuaKGoldberg JoshuaKGoldberg merged commit a8266de into typescript-eslint:main Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

prefer-arrow/prefer-arrow-function: prefer arrow to allow top level named functions as default
2 participants