#12076 Fix invalid `setter` parse

Merged fisker Cheung fisker
Coverage Reach
packages/babel-parser/src/plugins/flow.js packages/babel-parser/src/plugins/typescript/index.js packages/babel-parser/src/plugins/typescript/scope.js packages/babel-parser/src/plugins/jsx/index.js packages/babel-parser/src/plugins/jsx/xhtml.js packages/babel-parser/src/plugins/estree.js packages/babel-parser/src/plugins/placeholders.js packages/babel-parser/src/plugins/v8intrinsic.js packages/babel-parser/src/parser/expression.js packages/babel-parser/src/parser/statement.js packages/babel-parser/src/parser/lval.js packages/babel-parser/src/parser/comments.js packages/babel-parser/src/parser/util.js packages/babel-parser/src/parser/node.js packages/babel-parser/src/parser/index.js packages/babel-parser/src/parser/error.js packages/babel-parser/src/parser/base.js packages/babel-parser/src/parser/error-message.js packages/babel-parser/src/tokenizer/index.js packages/babel-parser/src/tokenizer/context.js packages/babel-parser/src/tokenizer/state.js packages/babel-parser/src/tokenizer/types.js packages/babel-parser/src/util/scope.js packages/babel-parser/src/util/class-scope.js packages/babel-parser/src/util/scopeflags.js packages/babel-parser/src/util/whitespace.js packages/babel-parser/src/util/production-parameter.js packages/babel-parser/src/util/location.js packages/babel-parser/src/util/identifier.js packages/babel-parser/src/index.js packages/babel-parser/src/plugin-utils.js packages/babel-parser/src/options.js packages/babel-traverse/src/path/inference/inferers.js packages/babel-traverse/src/path/inference/inferer-reference.js packages/babel-traverse/src/path/inference/index.js packages/babel-traverse/src/path/conversion.js packages/babel-traverse/src/path/evaluation.js packages/babel-traverse/src/path/introspection.js packages/babel-traverse/src/path/lib/hoister.js packages/babel-traverse/src/path/lib/virtual-types.js packages/babel-traverse/src/path/lib/removal-hooks.js packages/babel-traverse/src/path/family.js packages/babel-traverse/src/path/context.js packages/babel-traverse/src/path/replacement.js packages/babel-traverse/src/path/modification.js packages/babel-traverse/src/path/index.js packages/babel-traverse/src/path/ancestry.js packages/babel-traverse/src/path/removal.js packages/babel-traverse/src/path/comments.js packages/babel-traverse/src/scope/index.js packages/babel-traverse/src/scope/lib/renamer.js packages/babel-traverse/src/scope/binding.js packages/babel-traverse/src/visitors.js packages/babel-traverse/src/context.js packages/babel-traverse/src/index.js packages/babel-traverse/src/cache.js packages/babel-traverse/src/hub.js packages/babel-generator/src/generators/flow.js packages/babel-generator/src/generators/typescript.js packages/babel-generator/src/generators/statements.js packages/babel-generator/src/generators/expressions.js packages/babel-generator/src/generators/types.js packages/babel-generator/src/generators/modules.js packages/babel-generator/src/generators/methods.js packages/babel-generator/src/generators/classes.js packages/babel-generator/src/generators/jsx.js packages/babel-generator/src/generators/base.js packages/babel-generator/src/generators/template-literals.js packages/babel-generator/src/node/parentheses.js packages/babel-generator/src/node/whitespace.js packages/babel-generator/src/node/index.js packages/babel-generator/src/printer.js packages/babel-generator/src/buffer.js packages/babel-generator/src/source-map.js packages/babel-generator/src/index.js packages/babel-core/src/config/files/configuration.js packages/babel-core/src/config/files/plugins.js packages/babel-core/src/config/files/module-types.js packages/babel-core/src/config/files/package.js packages/babel-core/src/config/files/index-browser.js packages/babel-core/src/config/files/utils.js packages/babel-core/src/config/files/import.js packages/babel-core/src/config/files/index.js packages/babel-core/src/config/config-chain.js packages/babel-core/src/config/validation/option-assertions.js packages/babel-core/src/config/validation/options.js packages/babel-core/src/config/validation/plugins.js packages/babel-core/src/config/caching.js packages/babel-core/src/config/full.js packages/babel-core/src/config/config-descriptors.js packages/babel-core/src/config/partial.js packages/babel-core/src/config/printer.js packages/babel-core/src/config/helpers/config-api.js packages/babel-core/src/config/helpers/environment.js packages/babel-core/src/config/item.js packages/babel-core/src/config/util.js packages/babel-core/src/config/pattern-to-regex.js packages/babel-core/src/config/index.js packages/babel-core/src/config/plugin.js packages/babel-core/src/transformation/file/merge-map.js packages/babel-core/src/transformation/file/file.js packages/babel-core/src/transformation/file/generate.js packages/babel-core/src/transformation/normalize-file.js packages/babel-core/src/transformation/index.js packages/babel-core/src/transformation/plugin-pass.js packages/babel-core/src/transformation/block-hoist-plugin.js packages/babel-core/src/transformation/normalize-opts.js packages/babel-core/src/tools/build-external-helpers.js packages/babel-core/src/gensync-utils/async.js packages/babel-core/src/gensync-utils/fs.js packages/babel-core/src/parser/index.js packages/babel-core/src/parser/util/missing-plugin-helper.js packages/babel-core/src/transform-ast.js packages/babel-core/src/parse.js packages/babel-core/src/transform.js packages/babel-core/src/transform-file.js packages/babel-core/src/transform-file-browser.js packages/babel-core/src/index.js packages/babel-types/src/definitions/core.js packages/babel-types/src/definitions/utils.js packages/babel-types/src/definitions/flow.js packages/babel-types/src/definitions/typescript.js packages/babel-types/src/definitions/experimental.js packages/babel-types/src/definitions/jsx.js packages/babel-types/src/definitions/placeholders.js packages/babel-types/src/definitions/index.js packages/babel-types/src/definitions/misc.js packages/babel-types/src/validators/isReferenced.js packages/babel-types/src/validators/isNodesEquivalent.js packages/babel-types/src/validators/matchesPattern.js packages/babel-types/src/validators/isBinding.js packages/babel-types/src/validators/validate.js packages/babel-types/src/validators/is.js packages/babel-types/src/validators/isType.js packages/babel-types/src/validators/isValidIdentifier.js packages/babel-types/src/validators/isScope.js packages/babel-types/src/validators/isPlaceholderType.js packages/babel-types/src/validators/isImmutable.js packages/babel-types/src/validators/isLet.js packages/babel-types/src/validators/buildMatchMemberExpression.js packages/babel-types/src/validators/isSpecifierDefault.js packages/babel-types/src/validators/react/isCompatTag.js packages/babel-types/src/validators/react/isReactComponent.js packages/babel-types/src/validators/isValidES3Identifier.js packages/babel-types/src/validators/isVar.js packages/babel-types/src/validators/isNode.js packages/babel-types/src/validators/isBlockScoped.js packages/babel-types/src/converters/gatherSequenceExpressions.js packages/babel-types/src/converters/valueToNode.js packages/babel-types/src/converters/toStatement.js packages/babel-types/src/converters/toKeyAlias.js packages/babel-types/src/converters/toExpression.js packages/babel-types/src/converters/toBlock.js packages/babel-types/src/converters/toIdentifier.js packages/babel-types/src/converters/toSequenceExpression.js packages/babel-types/src/converters/toBindingIdentifierName.js packages/babel-types/src/converters/toComputedKey.js packages/babel-types/src/converters/ensureBlock.js packages/babel-types/src/modifications/flow/removeTypeDuplicates.js packages/babel-types/src/modifications/typescript/removeTypeDuplicates.js packages/babel-types/src/modifications/removeProperties.js packages/babel-types/src/modifications/inherits.js packages/babel-types/src/modifications/appendToMemberExpression.js packages/babel-types/src/modifications/removePropertiesDeep.js packages/babel-types/src/modifications/prependToMemberExpression.js packages/babel-types/src/clone/cloneNode.js packages/babel-types/src/clone/cloneWithoutLoc.js packages/babel-types/src/clone/cloneDeep.js packages/babel-types/src/clone/cloneDeepWithoutLoc.js packages/babel-types/src/clone/clone.js packages/babel-types/src/builders/flow/createTypeAnnotationBasedOnTypeof.js packages/babel-types/src/builders/flow/createFlowUnionType.js packages/babel-types/src/builders/builder.js packages/babel-types/src/builders/react/buildChildren.js packages/babel-types/src/builders/typescript/createTSUnionType.js packages/babel-types/src/traverse/traverse.js packages/babel-types/src/traverse/traverseFast.js packages/babel-types/src/retrievers/getBindingIdentifiers.js packages/babel-types/src/retrievers/getOuterBindingIdentifiers.js packages/babel-types/src/utils/react/cleanJSXElementLiteralChild.js packages/babel-types/src/utils/shallowEqual.js packages/babel-types/src/utils/inherit.js packages/babel-types/src/comments/addComments.js packages/babel-types/src/comments/inheritsComments.js packages/babel-types/src/comments/removeComments.js packages/babel-types/src/comments/addComment.js packages/babel-types/src/comments/inheritLeadingComments.js packages/babel-types/src/comments/inheritInnerComments.js packages/babel-types/src/comments/inheritTrailingComments.js packages/babel-types/src/constants/index.js packages/babel-types/src/asserts/assertNode.js packages/babel-types/src/index.js packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js packages/babel-preset-env/src/polyfills/corejs3/built-in-definitions.js packages/babel-preset-env/src/polyfills/corejs2/usage-plugin.js packages/babel-preset-env/src/polyfills/corejs2/entry-plugin.js packages/babel-preset-env/src/polyfills/corejs2/get-platform-specific-default.js packages/babel-preset-env/src/polyfills/corejs2/built-in-definitions.js packages/babel-preset-env/src/polyfills/regenerator/entry-plugin.js packages/babel-preset-env/src/polyfills/regenerator/usage-plugin.js packages/babel-preset-env/src/index.js packages/babel-preset-env/src/normalize-options.js packages/babel-preset-env/src/utils.js packages/babel-preset-env/src/debug.js packages/babel-preset-env/src/plugins-compat-data.js packages/babel-preset-env/src/get-option-specific-excludes.js packages/babel-preset-env/src/options.js packages/babel-preset-env/src/filter-items.js packages/babel-helper-create-class-features-plugin/src/fields.js packages/babel-helper-create-class-features-plugin/src/index.js packages/babel-helper-create-class-features-plugin/src/decorators.js packages/babel-helper-create-class-features-plugin/src/misc.js packages/babel-helper-create-class-features-plugin/src/features.js packages/babel-helper-create-class-features-plugin/src/typescript.js packages/babel-helper-module-transforms/src/normalize-and-load-metadata.js packages/babel-helper-module-transforms/src/rewrite-live-references.js packages/babel-helper-module-transforms/src/index.js packages/babel-helper-module-transforms/src/get-module-name.js packages/babel-helper-module-transforms/src/rewrite-this.js packages/babel-plugin-transform-block-scoping/src/index.js packages/babel-plugin-transform-block-scoping/src/tdz.js packages/babel-plugin-transform-typescript/src/index.js packages/babel-plugin-transform-typescript/src/enum.js packages/babel-plugin-transform-typescript/src/namespace.js packages/babel-cli/src/babel/options.js packages/babel-cli/src/babel/dir.js packages/babel-cli/src/babel/file.js packages/babel-cli/src/babel/util.js packages/babel-cli/src/babel/index.js packages/babel-cli/src/babel-external-helpers.js packages/babel-helper-builder-react-jsx-experimental/src/index.js packages/babel-template/src/parse.js packages/babel-template/src/populate.js packages/babel-template/src/builder.js packages/babel-template/src/options.js packages/babel-template/src/literal.js packages/babel-template/src/formatters.js packages/babel-template/src/string.js packages/babel-template/src/index.js packages/babel-plugin-transform-classes/src/transformClass.js packages/babel-plugin-transform-classes/src/index.js packages/babel-plugin-transform-classes/src/inline-createSuper-helpers.js packages/babel-plugin-transform-destructuring/src/index.js packages/babel-plugin-proposal-object-rest-spread/src/index.js packages/babel-plugin-transform-parameters/src/rest.js packages/babel-plugin-transform-parameters/src/params.js packages/babel-plugin-transform-parameters/src/index.js packages/babel-helper-module-imports/src/import-injector.js packages/babel-helper-module-imports/src/import-builder.js packages/babel-helper-module-imports/src/index.js packages/babel-helper-module-imports/src/is-module.js packages/babel-helpers/src/index.js packages/babel-helpers/src/helpers.js packages/babel-plugin-transform-modules-systemjs/src/index.js packages/babel-plugin-transform-runtime/src/index.js packages/babel-plugin-transform-runtime/src/helpers.js packages/babel-plugin-transform-runtime/src/get-runtime-path/index.js packages/babel-plugin-transform-runtime/src/get-runtime-path/browser.js packages/babel-plugin-transform-runtime/src/runtime-corejs2-definitions.js packages/babel-plugin-transform-runtime/src/runtime-corejs3-definitions.js packages/babel-helper-compilation-targets/src/index.js packages/babel-helper-compilation-targets/src/filter-items.js packages/babel-helper-compilation-targets/src/utils.js packages/babel-helper-compilation-targets/src/pretty.js packages/babel-helper-compilation-targets/src/debug.js packages/babel-helper-compilation-targets/src/targets.js packages/babel-helper-compilation-targets/src/options.js packages/babel-standalone/src/transformScriptTags.js packages/babel-standalone/src/index.js packages/babel-standalone/src/preset-es2015.js packages/babel-standalone/src/preset-stage-1.js packages/babel-standalone/src/preset-stage-0.js packages/babel-standalone/src/preset-stage-2.js packages/babel-standalone/src/preset-stage-3.js packages/babel-standalone/src/generated/plugins.js packages/babel-standalone/src/babel-package-shim.js packages/babel-helper-transform-fixture-test-runner/src/index.js packages/babel-helper-transform-fixture-test-runner/src/helpers.js packages/babel-helper-member-expression-to-functions/src/index.js packages/babel-plugin-transform-for-of/src/index.js packages/babel-plugin-transform-for-of/src/no-helper-implementation.js packages/babel-node/src/_babel-node.js packages/babel-node/src/babel-node.js packages/babel-plugin-transform-flow-comments/src/index.js packages/babel-helper-fixtures/src/index.js packages/babel-plugin-proposal-decorators/src/transformer-legacy.js packages/babel-plugin-proposal-decorators/src/index.js packages/babel-helper-builder-react-jsx/src/index.js packages/babel-register/src/node.js packages/babel-register/src/cache.js packages/babel-register/src/index.js packages/babel-register/src/browser.js packages/babel-helper-replace-supers/src/index.js packages/babel-plugin-transform-modules-commonjs/src/index.js packages/babel-code-frame/src/index.js packages/babel-helper-create-regexp-features-plugin/src/index.js packages/babel-helper-create-regexp-features-plugin/src/util.js packages/babel-helper-create-regexp-features-plugin/src/features.js packages/babel-plugin-proposal-optional-chaining/src/index.js packages/babel-plugin-transform-react-jsx/src/transform-classic.js packages/babel-plugin-transform-react-jsx/src/transform-automatic.js packages/babel-plugin-transform-react-jsx/src/index.js packages/babel-helper-define-map/src/index.js packages/babel-helper-function-name/src/index.js packages/babel-plugin-transform-spread/src/index.js packages/babel-plugin-transform-computed-properties/src/index.js packages/babel-plugin-transform-flow-strip-types/src/index.js packages/babel-plugin-transform-modules-umd/src/index.js packages/babel-plugin-proposal-pipeline-operator/src/buildOptimizedSequenceExpression.js packages/babel-plugin-proposal-pipeline-operator/src/smartVisitor.js packages/babel-plugin-proposal-pipeline-operator/src/fsharpVisitor.js packages/babel-plugin-proposal-pipeline-operator/src/minimalVisitor.js packages/babel-plugin-proposal-pipeline-operator/src/index.js packages/babel-plugin-transform-template-literals/src/index.js packages/babel-helper-validator-identifier/src/identifier.js packages/babel-helper-validator-identifier/src/keyword.js packages/babel-plugin-transform-modules-amd/src/index.js packages/babel-plugin-transform-unicode-escapes/src/index.js packages/babel-plugin-proposal-async-generator-functions/src/index.js packages/babel-plugin-proposal-async-generator-functions/src/for-await.js packages/babel-plugin-transform-react-constant-elements/src/index.js packages/babel-plugin-transform-react-display-name/src/index.js packages/babel-helper-wrap-function/src/index.js packages/babel-highlight/src/index.js packages/babel-plugin-proposal-partial-application/src/index.js packages/babel-helper-split-export-declaration/src/index.js packages/babel-plugin-transform-react-inline-elements/src/index.js packages/babel-plugin-transform-typeof-symbol/src/index.js packages/babel-plugin-transform-duplicate-keys/src/index.js packages/babel-plugin-transform-proto-to-assign/src/index.js packages/babel-helper-plugin-utils/src/index.js packages/babel-helper-remap-async-to-generator/src/index.js packages/babel-helper-simple-access/src/index.js packages/babel-helper-explode-assignable-expression/src/index.js packages/babel-plugin-transform-react-jsx-source/src/index.js packages/babel-plugin-proposal-function-bind/src/index.js packages/babel-helper-call-delegate/src/index.js packages/babel-plugin-transform-new-target/src/index.js packages/babel-plugin-proposal-function-sent/src/index.js packages/babel-helper-explode-class/src/index.js packages/babel-plugin-transform-react-pure-annotations/src/index.js packages/babel-plugin-proposal-logical-assignment-operators/src/index.js packages/babel-plugin-transform-react-jsx-development/src/index.js packages/babel-plugin-transform-block-scoped-functions/src/index.js packages/babel-preset-react/src/index.js packages/babel-helper-hoist-variables/src/index.js packages/babel-plugin-proposal-export-namespace-from/src/index.js packages/babel-plugin-syntax-typescript/src/index.js packages/babel-plugin-transform-property-mutators/src/index.js packages/babel-plugin-syntax-decorators/src/index.js packages/babel-plugin-external-helpers/src/index.js packages/babel-plugin-transform-instanceof/src/index.js packages/babel-plugin-transform-async-to-generator/src/index.js packages/babel-helper-bindify-decorators/src/index.js packages/babel-plugin-transform-object-super/src/index.js packages/babel-plugin-proposal-export-default-from/src/index.js packages/babel-helper-builder-binary-assignment-operator-visitor/src/index.js packages/babel-plugin-proposal-nullish-coalescing-operator/src/index.js packages/babel-plugin-syntax-flow/src/index.js packages/babel-plugin-transform-shorthand-properties/src/index.js packages/babel-preset-typescript/src/index.js packages/babel-plugin-transform-function-name/src/index.js packages/babel-plugin-proposal-json-strings/src/index.js packages/babel-plugin-proposal-dynamic-import/src/index.js packages/babel-helper-skip-transparent-expression-wrappers/src/index.js packages/babel-plugin-transform-react-jsx-self/src/index.js packages/babel-plugin-transform-member-expression-literals/src/index.js packages/babel-plugin-transform-react-jsx-compat/src/index.js packages/babel-plugin-transform-property-literals/src/index.js packages/babel-plugin-transform-literals/src/index.js packages/babel-helper-annotate-as-pure/src/index.js packages/babel-helper-optimise-call-expression/src/index.js packages/babel-plugin-syntax-jsx/src/index.js packages/babel-plugin-transform-strict-mode/src/index.js packages/babel-plugin-proposal-do-expressions/src/index.js packages/babel-plugin-proposal-throw-expressions/src/index.js packages/babel-plugin-proposal-optional-catch-binding/src/index.js packages/babel-plugin-syntax-pipeline-operator/src/index.js packages/babel-helper-regex/src/index.js packages/babel-plugin-transform-sticky-regex/src/index.js packages/babel-helper-get-function-arity/src/index.js packages/babel-plugin-syntax-module-attributes/src/index.js packages/babel-plugin-proposal-numeric-separator/src/index.js packages/babel-plugin-transform-jscript/src/index.js packages/babel-plugin-transform-arrow-functions/src/index.js packages/babel-plugin-syntax-record-and-tuple/src/index.js packages/babel-plugin-transform-reserved-words/src/index.js packages/babel-plugin-proposal-unicode-property-regex/src/index.js packages/babel-plugin-transform-object-assign/src/index.js packages/babel-plugin-transform-object-set-prototype-of-to-assign/src/index.js packages/babel-plugin-syntax-partial-application/src/index.js packages/babel-plugin-transform-named-capturing-groups-regex/src/index.js packages/babel-plugin-syntax-numeric-separator/src/index.js packages/babel-plugin-syntax-function-sent/src/index.js packages/babel-plugin-syntax-decimal/src/index.js packages/babel-plugin-proposal-class-properties/src/index.js packages/babel-plugin-transform-exponentiation-operator/src/index.js packages/babel-plugin-syntax-throw-expressions/src/index.js packages/babel-plugin-syntax-do-expressions/src/index.js packages/babel-plugin-proposal-private-property-in-object/src/index.js packages/babel-plugin-syntax-export-default-from/src/index.js packages/babel-plugin-syntax-function-bind/src/index.js packages/babel-plugin-syntax-class-properties/src/index.js packages/babel-plugin-syntax-top-level-await/src/index.js packages/babel-plugin-proposal-private-methods/src/index.js packages/babel-plugin-syntax-logical-assignment-operators/src/index.js packages/babel-plugin-syntax-import-meta/src/index.js packages/babel-plugin-transform-unicode-regex/src/index.js packages/babel-polyfill/src/index.js packages/babel-helper-plugin-test-runner/src/index.js packages/babel-preset-flow/src/index.js packages/babel-plugin-transform-dotall-regex/src/index.js eslint/babel-eslint-parser/src/convert/convertTokens.js eslint/babel-eslint-parser/src/convert/convertAST.js eslint/babel-eslint-parser/src/convert/convertComments.js eslint/babel-eslint-parser/src/convert/index.js eslint/babel-eslint-parser/src/analyze-scope.js eslint/babel-eslint-parser/src/index.js eslint/babel-eslint-parser/src/configuration.js eslint/babel-eslint-parser/src/visitor-keys.js eslint/babel-eslint-plugin-development/src/utils/get-reference-origin.js eslint/babel-eslint-plugin-development/src/utils/is-from-babel-types.js eslint/babel-eslint-plugin-development/src/utils/get-export-name.js eslint/babel-eslint-plugin-development/src/utils/is-babel-plugin-factory.js eslint/babel-eslint-plugin-development/src/rules/plugin-name.js eslint/babel-eslint-plugin-development/src/rules/no-undefined-identifier.js eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.js eslint/babel-eslint-plugin-development/src/index.js eslint/babel-eslint-plugin/src/rules/semi.js eslint/babel-eslint-plugin/src/rules/no-unused-expressions.js eslint/babel-eslint-plugin/src/rules/no-invalid-this.js eslint/babel-eslint-plugin/src/rules/object-curly-spacing.js eslint/babel-eslint-plugin/src/rules/new-cap.js eslint/babel-eslint-plugin/src/index.js eslint/babel-eslint-plugin-development-internal/src/rules/dry-error-messages.js eslint/babel-eslint-plugin-development-internal/src/index.js codemods/babel-plugin-codemod-object-assign-to-object-spread/src/index.js codemods/babel-plugin-codemod-optional-catch-binding/src/index.js

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -105,22 +105,9 @@
Loading
105 105
      }
106 106
    }
107 107
108 -
    checkGetterSetterParams(method: N.ObjectMethod | N.ClassMethod): void {
109 -
      const prop = ((method: any): N.EstreeProperty | N.EstreeMethodDefinition);
110 -
      const paramCount = prop.kind === "get" ? 0 : 1;
111 -
      const start = prop.start;
112 -
      if (prop.value.params.length !== paramCount) {
113 -
        if (method.kind === "get") {
114 -
          this.raise(start, Errors.BadGetterArity);
115 -
        } else {
116 -
          this.raise(start, Errors.BadSetterArity);
117 -
        }
118 -
      } else if (
119 -
        prop.kind === "set" &&
120 -
        prop.value.params[0].type === "RestElement"
121 -
      ) {
122 -
        this.raise(start, Errors.BadSetterRestParameter);
123 -
      }
108 +
    getObjectOrClassMethodParams(method: N.ObjectMethod | N.ClassMethod) {
109 +
      return ((method: any): N.EstreeProperty | N.EstreeMethodDefinition).value
110 +
        .params;
124 111
    }
125 112
126 113
    checkLVal(

@@ -1795,12 +1795,20 @@
Loading
1795 1795
    return method.kind === "get" ? 0 : 1;
1796 1796
  }
1797 1797
1798 +
  // This exists so we can override within the ESTree plugin
1799 +
  getObjectOrClassMethodParams(method: N.ObjectMethod | N.ClassMethod) {
1800 +
    return method.params;
1801 +
  }
1802 +
1798 1803
  // get methods aren't allowed to have any parameters
1799 1804
  // set methods must have exactly 1 parameter which is not a rest parameter
1800 1805
  checkGetterSetterParams(method: N.ObjectMethod | N.ClassMethod): void {
1801 1806
    const paramCount = this.getGetterSetterExpectedParamCount(method);
1807 +
    const params = this.getObjectOrClassMethodParams(method);
1808 +
1802 1809
    const start = method.start;
1803 -
    if (method.params.length !== paramCount) {
1810 +
1811 +
    if (params.length !== paramCount) {
1804 1812
      if (method.kind === "get") {
1805 1813
        this.raise(start, Errors.BadGetterArity);
1806 1814
      } else {
@@ -1810,7 +1818,7 @@
Loading
1810 1818
1811 1819
    if (
1812 1820
      method.kind === "set" &&
1813 -
      method.params[method.params.length - 1].type === "RestElement"
1821 +
      params[params.length - 1]?.type === "RestElement"
1814 1822
    ) {
1815 1823
      this.raise(start, Errors.BadSetterRestParameter);
1816 1824
    }

Learn more Showing 1 files with coverage changes found.

Changes in packages/babel-traverse/src/path/family.js
+12
+4
Loading file...
Files Coverage
codemods 100.00%
eslint 96.61%
packages -<.01% 91.55%
Project Totals (439 files) 91.70%
Loading