Closed mattcollier closed 3 years ago
@mattcollier could you add a test for this here: https://github.com/digitalbazaar/eslint-config-digitalbazaar/blob/main/test/index.js
Also, the eslint docs suggest that the foo[some-baz]
rule requires a RegExp:
/*eslint camelcase: "error"*/
/*eslint dot-notation: ["error", { "allowPattern": "^[a-z]+(_[a-z]+)+$" }]*/
var data = {};
data.foo_bar = 42;
var data = {};
data["fooBar"] = 42;
var data = {};
data["foo_bar"] = 42; // no warning
@aljones15 you have presented some conflicting information here above. some-baz
does not require a special regex where some_baz
(underscore) does. I don't think our usage of foo['some_baz']
is common enough to warrant a global exception. I think these cases can be handled by eslint-disable-next-line
as needed.
I probably won't be adding test for this, would someone else like to take over?
@aljones15 you have presented some conflicting information here above.
some-baz
does not require a special regex wheresome_baz
(underscore) does. I don't think our usage offoo['some_baz']
is common enough to warrant a global exception. I think these cases can be handled byeslint-disable-next-line
as needed.I probably won't be adding test for this, would someone else like to take over?
My apologies about the mistake. I guess I'll add a test for your cases now. Do we want to error on: data['foo_bar']
? I believe I have seen that as a property in a JSON object before.
p.s. thank you for the work though.
ok so the remaining issue with this P.R. is we are allowing kebab-case
, but do we want to allow snake_case
? https://en.wikipedia.org/wiki/Snake_case?
Addresses: https://github.com/digitalbazaar/eslint-config-digitalbazaar/issues/46
https://eslint.org/docs/rules/dot-notation