2 * @fileoverview Rule to flag use of a leading/trailing decimal point in a numeric literal
3 * @author James Allardice
8 //------------------------------------------------------------------------------
10 //------------------------------------------------------------------------------
12 module.exports = function(context) {
15 "Literal": function(node) {
17 if (typeof node.value === "number") {
18 if (node.raw.indexOf(".") === 0) {
19 context.report(node, "A leading decimal point can be confused with a dot.");
21 if (node.raw.indexOf(".") === node.raw.length - 1) {
22 context.report(node, "A trailing decimal point can be confused with a dot.");