How to make `max-attributes-per-line` work only when over maximum line length
See original GitHub issueTell us about your environment
- ESLint Version:
4.16.0
- eslint-plugin-vue Version:
4.2.0
- Node Version:
9.2.0
Please show your full configuration:
.eslintrc.js
module.exports = {
extends: [
'standard',
'plugin:vue/recommended',
'prettier',
],
plugins: ['prettier'],
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module',
},
env: {
browser: true,
jest: true,
},
rules: {
'prettier/prettier': 'error',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? ['error'] : ['warn'],
'no-param-reassign': ['error', { props: false }],
'vue/html-closing-bracket-newline': [
'error',
{
singleline: 'never',
multiline: 'always',
},
],
'vue/html-closing-bracket-spacing': [
'error',
{
startTag: 'never',
endTag: 'never',
selfClosingTag: 'always',
},
],
},
}
What did you do? Please include the actual source code causing the issue.
<MyComponent lorem="1" ipsum="2" />
<MyComponent lorem="1" ipsum="2" @click="longlonglonglonglonglongFunctionName" @change="longlonglonglonglonglongFunctionName2" />
What did you expect to happen?
What i want is max-attributes-per-line
rule should be available only when over maximum line length option, like printWidth
defined in prettier.
For example, I set printWidth: 80
in prettier:
<MyComponent lorem="1" ipsum="2" />
<MyComponent
lorem="1"
ipsum="2"
@click="longlonglonglonglonglongFunctionName"
@change="longlonglonglonglonglongFunctionName2"
/>
What actually happened? Please include the actual, raw output from ESLint.
As the default value of multilple
option in max-attributes-per-line
rule is 1
, so the output will be:
<MyComponent
lorem="1"
ipsum="2"
/>
<MyComponent
lorem="1"
ipsum="2"
@click="longlonglonglonglonglongFunctionName"
@change="longlonglonglonglonglongFunctionName2"
/>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How to disable eslint rule max line length for paragraph in ...
Is there a way to disable lint for paragraph text like above? Also, how to increase the line length from 100 to 120?...
Read more >vue/max-len
This rule enforces a maximum line length to increase code readability and maintainability. This rule is the similar rule as core max-len ...
Read more >Maximum line length restriction - Discussions on Python.org
As per PEP, the maximum line length is still 79. Its time to update this. ... okay to occasionally go over the limit...
Read more >max-line-length - Stylelint
Lines that exceed the maximum length but contain no whitespace (other than at the beginning of the line) are ignored. When evaluating the...
Read more >The Black code style - Black 22.12.0 documentation
I hope some of the examples above show you that there are many ways in which you can do it. Line length#. You...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since the value of attributes is statements or expressions, so it’s difficult to work together with other whitespace rules in ESLint.
Closing as no plan to add the option for now.
use prettier