简体   繁体   English

什么是ESLint规则以防止对象冒号后出现换行符

[英]What is the ESLint rule to prevent newline after an object prop colon

I searched and search on both SO and Google. 我搜索了SO和Google。 But I cannot find the rule to enforce this: 但是我找不到执行此规则的规则:

NOT OK 不好

const object = {
  methods:
  {
  }
}

OK

const object = {
  methods: {
  }
}

It seems to not be object-property-newline or object-curly-newline 它似乎不是对象属性换行对象卷曲换行

Edit: 编辑:

it also doesn't seem to be brace-style . 它似乎也不是大括号风格的

在此处输入图片说明

There is no rule for that. 没有规则。 You may propose this rule in to the eslint project, but I expect it would not be accepted. 您可以在eslint项目中提出该规则,但是我希望它不会被接受。

In the meanwhile eslint-plugin-prettier do cover this case, but it is not possible to opt-in only this case. 同时, eslint-plugin-prettier确实涵盖了这种情况,但是不可能仅选择加入这种情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 propTypes 对象、字符串和数组的问题是什么让 eslint 有这个规则:react/forbid-prop-types? - What is the problem with the propTypes object, string and array which makes eslint to have this rule: react/forbid-prop-types? 在花括号之前或之前防止空行的eslint规则的名称是什么? - what is the name of the eslint rule to prevent empty lines after or before a curly brace? eslint 规则禁止在赋值等于后换行(即 var foo =\\n 42) - eslint rule to disallow newline after equals in assignment (i.e. var foo =\n 42) ESLint - 对象卷曲换行符 - ESLint - object-curly-newline Eslint 对象属性换行符不起作用 - Eslint object-property-newline does not work ESLint:为一条规则运行 ESLint 和一条大规则 object - ESLint: Running ESLint for one rule with a big rule object 是否有 ESLint 规则来防止 `Promise<boolean> ` to `boolean` 强制转换</boolean> - Is there a ESLint rule to prevent `Promise<boolean>` to `boolean` cast 是否有 eslint 规则来防止在单行 if 语句中赋值? - Is there an eslint rule to prevent assignment in a single line if statement? Prettier/Eslint 在括号后保持换行符 - Prettier/Eslint maintain newline after bracket (ESLint) 未找到规则“re​​act/jsx-sort-prop-types”的定义 - (ESLint) Definition for rule 'react/jsx-sort-prop-types' was not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM