Skip to content

Commit d981064

Browse files
committed
make to go formatter happy
1 parent 0d4fae1 commit d981064

File tree

2 files changed

+112
-104
lines changed

2 files changed

+112
-104
lines changed

internal/compat/js_table.go

Lines changed: 100 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -98,110 +98,110 @@ const (
9898

9999
var StringToJSFeature = map[string]JSFeature{
100100
"arbitrary-module-namespace-names": ArbitraryModuleNamespaceNames,
101-
"array-spread": ArraySpread,
102-
"arrow": Arrow,
103-
"async-await": AsyncAwait,
104-
"async-generator": AsyncGenerator,
105-
"bigint": Bigint,
106-
"class": Class,
107-
"class-field": ClassField,
108-
"class-private-accessor": ClassPrivateAccessor,
109-
"class-private-brand-check": ClassPrivateBrandCheck,
110-
"class-private-field": ClassPrivateField,
111-
"class-private-method": ClassPrivateMethod,
112-
"class-private-static-accessor": ClassPrivateStaticAccessor,
113-
"class-private-static-field": ClassPrivateStaticField,
114-
"class-private-static-method": ClassPrivateStaticMethod,
115-
"class-static-blocks": ClassStaticBlocks,
116-
"class-static-field": ClassStaticField,
117-
"const-and-let": ConstAndLet,
118-
"default-argument": DefaultArgument,
119-
"destructuring": Destructuring,
120-
"dynamic-import": DynamicImport,
121-
"exponent-operator": ExponentOperator,
122-
"export-star-as": ExportStarAs,
123-
"for-await": ForAwait,
124-
"for-of": ForOf,
125-
"generator": Generator,
126-
"hashbang": Hashbang,
127-
"import-assertions": ImportAssertions,
128-
"import-meta": ImportMeta,
129-
"logical-assignment": LogicalAssignment,
130-
"nested-rest-binding": NestedRestBinding,
131-
"new-target": NewTarget,
132-
"node-colon-prefix-import": NodeColonPrefixImport,
133-
"node-colon-prefix-require": NodeColonPrefixRequire,
134-
"nullish-coalescing": NullishCoalescing,
135-
"object-accessors": ObjectAccessors,
136-
"object-extensions": ObjectExtensions,
137-
"object-rest-spread": ObjectRestSpread,
138-
"optional-catch-binding": OptionalCatchBinding,
139-
"optional-chain": OptionalChain,
140-
"regexp-dot-all-flag": RegexpDotAllFlag,
141-
"regexp-lookbehind-assertions": RegexpLookbehindAssertions,
142-
"regexp-match-indices": RegexpMatchIndices,
143-
"regexp-named-capture-groups": RegexpNamedCaptureGroups,
144-
"regexp-sticky-and-unicode-flags": RegexpStickyAndUnicodeFlags,
145-
"regexp-unicode-property-escapes": RegexpUnicodePropertyEscapes,
146-
"rest-argument": RestArgument,
147-
"template-literal": TemplateLiteral,
148-
"top-level-await": TopLevelAwait,
149-
"typeof-exotic-object-is-object": TypeofExoticObjectIsObject,
150-
"unicode-escapes": UnicodeEscapes,
101+
"array-spread": ArraySpread,
102+
"arrow": Arrow,
103+
"async-await": AsyncAwait,
104+
"async-generator": AsyncGenerator,
105+
"bigint": Bigint,
106+
"class": Class,
107+
"class-field": ClassField,
108+
"class-private-accessor": ClassPrivateAccessor,
109+
"class-private-brand-check": ClassPrivateBrandCheck,
110+
"class-private-field": ClassPrivateField,
111+
"class-private-method": ClassPrivateMethod,
112+
"class-private-static-accessor": ClassPrivateStaticAccessor,
113+
"class-private-static-field": ClassPrivateStaticField,
114+
"class-private-static-method": ClassPrivateStaticMethod,
115+
"class-static-blocks": ClassStaticBlocks,
116+
"class-static-field": ClassStaticField,
117+
"const-and-let": ConstAndLet,
118+
"default-argument": DefaultArgument,
119+
"destructuring": Destructuring,
120+
"dynamic-import": DynamicImport,
121+
"exponent-operator": ExponentOperator,
122+
"export-star-as": ExportStarAs,
123+
"for-await": ForAwait,
124+
"for-of": ForOf,
125+
"generator": Generator,
126+
"hashbang": Hashbang,
127+
"import-assertions": ImportAssertions,
128+
"import-meta": ImportMeta,
129+
"logical-assignment": LogicalAssignment,
130+
"nested-rest-binding": NestedRestBinding,
131+
"new-target": NewTarget,
132+
"node-colon-prefix-import": NodeColonPrefixImport,
133+
"node-colon-prefix-require": NodeColonPrefixRequire,
134+
"nullish-coalescing": NullishCoalescing,
135+
"object-accessors": ObjectAccessors,
136+
"object-extensions": ObjectExtensions,
137+
"object-rest-spread": ObjectRestSpread,
138+
"optional-catch-binding": OptionalCatchBinding,
139+
"optional-chain": OptionalChain,
140+
"regexp-dot-all-flag": RegexpDotAllFlag,
141+
"regexp-lookbehind-assertions": RegexpLookbehindAssertions,
142+
"regexp-match-indices": RegexpMatchIndices,
143+
"regexp-named-capture-groups": RegexpNamedCaptureGroups,
144+
"regexp-sticky-and-unicode-flags": RegexpStickyAndUnicodeFlags,
145+
"regexp-unicode-property-escapes": RegexpUnicodePropertyEscapes,
146+
"rest-argument": RestArgument,
147+
"template-literal": TemplateLiteral,
148+
"top-level-await": TopLevelAwait,
149+
"typeof-exotic-object-is-object": TypeofExoticObjectIsObject,
150+
"unicode-escapes": UnicodeEscapes,
151151
}
152152

153153
var JSFeatureToString = map[JSFeature]string{
154154
ArbitraryModuleNamespaceNames: "arbitrary-module-namespace-names",
155-
ArraySpread: "array-spread",
156-
Arrow: "arrow",
157-
AsyncAwait: "async-await",
158-
AsyncGenerator: "async-generator",
159-
Bigint: "bigint",
160-
Class: "class",
161-
ClassField: "class-field",
162-
ClassPrivateAccessor: "class-private-accessor",
163-
ClassPrivateBrandCheck: "class-private-brand-check",
164-
ClassPrivateField: "class-private-field",
165-
ClassPrivateMethod: "class-private-method",
166-
ClassPrivateStaticAccessor: "class-private-static-accessor",
167-
ClassPrivateStaticField: "class-private-static-field",
168-
ClassPrivateStaticMethod: "class-private-static-method",
169-
ClassStaticBlocks: "class-static-blocks",
170-
ClassStaticField: "class-static-field",
171-
ConstAndLet: "const-and-let",
172-
DefaultArgument: "default-argument",
173-
Destructuring: "destructuring",
174-
DynamicImport: "dynamic-import",
175-
ExponentOperator: "exponent-operator",
176-
ExportStarAs: "export-star-as",
177-
ForAwait: "for-await",
178-
ForOf: "for-of",
179-
Generator: "generator",
180-
Hashbang: "hashbang",
181-
ImportAssertions: "import-assertions",
182-
ImportMeta: "import-meta",
183-
LogicalAssignment: "logical-assignment",
184-
NestedRestBinding: "nested-rest-binding",
185-
NewTarget: "new-target",
186-
NodeColonPrefixImport: "node-colon-prefix-import",
187-
NodeColonPrefixRequire: "node-colon-prefix-require",
188-
NullishCoalescing: "nullish-coalescing",
189-
ObjectAccessors: "object-accessors",
190-
ObjectExtensions: "object-extensions",
191-
ObjectRestSpread: "object-rest-spread",
192-
OptionalCatchBinding: "optional-catch-binding",
193-
OptionalChain: "optional-chain",
194-
RegexpDotAllFlag: "regexp-dot-all-flag",
195-
RegexpLookbehindAssertions: "regexp-lookbehind-assertions",
196-
RegexpMatchIndices: "regexp-match-indices",
197-
RegexpNamedCaptureGroups: "regexp-named-capture-groups",
198-
RegexpStickyAndUnicodeFlags: "regexp-sticky-and-unicode-flags",
199-
RegexpUnicodePropertyEscapes: "regexp-unicode-property-escapes",
200-
RestArgument: "rest-argument",
201-
TemplateLiteral: "template-literal",
202-
TopLevelAwait: "top-level-await",
203-
TypeofExoticObjectIsObject: "typeof-exotic-object-is-object",
204-
UnicodeEscapes: "unicode-escapes",
155+
ArraySpread: "array-spread",
156+
Arrow: "arrow",
157+
AsyncAwait: "async-await",
158+
AsyncGenerator: "async-generator",
159+
Bigint: "bigint",
160+
Class: "class",
161+
ClassField: "class-field",
162+
ClassPrivateAccessor: "class-private-accessor",
163+
ClassPrivateBrandCheck: "class-private-brand-check",
164+
ClassPrivateField: "class-private-field",
165+
ClassPrivateMethod: "class-private-method",
166+
ClassPrivateStaticAccessor: "class-private-static-accessor",
167+
ClassPrivateStaticField: "class-private-static-field",
168+
ClassPrivateStaticMethod: "class-private-static-method",
169+
ClassStaticBlocks: "class-static-blocks",
170+
ClassStaticField: "class-static-field",
171+
ConstAndLet: "const-and-let",
172+
DefaultArgument: "default-argument",
173+
Destructuring: "destructuring",
174+
DynamicImport: "dynamic-import",
175+
ExponentOperator: "exponent-operator",
176+
ExportStarAs: "export-star-as",
177+
ForAwait: "for-await",
178+
ForOf: "for-of",
179+
Generator: "generator",
180+
Hashbang: "hashbang",
181+
ImportAssertions: "import-assertions",
182+
ImportMeta: "import-meta",
183+
LogicalAssignment: "logical-assignment",
184+
NestedRestBinding: "nested-rest-binding",
185+
NewTarget: "new-target",
186+
NodeColonPrefixImport: "node-colon-prefix-import",
187+
NodeColonPrefixRequire: "node-colon-prefix-require",
188+
NullishCoalescing: "nullish-coalescing",
189+
ObjectAccessors: "object-accessors",
190+
ObjectExtensions: "object-extensions",
191+
ObjectRestSpread: "object-rest-spread",
192+
OptionalCatchBinding: "optional-catch-binding",
193+
OptionalChain: "optional-chain",
194+
RegexpDotAllFlag: "regexp-dot-all-flag",
195+
RegexpLookbehindAssertions: "regexp-lookbehind-assertions",
196+
RegexpMatchIndices: "regexp-match-indices",
197+
RegexpNamedCaptureGroups: "regexp-named-capture-groups",
198+
RegexpStickyAndUnicodeFlags: "regexp-sticky-and-unicode-flags",
199+
RegexpUnicodePropertyEscapes: "regexp-unicode-property-escapes",
200+
RestArgument: "rest-argument",
201+
TemplateLiteral: "template-literal",
202+
TopLevelAwait: "top-level-await",
203+
TypeofExoticObjectIsObject: "typeof-exotic-object-is-object",
204+
UnicodeEscapes: "unicode-escapes",
205205
}
206206

207207
func (features JSFeature) Has(feature JSFeature) bool {

scripts/compat-table.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,15 @@ function jsFeatureString(feature) {
341341
return feature.replace(/([A-Z])/g, '-$1').slice(1).toLowerCase()
342342
}
343343

344-
function writeInnerMap(obj) {
344+
function simpleMap(entries) {
345+
let maxLength = 0
346+
for (const [key] of entries) {
347+
maxLength = Math.max(maxLength, key.length + 1)
348+
}
349+
return entries.map(([key, value]) => `\t${(key + ':').padEnd(maxLength)} ${value},`).join('\n')
350+
}
351+
352+
function jsTableMap(obj) {
345353
const keys = Object.keys(obj).sort()
346354
const maxLength = keys.reduce((a, b) => Math.max(a, b.length + 1), 0)
347355
if (keys.length === 0) return '{}'
@@ -379,11 +387,11 @@ ${Object.keys(versions).sort().map((x, i) => `\t${x}${i ? '' : ' JSFeature = 1 <
379387
)
380388
381389
var StringToJSFeature = map[string]JSFeature{
382-
${Object.keys(versions).sort().map(x => `\t"${jsFeatureString(x)}": ${x},`).join('\n')}
390+
${simpleMap(Object.keys(versions).sort().map(x => [`"${jsFeatureString(x)}"`, x]))}
383391
}
384392
385393
var JSFeatureToString = map[JSFeature]string{
386-
${Object.keys(versions).sort().map(x => `\t${x}: "${jsFeatureString(x)}",`).join('\n')}
394+
${simpleMap(Object.keys(versions).sort().map(x => [x, `"${jsFeatureString(x)}"`]))}
387395
}
388396
389397
func (features JSFeature) Has(feature JSFeature) bool {
@@ -395,7 +403,7 @@ func (features JSFeature) ApplyOverrides(overrides JSFeature, mask JSFeature) JS
395403
}
396404
397405
var jsTable = map[JSFeature]map[Engine][]versionRange{
398-
${Object.keys(versions).sort().map(x => `\t${x}: ${writeInnerMap(versions[x])},`).join('\n')}
406+
${Object.keys(versions).sort().map(x => `\t${x}: ${jsTableMap(versions[x])},`).join('\n')}
399407
}
400408
401409
// Return all features that are not available in at least one environment

0 commit comments

Comments
 (0)