Skip to content

Commit b0765ae

Browse files
committed
fix some lints
1 parent dfa6206 commit b0765ae

File tree

5 files changed

+4
-63
lines changed

5 files changed

+4
-63
lines changed

internal/bundler/bundler.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ func parseFile(args parseArgs) {
143143
} else {
144144
result, ok := runOnLoadPlugins(
145145
args.options.Plugins,
146-
args.res,
147146
args.fs,
148147
&args.caches.FSCache,
149148
args.log,
@@ -540,7 +539,7 @@ func parseFile(args parseArgs) {
540539
tracker := logger.MakeLineColumnTracker(&source)
541540

542541
if path, contents := extractSourceMapFromComment(args.log, args.fs, &args.caches.FSCache,
543-
args.res, &source, &tracker, sourceMapComment, absResolveDir); contents != nil {
542+
&source, &tracker, sourceMapComment, absResolveDir); contents != nil {
544543
prettyPath := resolver.PrettyPath(args.fs, path)
545544
log := logger.NewDeferLog(logger.DeferLogNoVerboseOrDebug, args.log.Overrides)
546545

@@ -743,7 +742,6 @@ func extractSourceMapFromComment(
743742
log logger.Log,
744743
fs fs.FS,
745744
fsCache *cache.FSCache,
746-
res *resolver.Resolver,
747745
source *logger.Source,
748746
tracker *logger.LineColumnTracker,
749747
comment logger.Span,
@@ -982,7 +980,6 @@ type loaderPluginResult struct {
982980

983981
func runOnLoadPlugins(
984982
plugins []config.Plugin,
985-
res *resolver.Resolver,
986983
fs fs.FS,
987984
fsCache *cache.FSCache,
988985
log logger.Log,

internal/linker/linker.go

-4
Original file line numberDiff line numberDiff line change
@@ -4599,8 +4599,6 @@ func (c *linkerContext) generateCodeForFileInChunkJS(
45994599
r renamer.Renamer,
46004600
waitGroup *sync.WaitGroup,
46014601
partRange partRange,
4602-
entryBits helpers.BitSet,
4603-
chunkAbsDir string,
46044602
toCommonJSRef ast.Ref,
46054603
toESMRef ast.Ref,
46064604
runtimeRequireRef ast.Ref,
@@ -5549,8 +5547,6 @@ func (c *linkerContext) generateChunkJS(chunkIndex int, chunkWaitGroup *sync.Wai
55495547
r,
55505548
&waitGroup,
55515549
partRange,
5552-
chunk.entryBits,
5553-
chunkAbsDir,
55545550
toCommonJSRef,
55555551
toESMRef,
55565552
runtimeRequireRef,

internal/resolver/yarnpnp.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func (r resolverQuery) resolveToUnqualified(specifier string, parentURL string,
204204
}
205205

206206
// If parentLocator isn't in manifest.fallbackExclusionList, then
207-
if set, _ := manifest.fallbackExclusionList[parentLocator.ident]; !set[parentLocator.reference] {
207+
if set := manifest.fallbackExclusionList[parentLocator.ident]; !set[parentLocator.reference] {
208208
// Let fallback be RESOLVE_VIA_FALLBACK(manifest, ident)
209209
fallback, _ := r.resolveViaFallback(manifest, ident)
210210

@@ -302,9 +302,7 @@ func (r resolverQuery) findLocator(manifest *pnpData, moduleUrl string) (pnpIden
302302
}
303303

304304
// The relative path must not start with ./; trim it if needed
305-
if strings.HasPrefix(relativeUrl, "./") {
306-
relativeUrl = relativeUrl[2:]
307-
}
305+
relativeUrl = strings.TrimPrefix(relativeUrl, "./")
308306

309307
// If relativeUrl matches manifest.ignorePatternData, then
310308
if manifest.ignorePatternData != nil && manifest.ignorePatternData.MatchString(relativeUrl) {

pkg/api/api_impl.go

-50
Original file line numberDiff line numberDiff line change
@@ -276,25 +276,6 @@ func validateLoader(value Loader) config.Loader {
276276
}
277277
}
278278

279-
func validateEngine(value EngineName) compat.Engine {
280-
switch value {
281-
case EngineChrome:
282-
return compat.Chrome
283-
case EngineEdge:
284-
return compat.Edge
285-
case EngineFirefox:
286-
return compat.Firefox
287-
case EngineIOS:
288-
return compat.IOS
289-
case EngineNode:
290-
return compat.Node
291-
case EngineSafari:
292-
return compat.Safari
293-
default:
294-
panic("Invalid loader")
295-
}
296-
}
297-
298279
var versionRegex = regexp.MustCompile(`^([0-9]+)(?:\.([0-9]+))?(?:\.([0-9]+))?(-[A-Za-z0-9]+(?:\.[A-Za-z0-9]+)*)?$`)
299280

300281
func validateFeatures(log logger.Log, target Target, engines []Engine) (compat.JSFeature, compat.CSSFeature, map[css_ast.D]compat.CSSPrefix, string) {
@@ -454,37 +435,6 @@ func validateExternals(log logger.Log, fs fs.FS, paths []string) config.External
454435
return result
455436
}
456437

457-
func esmParsePackageName(packageSpecifier string) (packageName string, packageSubpath string, ok bool) {
458-
if packageSpecifier == "" {
459-
return
460-
}
461-
462-
slash := strings.IndexByte(packageSpecifier, '/')
463-
if !strings.HasPrefix(packageSpecifier, "@") {
464-
if slash == -1 {
465-
slash = len(packageSpecifier)
466-
}
467-
packageName = packageSpecifier[:slash]
468-
} else {
469-
if slash == -1 {
470-
return
471-
}
472-
slash2 := strings.IndexByte(packageSpecifier[slash+1:], '/')
473-
if slash2 == -1 {
474-
slash2 = len(packageSpecifier[slash+1:])
475-
}
476-
packageName = packageSpecifier[:slash+1+slash2]
477-
}
478-
479-
if strings.HasPrefix(packageName, ".") || strings.ContainsAny(packageName, "\\%") {
480-
return
481-
}
482-
483-
packageSubpath = "." + packageSpecifier[len(packageName):]
484-
ok = true
485-
return
486-
}
487-
488438
func validateAlias(log logger.Log, fs fs.FS, alias map[string]string) map[string]string {
489439
valid := make(map[string]string, len(alias))
490440

pkg/api/serve_other.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func (h *apiHandler) ServeHTTP(res http.ResponseWriter, req *http.Request) {
113113
maybeWriteResponseBody := func(bytes []byte) { res.Write(bytes) }
114114
isHEAD := req.Method == "HEAD"
115115
if isHEAD {
116-
maybeWriteResponseBody = func(bytes []byte) { res.Write(nil) }
116+
maybeWriteResponseBody = func([]byte) { res.Write(nil) }
117117
}
118118

119119
// Handle GET and HEAD requests

0 commit comments

Comments
 (0)