Enable more eslint recommended rules (#11168)

* chore: enable no-constant-condition

* chore: enable no-empty rule

* chore: enable no-unreachable

* chore: enable no-cond-assign

* chore: enable no-inner-declarations

* chore: remove disabled rules that are not in eslint:recommended

* fix: oops
This commit is contained in:
Huáng Jùnliàng
2020-02-24 19:04:25 -05:00
committed by GitHub
parent 2d1bac9666
commit afb0f489de
6 changed files with 184 additions and 198 deletions

View File

@@ -20,10 +20,9 @@ export function shareCommentsWithSiblings() {
const next = this.getSibling(this.key + 1);
const hasPrev = Boolean(prev.node);
const hasNext = Boolean(next.node);
if (hasPrev && hasNext) {
} else if (hasPrev) {
if (hasPrev && !hasNext) {
prev.addComments("trailing", trailing);
} else if (hasNext) {
} else if (hasNext && !hasPrev) {
next.addComments("leading", leading);
}
}

View File

@@ -62,6 +62,7 @@ export default class Renamer {
// retain the `name` of a class/function declaration
// eslint-disable-next-line no-unreachable
if (!path.isFunctionDeclaration() && !path.isClassDeclaration()) return;
if (this.binding.kind !== "hoisted") return;
@@ -83,6 +84,7 @@ export default class Renamer {
// retain the `name` of a class/function expression
// eslint-disable-next-line no-unreachable
if (!path.isFunctionExpression() && !path.isClassExpression()) return;
if (this.binding.kind !== "local") return;