ni / javascript-styleguide

JavaScript and TypeScript Style Guide
MIT License
9 stars 9 forks source link

Evaluate the rules that were disabled after upgrading to ESLint 8. #112

Closed TrevorKarjanis closed 1 year ago

TrevorKarjanis commented 1 year ago

There were rules that were disabled or reconfigured to avoid breaking changes after upgrading to ESLint 8 in #104 . They need to be evaluated for the correct configurations.

jattasNI commented 1 year ago

default-case-last seems like a perfectly reasonable rule. It enforces that the default case should come last. Recommend we enforce this rule.

jattasNI commented 1 year ago

function-call-argument-newline with config set to consistent seems reasonable. This enforces that function call args should either all be on one line or each be on separate lines. Recommend we enforce this rule.

jattasNI commented 1 year ago

We lean towards setting function-paren-newline to multiline-arguments. Trevor verified that the cases it catches all seem like the rule would make the code more readable.

jattasNI commented 1 year ago

grouped-accessor-pairs seems reasonable. Nobody feels strongly about getBeforeSet or setBeforeGet so our initial recommendation is not to use either of those options.

jattasNI commented 1 year ago

import/no-import-module-exports seems reasonable. It enforces that you use only CommonJS imports/exports or ES imports/exports, not a mixture within the same file. Recommend we enforce this rule.

jattasNI commented 1 year ago

import/no-relative-packages seems reasonable. It enforces no relative path imports of packages (relative path imports of modules are still ok). We don't think anything would be violating it today but it would be good to double check.

jattasNI commented 1 year ago

no-promise-executor-return seems reasonable. It enforces that the function you pass to new Promise() should not return a value (it should call reject/resolve instead). Recommend we enforce this rule.

jattasNI commented 1 year ago

no-restricted-exports should remain off. Projects can configure it if they have specific export names they want to ban, but there aren't any that we want to ban globally.

jattasNI commented 1 year ago

no-unreachable-loop seems reasonable. It detects when all code paths within a loop return early, making the loop unnecessary. Recommend we enforce this rule.

jattasNI commented 1 year ago

no-unsafe-optional-chaining seems reasonable. It detects cases where the .? operator might result in undefined which isn't being handled. We should also enable disallowArithmeticOperators to prevent NaN from being accidentally unhandled.

jattasNI commented 1 year ago

no-useless-backreference sounds reasonable. It prevents useless parts of regular expressions. Recommend we enable it.

jattasNI commented 1 year ago

no-constructor-return seems reasonable. It prevents you from returning a value from a constructor. Recommend we enable it.

jattasNI commented 1 year ago

no-nonoctal-decimal-escape seems reasonable. Recommend we enable it.

jattasNI commented 1 year ago

prefer-exponentiation-operator seems reasonable. In the rare cases where we do exponentiation, prefer a consistent ** syntax rather than Math.pow(). Recommend we enable it.

jattasNI commented 1 year ago

prefer-regex-literals seems reasonable. We prefer literals over the RexExp() constructor. Recommend we enable it.