Commit d0fa5b72 authored by lauriii's avatar lauriii

Issue #2912961 by dawehner, droplet, drpal: Step 0 JS codestyle: Exclude non passing eslint rules

parent e9b77163
{
"extends": "./.eslintrc.json",
"rules": {
"no-var": "off",
"no-useless-escape": "off",
"no-useless-concat": "off",
"no-use-before-define": "off",
"no-throw-literal": "off",
"no-shadow": "off",
"no-restricted-syntax": "off",
"no-new": "off",
"no-multi-assign": "off",
"no-mixed-operators": "off",
"no-lonely-if": "off",
"no-empty": "off",
"no-continue": "off",
"no-confusing-arrow": "off",
"newline-per-chained-call": "off",
"new-cap": "off",
"max-len": "off",
"default-case": "off",
"comma-dangle": "off",
"camelcase": "off",
"array-callback-return": "off",
"vars-on-top": "off",
"prefer-rest-params": "off",
"padded-blocks": "off",
"prefer-const": "off"
}
}
......@@ -9,6 +9,8 @@
"watch:js": "node ./scripts/js/babel-es6-watch.js",
"watch:js-dev": "cross-env NODE_ENV=development node ./scripts/js/babel-es6-watch.js",
"lint:core-js": "node ./node_modules/eslint/bin/eslint.js --ext=.es6.js . || exit 0",
"lint:core-js-passing": "node ./node_modules/eslint/bin/eslint.js --quiet --config=.eslintrc.passing.json --ext=.es6.js . || exit 0",
"lint:core-js-stats": "node ./node_modules/eslint/bin/eslint.js --format=./scripts/js/eslint-stats-by-type.js --ext=.es6.js . || exit 0",
"lint:css": "stylelint \"**/*.css\" || exit 0",
"lint:css-checkstyle": "stylelint \"**/*.css\" --custom-formatter ./node_modules/stylelint-checkstyle-formatter/index.js || exit 0"
},
......
module.exports = function (results) {
results = results || [];
const errorType = {
warnings: {},
errors: {},
};
results.reduce((result, current) => {
current.messages.forEach((msg) => {
if (msg.severity === 1) {
errorType.warnings[msg.ruleId] = errorType.warnings[msg.ruleId] + 1 || 1
}
if (msg.severity === 2) {
errorType.errors[msg.ruleId] = errorType.errors[msg.ruleId] + 1 || 1
}
});
return result;
});
const reduceErrorCounts = (errorType) => Object.entries(errorType).sort((a, b) => b[1] - a[1])
.reduce((result, current) => result.concat([`${current[0]}: ${current[1]}`]), []).join('\n');
const warnings = reduceErrorCounts(errorType.warnings);
const errors = reduceErrorCounts(errorType.errors);
return `
Errors:
${'='.repeat(30)}
${errors}
${'\n'.repeat(4)}
Warnings:
${'='.repeat(30)}
${warnings}`;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment