1

I have written a custom ESLint rule as follows:

//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = {
    meta: {
        type: "suggestion",
        docs: {
            description: "Test Description",
            category: "Common",
            recommended: true,
            url: ""
        },
        fixable: "code",
        schema: [] // no options
    },
    create: function (context) {
        return {
            ClassDeclaration(node) {
            var data = ""// I want to pass value here from CMD
                if (node.id.name === data)
                {
                    context.report({
                                node: node,
                                message: "ESLint rule triggered"
                            });
                }
            }
        }
    }
}

And I am running ESLint for a Test.js file using following command in CMD.

npx eslint Test.js

Is there a way in which I can pass data to the rule from CMD while executing eslint command? I want to pass a value to the variable 'data' from

0 Answers0