Sha256: 30c82796957e494c9a346de336053bd94fe03f4f17309a3ba5cb67492c771424

Contents?: true

Size: 1.36 KB

Versions: 43

Compression:

Stored size: 1.36 KB

Contents

/**
 * @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,
            url: "https://eslint.org/docs/rules/no-tabs"
        },
        schema: []
    },

    create(context) {
        return {
            Program(node) {
                context.getSourceCode().getLines().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."
                        });
                    }
                });
            }
        };
    }
};

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
govuk_publishing_components-18.0.0 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.21.0 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.20.0 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.19.1 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.19.0 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.18.0 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.17.0 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.16.0 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.15.0 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.14.0 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.13.0 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.12.2 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.12.1 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.12.0 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.11.0 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.10.0 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.9.0 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.8.0 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.7.0 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js
govuk_publishing_components-17.6.1 node_modules/standard/node_modules/eslint/lib/rules/no-tabs.js