Sha256: f3dedd7930fbc3bdccbcc00b93e291a02cae1523034288a830808204cbb0b166
Contents?: true
Size: 945 Bytes
Versions: 2
Compression:
Stored size: 945 Bytes
Contents
/** * @fileoverview Rule to disallow a duplicate case label. * @author Dieter Oberkofler * @author Burak Yigit Kaya * @copyright 2015 Dieter Oberkofler. All rights reserved. * @copyright 2015 Burak Yigit Kaya. All rights reserved. */ "use strict"; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ module.exports = function(context) { return { "SwitchStatement": function(node) { var mapping = {}; node.cases.forEach(function(switchCase) { var key = context.getSource(switchCase.test); if (mapping[key]) { context.report(switchCase, "Duplicate case label."); } else { mapping[key] = switchCase; } }); } }; }; module.exports.schema = [];
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
eslint_node_modules-1.6.0.1 | vendor/node_modules/eslint/lib/rules/no-duplicate-case.js |
eslint_node_modules-1.6.0 | vendor/node_modules/eslint/lib/rules/no-duplicate-case.js |