Object Shorthand conflicts with func-names
See original GitHub issueTell us about your environment
├─ @vue/cli-plugin-eslint@3.11.0
│ └─ eslint@4.19.1
└─ eslint@6.1.0
- Node Version: v12.6.0
- npm Version: 6.9.0
What parser (default, Babel-ESLint, etc.) are you using? babel Please show your full configuration:
Configuration
{
"plugins": [
"vue"
],
"extends": [
"plugin:vue/recommended",
"airbnb-base",
"plugin:prettier/recommended",
"prettier/vue"
],
"env": {
"jest": true
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2018
},
"globals": {
"App": true
},
"settings": {
"import/extensions": [
".vue"
],
"import/resolver": {
"node": {
"paths": ["app/javascript"],
"extensions": [".js", ".vue"]
}
}
},
"rules": {
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
"no-underscore-dangle": ["error", { "allow": ["_underlying_vm_", "_componentTag"] }],
"no-return-assign": ["error", "except-parens"],
"no-restricted-properties": "off",
"import/prefer-default-export": "off",
"no-shadow": "off",
"no-unused-expressions": "off",
"no-param-reassign": ["error", { "props": false }],
"quotes": ["error", "single"],
"max-len": ["error", {
"code": 130,
"ignoreComments": true,
"ignoreUrls": true
}],
"vue/max-attributes-per-line": [
2,
{
"singleline": 20,
"multiline": {
"max": 1,
"allowFirstLine": false
}
}
]
}
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
'$route.query': function() {
this.fetchData();
},
║ 239 │ 21 │ warning │ Unexpected unnamed method '$route.query'. │ func-names ║
'$route.query'() {
this.fetchData();
},
║ Line │ Column │ Type │ Message │ Rule ID ║
╟──────────┼──────────┼──────────┼────────────────────────────────────────────────────────┼──────────────────────╢
║ 239 │ 5 │ error │ Expected longform method syntax for string literal │ object-shorthand ║
║ │ │ │ keys. │ ║
eslint --ext .js,.vue app/javascript
What did you expect to happen?
What actually happened? Please include the actual, raw output from ESLint.
Are you willing to submit a pull request to fix this bug? yes
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (9 by maintainers)
Top Results From Across the Web
Object Shorthand conflicts with func-names #2081 - GitHub
The dot means you can't just remove the quotes; this seems like a bug in the core eslint rule (whose name i don't...
Read more >eslint object-shorthand error with variable passed in
An excerpt from eslint regarding the issue: Require Object Literal Shorthand Syntax (object-shorthand) - Rule Details.
Read more >object-shorthand - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >9. Classes — Python 3.11.1 documentation
As in Modula-3, there are no shorthands for referencing the object's ... in the expression modname.funcname , modname is a module object and...
Read more >List of available rules - ESLint - Pluggable JavaScript linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
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
The option doesn’t enforce unquoted property names (this isn’t the
quote-props
rule), it disallows shorthands with quoted names.Rules are configured to enforce this code:
If you want to allow the following:
then set the
avoidQuotes
option tofalse
.@ljharb No. I just talked about the current behavior.