UNPKG

eslint-plugin-no-credentials

Version:
161 lines (158 loc) 3.74 kB
"use strict"; var _eslint = require("eslint"); var _ = require("./.."); var rule = _.rules['no-credentials']; var ruleTester = new _eslint.RuleTester({ env: { es6: true } }); ruleTester.run('no-credentials', rule, { invalid: [{ code: "\n // foo bar baz averylongstring\n", errors: [{ messageId: 'tooHighEntropy' }], options: [] }, { code: "\n /* foo bar baz averylongstring */\n", errors: [{ messageId: 'tooHighEntropy' }], options: [] }, { code: "\n // foo bar baz\n // averylongstring\n", errors: [{ messageId: 'tooHighEntropy' }], options: [] }, { code: "\n const text = 'foo bar baz averylongstring';\n", errors: [{ messageId: 'tooHighEntropy' }], options: [] }, { code: "\n const text = \"foo bar baz averylongstring\";\n", errors: [{ messageId: 'tooHighEntropy' }], options: [] }, { code: "\n const text = `foo bar baz averylongstring`;\n", errors: [{ messageId: 'tooHighEntropy' }], options: [] }, { code: "\n const text = 'foo bar baz a-very-long-string';\n", errors: [{ messageId: 'tooHighEntropy' }], options: [] }, { code: "\n const text = 'foo bar baz aVeryLongString';\n", errors: [{ messageId: 'tooHighEntropy' }], options: [] }, { code: "\n const text = 'foo bar baz aVeryLongString';\n", errors: [{ messageId: 'tooHighEntropy' }], options: [{ minimumNumberOfWords: 8, shouldSplitCamelCase: true }] }, { code: "\n const text = 'foo bar baz aVeryLongString';\n", errors: [{ messageId: 'tooHighEntropy' }], options: [{ minimumNumberOfWords: 6, minimumWordLength: 4, shouldSplitCamelCase: true }] }, { code: "\n const source = 'ABCDEF';\n", errors: [{ messageId: 'tooHighEntropy' }], options: [{ delimiters: [' ', '/', '-', '_', '.'], maximumEntropy: 4, minimumWordLength: 5, shouldSplitCamelCase: true }] }], valid: [{ code: "\n // foo bar baz\n", options: [] }, { code: "\n /* foo bar baz */\n", options: [] }, { code: "\n // foo bar baz\n // foo bar baz\n", options: [] }, { code: "\n const text = 'foo bar baz';\n", options: [] }, { code: "\n const text = \"foo bar baz\";\n", options: [] }, { code: "\n const text = `foo bar baz`;\n", options: [] }, { code: "\n const number = 123;\n", options: [] }, { code: "\n const text = 'foo bar baz a-very-long-string';\n", errors: [{ messageId: 'tooHighEntropy' }], options: [{ delimiters: [' ', '-'] }] }, { code: "\n const text = 'foo bar baz aVeryLongString';\n", errors: [{ messageId: 'tooHighEntropy' }], options: [{ shouldSplitCamelCase: true }] }, { code: "\n const text = 'foo bar baz aVeryLongString';\n", errors: [{ messageId: 'tooHighEntropy' }], options: [{ minimumNumberOfWords: 7, shouldSplitCamelCase: true }] }, { code: "\n const text = 'foo bar baz aVeryLongString';\n", errors: [{ messageId: 'tooHighEntropy' }], options: [{ minimumNumberOfWords: 5, minimumWordLength: 4, shouldSplitCamelCase: true }] }, { code: "\n const source = 'ABCDEF';\n", errors: [{ messageId: 'tooHighEntropy' }], options: [{ delimiters: [' ', '/', '-', '_', '.'], maximumEntropy: 5, minimumWordLength: 5, shouldSplitCamelCase: true }] }] });