eslint: autofixes

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-04-10 08:26:51 +02:00
parent 5fad4d8186
commit 8e4082d9d6

View File

@ -1,4 +1,4 @@
(function () { (function() {
'use strict'; 'use strict';
const color = require('colors'); const color = require('colors');
@ -34,7 +34,7 @@ const defaultConfig = {
ecmaVersion: 2017, ecmaVersion: 2017,
ecmaFeatures: { ecmaFeatures: {
impliedStrict: true, impliedStrict: true,
} },
}, },
env: { env: {
browser: true, browser: true,
@ -105,7 +105,7 @@ const defaultConfig = {
"no-unsafe-finally": "error", "no-unsafe-finally": "error",
"no-unsafe-negation": "error", "no-unsafe-negation": "error",
"no-unused-labels": "error", "no-unused-labels": "error",
"no-unused-vars": ["error", { vars: "all", args: "none" } ], "no-unused-vars": ["error", { vars: "all", args: "none" }],
"no-useless-catch": "error", "no-useless-catch": "error",
"no-useless-escape": "error", "no-useless-escape": "error",
"no-with": "error", "no-with": "error",
@ -177,13 +177,13 @@ const defaultConfig = {
// stylistic issues, only warn, most can be auto-fixed // stylistic issues, only warn, most can be auto-fixed
// those are quite opinionated... // those are quite opinionated...
"array-bracket-spacing": [ "warn", "never" ], "array-bracket-spacing": ["warn", "never"],
"brace-style": [ "warn", "1tbs", { allowSingleLine: true }], "brace-style": ["warn", "1tbs", { allowSingleLine: true }],
"comma-dangle": [ "warn", "always-multiline" ], // maybe only-multiline? "comma-dangle": ["warn", "always-multiline"], // maybe only-multiline?
"comma-spacing": "warn", "comma-spacing": "warn",
"comma-style": "warn", "comma-style": "warn",
"computed-property-spacing": "warn", "computed-property-spacing": "warn",
"consistent-this": [ "warn", "me" ], "consistent-this": ["warn", "me"],
"eol-last": "warn", "eol-last": "warn",
"func-call-spacing": "warn", "func-call-spacing": "warn",
"func-name-matching": "warn", "func-name-matching": "warn",
@ -191,20 +191,20 @@ const defaultConfig = {
"key-spacing": "warn", "key-spacing": "warn",
"keyword-spacing": "warn", "keyword-spacing": "warn",
"linebreak-style": "warn", "linebreak-style": "warn",
"max-len": [ "warn", { code: 110, tabWidth: 8, ignoreComments: true, ignoreStrings: true, ignoreRegExpLiterals: true }], "max-len": ["warn", { code: 110, tabWidth: 8, ignoreComments: true, ignoreStrings: true, ignoreRegExpLiterals: true }],
"no-array-constructor": "warn", "no-array-constructor": "warn",
"no-lonely-if": "warn", "no-lonely-if": "warn",
"no-mixed-operators": "warn", "no-mixed-operators": "warn",
"no-multiple-empty-lines": "warn", "no-multiple-empty-lines": "warn",
"no-trailing-spaces": "warn", "no-trailing-spaces": "warn",
"no-underscore-dangle": [ "warn", { allowAfterThis: true, }], "no-underscore-dangle": ["warn", { allowAfterThis: true }],
"no-unneeded-ternary": "warn", "no-unneeded-ternary": "warn",
"no-whitespace-before-property": "warn", "no-whitespace-before-property": "warn",
"object-curly-newline": "warn", "object-curly-newline": "warn",
"object-curly-spacing": [ "warn", "always" ], "object-curly-spacing": ["warn", "always"],
"operator-linebreak" : [ "warn", "after", { overrides: { "?": "after" }}], "operator-linebreak": ["warn", "after", { overrides: { "?": "after" } }],
"padded-blocks": ["warn", "never"], // not sure ... "padded-blocks": ["warn", "never"], // not sure ...
"quote-props": [ "warn", "as-needed", { keywords: true, unnecessary: false }], // does nothing, maybe deactivate unnecessary "quote-props": ["warn", "as-needed", { keywords: true, unnecessary: false }], // does nothing, maybe deactivate unnecessary
"semi": "warn", "semi": "warn",
"semi-spacing": "warn", "semi-spacing": "warn",
"semi-style": "warn", "semi-style": "warn",
@ -229,8 +229,8 @@ if (program.config) {
path = process.cwd() + "/" + path; path = process.cwd() + "/" + path;
} }
config = { config = {
extends: path "extends": path,
} };
} }
const cli = new eslint.CLIEngine({ const cli = new eslint.CLIEngine({
@ -300,7 +300,7 @@ report.results.forEach(function(result) {
}); });
if (report.results.length > 1) { if (report.results.length > 1) {
console.log((`${color.bold(files_ok.length + files_err.length)} files:`)); console.log(`${color.bold(files_ok.length + files_err.length)} files:`);
if (files_err.length > 0) { if (files_err.length > 0) {
console.log(color.red(`${color.bold(files_err.length)} files have Errors`)); console.log(color.red(`${color.bold(files_err.length)} files have Errors`));
} }
@ -329,5 +329,4 @@ if (program.fix) {
} }
process.exit(exitcode); process.exit(exitcode);
}()); }());