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

feat: add linting rules for Vue components #70

Merged
merged 1 commit into from
Nov 11, 2021

Conversation

crgwbr
Copy link
Contributor

@crgwbr crgwbr commented Jun 15, 2021

No description provided.

@crgwbr
Copy link
Contributor Author

crgwbr commented Jun 15, 2021

Ping @yokuze

Copy link
Contributor

@yokuze yokuze left a comment

Choose a reason for hiding this comment

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

@crgwbr thanks for doing all of this! A few questions / comments.

'shouldMatchCase': true,
},
],
// 'vue/new-line-between-multi-line-property': 'off',
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these lines commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's been long enough that I don't remember for sure. But I think my purpose with the commented out lines was to note that we've considered the rule and chosen not to turn it on (vs. a rule not being listed at all, meaning we haven't thought about it yet).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's been long enough that I don't remember for sure. But I think my purpose with the commented out lines was to note that we've considered the rule and chosen not to turn it on (vs. a rule not being listed at all, meaning we haven't thought about it yet).

// 'vue/no-restricted-static-attribute': 'off',
// 'vue/no-restricted-v-bind': 'off',
// 'vue/no-static-inline-styles': 'off',
// 'vue/no-template-target-blank': 'TODO',
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you open a ticket for us to address the TODO rules here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done: #72

env: {
browser: true,
},
rules: Object.assign(
Copy link
Contributor

Choose a reason for hiding this comment

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

I ran these rules against one of our projects and I'm seeing these errors for every file:

1:1   error  Definition for rule 'vue/no-deprecated-v-is' was not found             vue/no-deprecated-v-is
1:1   error  Definition for rule 'vue/no-invalid-model-keys' was not found          vue/no-invalid-model-keys
1:1   error  Definition for rule 'vue/no-this-in-before-route-enter' was not found  vue/no-this-in-before-route-enter
1:1   error  Definition for rule 'vue/require-emit-validator' was not found         vue/require-emit-validator

All of the other rules seem to be executing fine. Any idea why? FWIW, I used npm link to test so maybe that's causing a problem somehow?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we disable the vue/no-multiple-template-root rule? I think it's "on" by default, but multiple template roots are a new feature in Vue 3, are there are legitimate use cases for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of the other rules seem to be executing fine. Any idea why? FWIW, I used npm link to test so maybe that's causing a problem somehow?

Yeah, I remember having issues testing this with npm link. I think it's related to differing versions of eslint / eslint-plugin-vue that' only resolve correctly with a real install. If we can get this merged and cut a beta release, I'll work on a MR to test using it.

Can we disable the vue/no-multiple-template-root rule? I think it's "on" by default, but multiple template roots are a new feature in Vue 3, are there are legitimate use cases for it.

@crgwbr
Copy link
Contributor Author

crgwbr commented Oct 26, 2021

^ Rebased from master to fix merge conflicts.

Copy link
Contributor

@yokuze yokuze left a comment

Choose a reason for hiding this comment

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

I think this is valuable enough as-is (before addressing the TODOs) for us to cut a beta and let @crgwbr test it out. We need to get something integrated before our Vue codebases continue to grow too much.

@onebytegone onebytegone merged commit 39acc37 into silvermine:master Nov 11, 2021
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.

3 participants