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

New Add vue/new-line-between-multiline-property rule #1080

Conversation

IWANABETHATGUY
Copy link
Contributor

No description provided.

@IWANABETHATGUY IWANABETHATGUY changed the title Feature/new line between multi line property New Add vue/new-line-between-multiline-property rule Mar 18, 2020
@IWANABETHATGUY
Copy link
Contributor Author

complete #391

@ota-meshi
Copy link
Member

ota-meshi commented Mar 31, 2020

Thank you for this PR.

I don't want to add this rule now because I'm not convinced that this rule conflicts with other eslint and eslint-plugin rules.

@privatenumber
Copy link
Contributor

Very interested in this rule.

@ota-meshi What are the other rules this might conflict with?

If the merge-conflicts can be resolved, I have access to multiple large, internal Vue codebases I can test on.

@ota-meshi
Copy link
Member

ota-meshi commented Jun 24, 2020

At the very least, we should make sure that all the rules of ESLint core and their options don't conflict.
https://eslint.org/docs/rules/

Also, the style of object properties is not Vue.js-specific, so I think we need to check some of the other popular eslint-plugins as well.
https://github.com/dustinspecker/awesome-eslint

If find a conflicting rule, we should either fix this rule so that it doesn't conflict, or document a workaround.

@privatenumber
Copy link
Contributor

Thanks @ota-meshi

@IWANABETHATGUY do you have time to resolve the merge-conflicts?

@IWANABETHATGUY
Copy link
Contributor Author

Thanks @ota-meshi

@IWANABETHATGUY do you have time to resolve the merge-conflicts?
done

@privatenumber
Copy link
Contributor

privatenumber commented Jul 18, 2020

Was finally able to make the time to apply this onto two very large codebases, and the results are pretty much flawless.
It auto-fixed 1,048 out of 1,071 files in the larger codebase and I just manually reviewed all the changes.

There was an error with no-async-in-computed-properties, but I see that's fixed here: #1227

The only thing that I caught that seems unexpected is that it was applied to the contents of an unrelated static-method on the Vue component. It's not a big deal but it added new lines between an object that was inside the function.

From:

<script>
export default {
	...,
	errorCapture(err) {
		logError(err, {
			propA: {
				...
			},
			propB: {
				...
			},
		});
	},
	...
};
</script>

To:

<script>
export default {
	...,
	errorCapture(err) {
		logError(err, {
			propA: {
				...
			},

			propB: {
				...
			},
		});
	},
	...
};
</script>

On a separate note, I'm got to checkout a bunch of the new ESlint Vue rules and I'm very impressed with all the new features! Great work :)

@IWANABETHATGUY
Copy link
Contributor Author

Was finally able to make the time to apply this onto two very large codebases, and the results are pretty much flawless.
It auto-fixed 1,048 out of 1,071 files in the larger codebase and I just manually reviewed all the changes.

There was an error with no-async-in-computed-properties, but I see that's fixed here: #1227

The only thing that I caught that seems unexpected is that it was applied to the contents of an unrelated static-method on the Vue component. It's not a big deal but it added new lines between an object that was inside the function.

From:

<script>
export default {
	...,
	errorCapture(err) {
		logError(err, {
			propA: {
				...
			},
			propB: {
				...
			},
		});
	},
	...
};
</script>

To:

<script>
export default {
	...,
	errorCapture(err) {
		logError(err, {
			propA: {
				...
			},

			propB: {
				...
			},
		});
	},
	...
};
</script>

On a separate note, I'm got to checkout a bunch of the new ESlint Vue rules and I'm very impressed with all the new features! Great work :)

could you give me some test case, so that i could fix it.

@privatenumber
Copy link
Contributor

@IWANABETHATGUY

Added it here IWANABETHATGUY#1

Specific error-case here

@IWANABETHATGUY
Copy link
Contributor Author

@privatenumber , i add the callExpression test case, and you miss that , there should be a new line between props and staticMethodFn.

@privatenumber
Copy link
Contributor

privatenumber commented Jul 26, 2020

There is a new line ?

Thanks for the fix! I'll check it out soon.

Can you also pull in master please? There are some fixes in there that addresses a crash when I run eslint with your branch.

@IWANABETHATGUY
Copy link
Contributor Author

There is a new line ?

Thanks for the fix! I'll check it out soon.

Can you also pull in master please? There are some fixes in there that addresses a crash when I run eslint with your branch.

i merge the latest master branch and pass all test.

@IWANABETHATGUY
Copy link
Contributor Author

@ota-meshi Is it time to merge this feature ?

@ota-meshi
Copy link
Member

ota-meshi commented Jul 28, 2020

First of all, thank you for your help.
But did you make sure that there were no conflicts with all the rules of ESLint?
The fact that we was able to check it on large codebases is very helpful information, but I don't know if we could make sure there are no conflicts because I don't know which rules are enable in your repository.

lib/rules/new-line-between-multi-line-property.js Outdated Show resolved Hide resolved
lib/rules/new-line-between-multi-line-property.js Outdated Show resolved Hide resolved
lib/rules/new-line-between-multi-line-property.js Outdated Show resolved Hide resolved
lib/rules/new-line-between-multi-line-property.js Outdated Show resolved Hide resolved
lib/rules/new-line-between-multi-line-property.js Outdated Show resolved Hide resolved
lib/rules/new-line-between-multi-line-property.js Outdated Show resolved Hide resolved
lib/rules/new-line-between-multi-line-property.js Outdated Show resolved Hide resolved
docs/rules/new-line-between-multi-line-property.md Outdated Show resolved Hide resolved
tests/lib/rules/new-line-between-multi-line-property.js Outdated Show resolved Hide resolved
@privatenumber
Copy link
Contributor

@ota-meshi

I extend 'plugin:vue/recommended' with the following overrides:

{
		'vue/html-indent': ['error', 'tab', {
			alignAttributesVertically: false,
		}],
		'vue/html-self-closing': ['error', {
			html: {
				normal: 'never',
				void: 'always',
				component: 'always'
			},
			svg: 'always',
			math: 'always'
		}],
		'vue/max-attributes-per-line': ['error', {
			singleline: 0,
		}],
		'vue/html-closing-bracket-newline': ['error', {
			singleline: 'never',
			multiline: 'always',
		}],
		'vue/prop-name-casing': ['off'],
		'vue/no-v-html': ['off'],
}

@ota-meshi
Copy link
Member

@privatenumber Thank you for sharing it.
Does that mean you are not using any rules other than vue/*?
If you're not using any rules other than vue/*, probably not sure that we won't conflict with ESLint builtin rules.

@privatenumber
Copy link
Contributor

I use airbnb-config-base with it.

@ota-meshi
Copy link
Member

I wanted to know about that! Thank you.

@ota-meshi
Copy link
Member

ota-meshi commented Jul 28, 2020

I checked the rules in airbnb-config-base and found many rules are enabled. Also, I'm using eslint-config-standard and it works pretty well there too. So in most cases, I don't think there will be conflicts. Thank you for helping me with the check.

…into feature/new-line-between-multi-line-property
….com:IWANABETHATGUY/eslint-plugin-vue into feature/new-line-between-multi-line-property
….com:IWANABETHATGUY/eslint-plugin-vue into feature/new-line-between-multi-line-property
@IWANABETHATGUY
Copy link
Contributor Author

@ota-meshi could you please review again?

Copy link
Member

@ota-meshi ota-meshi 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 the late check.
Looks good to me! Thank you!

@ota-meshi ota-meshi merged commit 95fd13f into vuejs:master Dec 16, 2020
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.

None yet

3 participants