UNPKG

e-lado

Version:

[![CircleCI](https://circleci.com/gh/sharetribe/sharetribe/tree/master.svg?style=svg)](https://circleci.com/gh/sharetribe/sharetribe/tree/master) [![Dependency Status](https://gemnasium.com/sharetribe/sharetribe.png)](https://gemnasium.com/sharetribe/shar

44 lines (37 loc) 1.2 kB
/** * @fileoverview Rule to check for tabs inside a file * @author Gyandeep Singh */ "use strict"; //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ const regex = /\t/; //------------------------------------------------------------------------------ // Public Interface //------------------------------------------------------------------------------ module.exports = { meta: { docs: { description: "disallow all tabs", category: "Stylistic Issues", recommended: false }, schema: [] }, create(context) { return { Program(node) { context.getSourceLines().forEach((line, index) => { const match = regex.exec(line); if (match) { context.report({ node, loc: { line: index + 1, column: match.index + 1 }, message: "Unexpected tab character." }); } }); } }; } };