Comparing version 0.2.5 to 0.2.6
@@ -109,2 +109,3 @@ export type MessageType = 'suggestion' | 'warning' | 'error' | ||
> | ||
| BaseMessage<'DEPRECATED_FIELD_JSNEXT'> | ||
@@ -111,0 +112,0 @@ export interface Options { |
{ | ||
"name": "publint", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "Lint packaging errors", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -212,4 +212,4 @@ import { | ||
} | ||
for (const field of knownFields) { | ||
const [fieldValue, fieldPkgPath] = getPublishedField(rootPkg, field) | ||
for (const fieldName of knownFields) { | ||
const [fieldValue, fieldPkgPath] = getPublishedField(rootPkg, fieldName) | ||
if ( | ||
@@ -221,3 +221,18 @@ fieldValue != null && | ||
const fieldPath = vfs.pathJoin(pkgDir, fieldValue) | ||
await readFile(fieldPath, fieldPkgPath, ['.js', '/index.js']) | ||
const hasContent = | ||
(await readFile(fieldPath, fieldPkgPath, ['.js', '/index.js'])) !== | ||
false | ||
if ( | ||
hasContent && | ||
(fieldName === 'jsnext:main' || fieldName === 'jsnext') | ||
) { | ||
messages.push({ | ||
code: 'DEPRECATED_FIELD_JSNEXT', | ||
args: {}, | ||
path: fieldPkgPath, | ||
// `module` should be used instead, but if it's already specified, downgrade as a suggestion | ||
// as the jsnext fields are likely for compat only. | ||
type: module ? 'suggestion' : 'warning' | ||
}) | ||
} | ||
}) | ||
@@ -224,0 +239,0 @@ } |
@@ -150,2 +150,5 @@ import c from 'picocolors' | ||
return `${c.bold(fp(m.path))} is ${c.bold(pv(m.path))} which also matches ${c.bold(fp(m.args.browserPath))}: "${c.bold(pv(m.args.browserPath))}", which overrides the path when building the library with the "${c.bold(m.args.browserishCondition)}" condition. This is usually unintentional and may cause build issues. Consider using a different file name for ${c.bold(pv(m.path))}.` | ||
case 'DEPRECATED_FIELD_JSNEXT': | ||
// prettier-ignore | ||
return `${c.bold(fp(m.path))} is deprecated. ${c.bold('pkg.module')} should be used instead.` | ||
default: | ||
@@ -152,0 +155,0 @@ return |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70949
1854