Prettier / ESLint使用此行:
(contentType != null && contentType.indexOf('javascript') === -1)) {
并将其放入:
if (
response.status === 404 ||
(contentType != null &&
contentType.indexOf('javascript') === -1)
) {
我正在使用Webstorm,但是命令行输出是这样的:
$ eslint src
C:\Users\jtuzman\dev\...\front_end\src\serviceWorker.js
109:40 error Replace `·contentType.indexOf('javascript')·===·-1)` with `␍⏎····················contentType.indexOf('javascript')·===·-1)␍⏎············` prettier/prettier
✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the `--fix` option.
我已经对漂亮的配置进行了一些自定义(包括明确写出默认值):
module.exports = {
tabWidth: 4,
tabs: false,
semi: true,
singleQuote: true,
quoteProps: 'as-needed',
trailingComma: 'none',
bracketSpacing: true,
jsxBracketSameLine: true,
arrowParens: 'avoid'
};
但是我不知道这是关于什么规则的。也许这是一个定罪的规则。有人有主意吗?