Skip to content

Instantly share code, notes, and snippets.

@briangonzalez
Last active December 14, 2017 19:26
Show Gist options
  • Save briangonzalez/9a2cbb8ac3840f7b8ee9a223e11348f7 to your computer and use it in GitHub Desktop.
Save briangonzalez/9a2cbb8ac3840f7b8ee9a223e11348f7 to your computer and use it in GitHub Desktop.

Revisions

  1. briangonzalez revised this gist Dec 14, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion index.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    const checkAndReport (token, correct, context) {
    if (token.toLowerCase().includes(correct.toLowerCase() && !token.includes(correct))) {
    if (token.toLowerCase().includes(correct.toLowerCase()) && !token.includes(correct))) {
    context.report(node, `The standard variable casing is "${correct}", not ${node.id.name}`);
    }
    }
  2. briangonzalez created this gist Dec 14, 2017.
    20 changes: 20 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    const checkAndReport (token, correct, context) {
    if (token.toLowerCase().includes(correct.toLowerCase() && !token.includes(correct))) {
    context.report(node, `The standard variable casing is "${correct}", not ${node.id.name}`);
    }
    }

    module.exports.rules = {
    "paypal-casing": context => ({
    VariableDeclarator: (node) => {
    checkAndReport(node.id.name, 'Paypal', context)
    }
    }),

    "braintree-casing": context => ({
    VariableDeclarator: (node) => {
    checkAndReport(node.id.name, 'Braintree', context)
    }
    })

    };