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

Support max-len in Vue components #1272

Closed
wants to merge 7 commits into from
5 changes: 4 additions & 1 deletion packages/eslint-plugin-x/lib/configs/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ module.exports = {
curly: ['error', 'all'],
eqeqeq: ['error', 'always', { null: 'ignore' }],
indent: 'off',
'max-len': ['error', { code: 100, ignoreComments: false, ignorePattern: 'class=".*"$' }],
'max-len': [
'error',
{ code: 100, ignoreStrings: true, ignoreTemplateLiterals: true, ignoreUrls: true }
],
'no-alert': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
Expand Down
12 changes: 11 additions & 1 deletion packages/eslint-plugin-x/lib/configs/vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,17 @@ module.exports = {
'vue/component-tags-order': 'warn',
'vue/v-on-function-call': 'error',
'vue/v-slot-style': 'off',
'vue/valid-v-slot': 'warn'
'vue/valid-v-slot': 'warn',
'vue/max-len': [
'error',
{
code: 100,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreUrls: true,
ignoreHTMLAttributeValues: true
}
]
}
}
};
15 changes: 1 addition & 14 deletions packages/x-components/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,7 @@ module.exports = {
},
overrides: [
{
files: 'src/**/*.vue',
rules: {
'max-len': [
'error',
{
code: 100,
ignoreComments: false,
ignorePattern: '|class=".*"$ |https://github'
}
]
}
},
Comment on lines -15 to -26
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As we are disabling the entire max-len rule for vue components, in order to use vue/max-len one, we get rid of this config here.

{
files: 'src/components/icons/*.vue',
Comment on lines -27 to -28
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need to specify disabling max-len for icon files, as we are doing it globally

files: ['*.vue'],
rules: {
'max-len': 'off'
}
Comment on lines 16 to 18
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the only way I found to effectively disable max-len, I tried in eslint-x plugin file but it didn't have effect

Expand Down
1 change: 0 additions & 1 deletion packages/x-components/src/views/home/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@
</template>

<script lang="ts">
/* eslint-disable max-len */
import Vue from 'vue';
import { Component } from 'vue-property-decorator';
import { animateClipPath } from '../../components/animations/animate-clip-path/animate-clip-path.factory';
Expand Down
2 changes: 0 additions & 2 deletions packages/x-components/src/views/home/aside.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@
</template>

<script lang="ts">
/* eslint-disable max-len */
import {
EditableNumberRangeFacet,
EditableNumberRangeFilter,
Expand All @@ -156,7 +155,6 @@
import SlicedFilters from '../../x-modules/facets/components/lists/sliced-filters.vue';
import SortedFilters from '../../x-modules/facets/components/lists/sorted-filters.vue';
import { HomeControls } from './types';
/* eslint-enable max-len */

@Component({
components: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { SnippetConfig } from '../../../x-installer/api/api.types';
import { taggingXModule } from '../x-module';
import { TaggingConfig } from '../config.types';
/* eslint-disable max-len */

/**
* This component enables and manages the sending of information to the
* [Empathy Tagging API](https://docs.empathy.co/develop-empathy-platform/api-reference/tagging-api.html).
Expand Down