From d98106401b8ec84d5a89441cc4206c55b66d43a3 Mon Sep 17 00:00:00 2001
From: Evan Wallace <evan.exe@gmail.com>
Date: Fri, 17 Jun 2022 23:28:16 -0400
Subject: [PATCH] make to go formatter happy

---
 internal/compat/js_table.go | 200 ++++++++++++++++++------------------
 scripts/compat-table.js     |  16 ++-
 2 files changed, 112 insertions(+), 104 deletions(-)

diff --git a/internal/compat/js_table.go b/internal/compat/js_table.go
index ffcbdb193b9..6f3ceb8ec86 100644
--- a/internal/compat/js_table.go
+++ b/internal/compat/js_table.go
@@ -98,110 +98,110 @@ const (
 
 var StringToJSFeature = map[string]JSFeature{
 	"arbitrary-module-namespace-names": ArbitraryModuleNamespaceNames,
-	"array-spread": ArraySpread,
-	"arrow": Arrow,
-	"async-await": AsyncAwait,
-	"async-generator": AsyncGenerator,
-	"bigint": Bigint,
-	"class": Class,
-	"class-field": ClassField,
-	"class-private-accessor": ClassPrivateAccessor,
-	"class-private-brand-check": ClassPrivateBrandCheck,
-	"class-private-field": ClassPrivateField,
-	"class-private-method": ClassPrivateMethod,
-	"class-private-static-accessor": ClassPrivateStaticAccessor,
-	"class-private-static-field": ClassPrivateStaticField,
-	"class-private-static-method": ClassPrivateStaticMethod,
-	"class-static-blocks": ClassStaticBlocks,
-	"class-static-field": ClassStaticField,
-	"const-and-let": ConstAndLet,
-	"default-argument": DefaultArgument,
-	"destructuring": Destructuring,
-	"dynamic-import": DynamicImport,
-	"exponent-operator": ExponentOperator,
-	"export-star-as": ExportStarAs,
-	"for-await": ForAwait,
-	"for-of": ForOf,
-	"generator": Generator,
-	"hashbang": Hashbang,
-	"import-assertions": ImportAssertions,
-	"import-meta": ImportMeta,
-	"logical-assignment": LogicalAssignment,
-	"nested-rest-binding": NestedRestBinding,
-	"new-target": NewTarget,
-	"node-colon-prefix-import": NodeColonPrefixImport,
-	"node-colon-prefix-require": NodeColonPrefixRequire,
-	"nullish-coalescing": NullishCoalescing,
-	"object-accessors": ObjectAccessors,
-	"object-extensions": ObjectExtensions,
-	"object-rest-spread": ObjectRestSpread,
-	"optional-catch-binding": OptionalCatchBinding,
-	"optional-chain": OptionalChain,
-	"regexp-dot-all-flag": RegexpDotAllFlag,
-	"regexp-lookbehind-assertions": RegexpLookbehindAssertions,
-	"regexp-match-indices": RegexpMatchIndices,
-	"regexp-named-capture-groups": RegexpNamedCaptureGroups,
-	"regexp-sticky-and-unicode-flags": RegexpStickyAndUnicodeFlags,
-	"regexp-unicode-property-escapes": RegexpUnicodePropertyEscapes,
-	"rest-argument": RestArgument,
-	"template-literal": TemplateLiteral,
-	"top-level-await": TopLevelAwait,
-	"typeof-exotic-object-is-object": TypeofExoticObjectIsObject,
-	"unicode-escapes": UnicodeEscapes,
+	"array-spread":                     ArraySpread,
+	"arrow":                            Arrow,
+	"async-await":                      AsyncAwait,
+	"async-generator":                  AsyncGenerator,
+	"bigint":                           Bigint,
+	"class":                            Class,
+	"class-field":                      ClassField,
+	"class-private-accessor":           ClassPrivateAccessor,
+	"class-private-brand-check":        ClassPrivateBrandCheck,
+	"class-private-field":              ClassPrivateField,
+	"class-private-method":             ClassPrivateMethod,
+	"class-private-static-accessor":    ClassPrivateStaticAccessor,
+	"class-private-static-field":       ClassPrivateStaticField,
+	"class-private-static-method":      ClassPrivateStaticMethod,
+	"class-static-blocks":              ClassStaticBlocks,
+	"class-static-field":               ClassStaticField,
+	"const-and-let":                    ConstAndLet,
+	"default-argument":                 DefaultArgument,
+	"destructuring":                    Destructuring,
+	"dynamic-import":                   DynamicImport,
+	"exponent-operator":                ExponentOperator,
+	"export-star-as":                   ExportStarAs,
+	"for-await":                        ForAwait,
+	"for-of":                           ForOf,
+	"generator":                        Generator,
+	"hashbang":                         Hashbang,
+	"import-assertions":                ImportAssertions,
+	"import-meta":                      ImportMeta,
+	"logical-assignment":               LogicalAssignment,
+	"nested-rest-binding":              NestedRestBinding,
+	"new-target":                       NewTarget,
+	"node-colon-prefix-import":         NodeColonPrefixImport,
+	"node-colon-prefix-require":        NodeColonPrefixRequire,
+	"nullish-coalescing":               NullishCoalescing,
+	"object-accessors":                 ObjectAccessors,
+	"object-extensions":                ObjectExtensions,
+	"object-rest-spread":               ObjectRestSpread,
+	"optional-catch-binding":           OptionalCatchBinding,
+	"optional-chain":                   OptionalChain,
+	"regexp-dot-all-flag":              RegexpDotAllFlag,
+	"regexp-lookbehind-assertions":     RegexpLookbehindAssertions,
+	"regexp-match-indices":             RegexpMatchIndices,
+	"regexp-named-capture-groups":      RegexpNamedCaptureGroups,
+	"regexp-sticky-and-unicode-flags":  RegexpStickyAndUnicodeFlags,
+	"regexp-unicode-property-escapes":  RegexpUnicodePropertyEscapes,
+	"rest-argument":                    RestArgument,
+	"template-literal":                 TemplateLiteral,
+	"top-level-await":                  TopLevelAwait,
+	"typeof-exotic-object-is-object":   TypeofExoticObjectIsObject,
+	"unicode-escapes":                  UnicodeEscapes,
 }
 
 var JSFeatureToString = map[JSFeature]string{
 	ArbitraryModuleNamespaceNames: "arbitrary-module-namespace-names",
-	ArraySpread: "array-spread",
-	Arrow: "arrow",
-	AsyncAwait: "async-await",
-	AsyncGenerator: "async-generator",
-	Bigint: "bigint",
-	Class: "class",
-	ClassField: "class-field",
-	ClassPrivateAccessor: "class-private-accessor",
-	ClassPrivateBrandCheck: "class-private-brand-check",
-	ClassPrivateField: "class-private-field",
-	ClassPrivateMethod: "class-private-method",
-	ClassPrivateStaticAccessor: "class-private-static-accessor",
-	ClassPrivateStaticField: "class-private-static-field",
-	ClassPrivateStaticMethod: "class-private-static-method",
-	ClassStaticBlocks: "class-static-blocks",
-	ClassStaticField: "class-static-field",
-	ConstAndLet: "const-and-let",
-	DefaultArgument: "default-argument",
-	Destructuring: "destructuring",
-	DynamicImport: "dynamic-import",
-	ExponentOperator: "exponent-operator",
-	ExportStarAs: "export-star-as",
-	ForAwait: "for-await",
-	ForOf: "for-of",
-	Generator: "generator",
-	Hashbang: "hashbang",
-	ImportAssertions: "import-assertions",
-	ImportMeta: "import-meta",
-	LogicalAssignment: "logical-assignment",
-	NestedRestBinding: "nested-rest-binding",
-	NewTarget: "new-target",
-	NodeColonPrefixImport: "node-colon-prefix-import",
-	NodeColonPrefixRequire: "node-colon-prefix-require",
-	NullishCoalescing: "nullish-coalescing",
-	ObjectAccessors: "object-accessors",
-	ObjectExtensions: "object-extensions",
-	ObjectRestSpread: "object-rest-spread",
-	OptionalCatchBinding: "optional-catch-binding",
-	OptionalChain: "optional-chain",
-	RegexpDotAllFlag: "regexp-dot-all-flag",
-	RegexpLookbehindAssertions: "regexp-lookbehind-assertions",
-	RegexpMatchIndices: "regexp-match-indices",
-	RegexpNamedCaptureGroups: "regexp-named-capture-groups",
-	RegexpStickyAndUnicodeFlags: "regexp-sticky-and-unicode-flags",
-	RegexpUnicodePropertyEscapes: "regexp-unicode-property-escapes",
-	RestArgument: "rest-argument",
-	TemplateLiteral: "template-literal",
-	TopLevelAwait: "top-level-await",
-	TypeofExoticObjectIsObject: "typeof-exotic-object-is-object",
-	UnicodeEscapes: "unicode-escapes",
+	ArraySpread:                   "array-spread",
+	Arrow:                         "arrow",
+	AsyncAwait:                    "async-await",
+	AsyncGenerator:                "async-generator",
+	Bigint:                        "bigint",
+	Class:                         "class",
+	ClassField:                    "class-field",
+	ClassPrivateAccessor:          "class-private-accessor",
+	ClassPrivateBrandCheck:        "class-private-brand-check",
+	ClassPrivateField:             "class-private-field",
+	ClassPrivateMethod:            "class-private-method",
+	ClassPrivateStaticAccessor:    "class-private-static-accessor",
+	ClassPrivateStaticField:       "class-private-static-field",
+	ClassPrivateStaticMethod:      "class-private-static-method",
+	ClassStaticBlocks:             "class-static-blocks",
+	ClassStaticField:              "class-static-field",
+	ConstAndLet:                   "const-and-let",
+	DefaultArgument:               "default-argument",
+	Destructuring:                 "destructuring",
+	DynamicImport:                 "dynamic-import",
+	ExponentOperator:              "exponent-operator",
+	ExportStarAs:                  "export-star-as",
+	ForAwait:                      "for-await",
+	ForOf:                         "for-of",
+	Generator:                     "generator",
+	Hashbang:                      "hashbang",
+	ImportAssertions:              "import-assertions",
+	ImportMeta:                    "import-meta",
+	LogicalAssignment:             "logical-assignment",
+	NestedRestBinding:             "nested-rest-binding",
+	NewTarget:                     "new-target",
+	NodeColonPrefixImport:         "node-colon-prefix-import",
+	NodeColonPrefixRequire:        "node-colon-prefix-require",
+	NullishCoalescing:             "nullish-coalescing",
+	ObjectAccessors:               "object-accessors",
+	ObjectExtensions:              "object-extensions",
+	ObjectRestSpread:              "object-rest-spread",
+	OptionalCatchBinding:          "optional-catch-binding",
+	OptionalChain:                 "optional-chain",
+	RegexpDotAllFlag:              "regexp-dot-all-flag",
+	RegexpLookbehindAssertions:    "regexp-lookbehind-assertions",
+	RegexpMatchIndices:            "regexp-match-indices",
+	RegexpNamedCaptureGroups:      "regexp-named-capture-groups",
+	RegexpStickyAndUnicodeFlags:   "regexp-sticky-and-unicode-flags",
+	RegexpUnicodePropertyEscapes:  "regexp-unicode-property-escapes",
+	RestArgument:                  "rest-argument",
+	TemplateLiteral:               "template-literal",
+	TopLevelAwait:                 "top-level-await",
+	TypeofExoticObjectIsObject:    "typeof-exotic-object-is-object",
+	UnicodeEscapes:                "unicode-escapes",
 }
 
 func (features JSFeature) Has(feature JSFeature) bool {
diff --git a/scripts/compat-table.js b/scripts/compat-table.js
index 3e666dc331c..f287beb5cbb 100644
--- a/scripts/compat-table.js
+++ b/scripts/compat-table.js
@@ -341,7 +341,15 @@ function jsFeatureString(feature) {
   return feature.replace(/([A-Z])/g, '-$1').slice(1).toLowerCase()
 }
 
-function writeInnerMap(obj) {
+function simpleMap(entries) {
+  let maxLength = 0
+  for (const [key] of entries) {
+    maxLength = Math.max(maxLength, key.length + 1)
+  }
+  return entries.map(([key, value]) => `\t${(key + ':').padEnd(maxLength)} ${value},`).join('\n')
+}
+
+function jsTableMap(obj) {
   const keys = Object.keys(obj).sort()
   const maxLength = keys.reduce((a, b) => Math.max(a, b.length + 1), 0)
   if (keys.length === 0) return '{}'
@@ -379,11 +387,11 @@ ${Object.keys(versions).sort().map((x, i) => `\t${x}${i ? '' : ' JSFeature = 1 <
 )
 
 var StringToJSFeature = map[string]JSFeature{
-${Object.keys(versions).sort().map(x => `\t"${jsFeatureString(x)}": ${x},`).join('\n')}
+${simpleMap(Object.keys(versions).sort().map(x => [`"${jsFeatureString(x)}"`, x]))}
 }
 
 var JSFeatureToString = map[JSFeature]string{
-${Object.keys(versions).sort().map(x => `\t${x}: "${jsFeatureString(x)}",`).join('\n')}
+${simpleMap(Object.keys(versions).sort().map(x => [x, `"${jsFeatureString(x)}"`]))}
 }
 
 func (features JSFeature) Has(feature JSFeature) bool {
@@ -395,7 +403,7 @@ func (features JSFeature) ApplyOverrides(overrides JSFeature, mask JSFeature) JS
 }
 
 var jsTable = map[JSFeature]map[Engine][]versionRange{
-${Object.keys(versions).sort().map(x => `\t${x}: ${writeInnerMap(versions[x])},`).join('\n')}
+${Object.keys(versions).sort().map(x => `\t${x}: ${jsTableMap(versions[x])},`).join('\n')}
 }
 
 // Return all features that are not available in at least one environment