eslint-plugin-no-switch-statements
Version:
An ESLint rule to disallow switch statements
31 lines (27 loc) • 741 B
JavaScript
/**
* @fileoverview Rule to disallow switch statements
* @author Andreas Wiedel
*/
;
const create = function (context) {
function reportSwitchStatement(node) {
context.report({
node,
message: 'Unallowed use of `switch` statement'
});
}
return {
SwitchStatement: reportSwitchStatement
};
};
module.exports = {
create,
meta: {
docs: {
description: 'prevent the usage of switch statements',
category: 'Best Practices',
recommended: 'error',
url: 'https://github.com/Kaishiyoku/eslint-plugin-no-switch-statements/tree/master/docs/rules/no-switch.md'
}
}
};