Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

publint

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

publint - npm Package Compare versions

Comparing version 0.1.12 to 0.1.13

4

lib/cli.js

@@ -74,3 +74,5 @@ #!/usr/bin/env node

const depDir = await findDepPath(deps[i], pkgDir)
const logs = depDir ? await lintDir(depDir, opts.level, opts.strict, true) : []
const logs = depDir
? await lintDir(depDir, opts.level, opts.strict, true)
: []
// log this lint result

@@ -77,0 +79,0 @@ const log = () => {

{
"name": "publint",
"version": "0.1.12",
"version": "0.1.13",
"description": "Lint packaging errors",

@@ -5,0 +5,0 @@ "type": "module",

@@ -214,2 +214,8 @@ import {

const knownFields = ['types', 'jsnext:main', 'jsnext', 'unpkg', 'jsdelivr']
// if has typesVersions field, it complicates `types` field resolution a lot.
// for now skip it, but further improvements are tracked at
// https://github.com/bluwy/publint/issues/42
if (getPublishedField(rootPkg, 'typesVersions')[0]) {
knownFields.splice(0, 1)
}
for (const field of knownFields) {

@@ -473,8 +479,25 @@ const [fieldValue, fieldPkgPath] = getPublishedField(rootPkg, field)

if ('types' in exports && exportsKeys[0] !== 'types') {
messages.push({
code: 'EXPORTS_TYPES_SHOULD_BE_FIRST',
args: {},
path: currentPath.concat('types'),
type: 'error'
})
// check preceding conditions before the `types` condition, if there are nested
// conditions, check if they also have the `types` condition. If they do, there's
// a good chance those take precendence over this non-first `types` condition, which
// is fine and is usually used as fallback instead.
const precedingKeys = exportsKeys.slice(0, exportsKeys.indexOf('types'))
let isPrecededByNestedTypesCondition = false
for (const key of precedingKeys) {
if (
typeof exports[key] === 'object' &&
objectHasKeyNested(exports[key], 'types')
) {
isPrecededByNestedTypesCondition = true
break
}
}
if (!isPrecededByNestedTypesCondition) {
messages.push({
code: 'EXPORTS_TYPES_SHOULD_BE_FIRST',
args: {},
path: currentPath.concat('types'),
type: 'error'
})
}
}

@@ -481,0 +504,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc