diff --git a/tests/lib/rules/camelcase.js b/tests/lib/rules/camelcase.js index eb80b4ef4d2..c8a3914e659 100644 --- a/tests/lib/rules/camelcase.js +++ b/tests/lib/rules/camelcase.js @@ -202,6 +202,11 @@ ruleTester.run("camelcase", rule, { { code: "__option_foo__ = 0;", options: [{ allow: ["__option_foo__"] }] + }, + { + code: "foo = { [computedBar]: 0 };", + options: [{ ignoreDestructuring: true }], + parserOptions: { ecmaVersion: 6 } } ], invalid: [ @@ -295,6 +300,17 @@ ruleTester.run("camelcase", rule, { } ] }, + { + code: "var foo = { bar_baz: boom.bam_pow }", + options: [{ ignoreDestructuring: true }], + errors: [ + { + messageId: "notCamelCase", + data: { name: "bar_baz" }, + type: "Identifier" + } + ] + }, { code: "foo.qux.boom_pow = { bar: boom.bam_pow }", errors: [ @@ -600,6 +616,16 @@ ruleTester.run("camelcase", rule, { } ] }, + { + code: "const { no_camelcased = foo_bar } = bar;", + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + message: "Identifier 'no_camelcased' is not in camel case.", + type: "Identifier" + } + ] + }, { code: "not_ignored_foo = 0;", options: [{ allow: ["ignored_bar"] }], @@ -619,6 +645,17 @@ ruleTester.run("camelcase", rule, { type: "Identifier" } ] + }, + { + code: "foo = { [computed_bar]: 0 };", + options: [{ ignoreDestructuring: true }], + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + message: "Identifier 'computed_bar' is not in camel case.", + type: "Identifier" + } + ] } ] });