@mui/internal-code-infra 0.1.1-canary.3 → 0.1.1-canary.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/build/brokenLinksChecker/__fixtures__/no-signal-forwarding.d.mts +1 -0
- package/build/changelog/fetchChangelogs.d.mts +9 -10
- package/build/changelog/index.d.mts +1 -0
- package/build/cli/cmdBaseline.d.mts +18 -0
- package/build/cli/cmdBuild.d.mts +4 -0
- package/build/cli/cmdNetlifyIgnore.d.mts +1 -1
- package/build/eslint/index.d.mts +1 -0
- package/build/eslint/mui/rules/no-constructor-assigned-field.d.mts +50 -0
- package/build/eslint/nodeSupportConfig.d.mts +11 -0
- package/build/eslint/packageJsonConfig.d.mts +7 -0
- package/build/remark/config.d.mts +5 -14
- package/build/utils/build.d.mts +14 -0
- package/build/utils/credentials.d.mts +2 -2
- package/build/utils/git.d.mts +30 -9
- package/build/utils/github.d.mts +8 -0
- package/build/utils/pnpm.d.mts +67 -3
- package/package.json +53 -43
- package/src/brokenLinksChecker/index.mjs +8 -1
- package/src/changelog/fetchChangelogs.mjs +66 -26
- package/src/changelog/index.mjs +3 -0
- package/src/cli/cmdBaseline.mjs +31 -0
- package/src/cli/cmdBuild.mjs +47 -0
- package/src/cli/cmdNetlifyIgnore.mjs +14 -7
- package/src/cli/cmdPublish.mjs +17 -3
- package/src/cli/cmdPublishNewPackage.mjs +11 -4
- package/src/cli/index.mjs +2 -0
- package/src/eslint/baseConfig.mjs +8 -0
- package/src/eslint/docsConfig.mjs +28 -10
- package/src/eslint/index.mjs +1 -0
- package/src/eslint/jsonConfig.mjs +2 -1
- package/src/eslint/mui/config.mjs +16 -1
- package/src/eslint/mui/index.mjs +2 -0
- package/src/eslint/mui/rules/disallow-react-api-in-server-components.mjs +4 -1
- package/src/eslint/mui/rules/no-constructor-assigned-field.mjs +183 -0
- package/src/eslint/nodeSupportConfig.mjs +70 -0
- package/src/eslint/packageJsonConfig.mjs +50 -0
- package/src/eslint/testConfig.mjs +4 -2
- package/src/remark/config.mjs +60 -13
- package/src/utils/build.mjs +34 -0
- package/src/utils/credentials.mjs +4 -3
- package/src/utils/extractErrorCodes.mjs +1 -3
- package/src/utils/git.mjs +107 -46
- package/src/utils/github.mjs +27 -0
- package/src/utils/pnpm.mjs +126 -25
- package/vale/styles/MUI/GoogleLatin.yml +5 -2
- package/vale/styles/MUI/CorrectRererenceCased.yml +0 -14
package/src/utils/git.mjs
CHANGED
|
@@ -9,68 +9,63 @@ import gitUrlParse from 'git-url-parse';
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* The repository a remote URL points at, if it is a GitHub repository under `mui`.
|
|
13
|
+
* @param {string} url
|
|
14
|
+
* @returns {{ owner: string, repo: string } | null}
|
|
15
|
+
*/
|
|
16
|
+
function muiRepositoryOf(url) {
|
|
17
|
+
try {
|
|
18
|
+
const parsed = gitUrlParse(url);
|
|
19
|
+
return parsed.source === 'github.com' && parsed.owner === 'mui'
|
|
20
|
+
? { owner: parsed.owner, repo: parsed.name }
|
|
21
|
+
: null;
|
|
22
|
+
} catch {
|
|
23
|
+
// Not a URL git-url-parse understands, such as a local path: not a mui repository either.
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The canonical repository's remote, as opposed to a fork's: `upstream`, else `origin`, each only if
|
|
30
|
+
* it points at a mui repository. Reads the configured URLs, which `insteadOf` does not rewrite.
|
|
13
31
|
* @param {string} [cwd=process.cwd()]
|
|
14
|
-
* @returns {Promise<RepoInfo>}
|
|
32
|
+
* @returns {Promise<RepoInfo>}
|
|
15
33
|
*/
|
|
16
34
|
export async function getRepositoryInfo(cwd = process.cwd()) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @type {Map<string, { owner: string, repo: string }>}
|
|
29
|
-
*/
|
|
30
|
-
const validRemotes = new Map();
|
|
31
|
-
|
|
32
|
-
for (const line of lines) {
|
|
33
|
-
// Match pattern: "remoteName url (fetch|push)"
|
|
34
|
-
const [remoteName, url, type] = line.trim().split(/\s+/, 3);
|
|
35
|
-
repoRemotes.add(remoteName);
|
|
36
|
-
if (type === '(fetch)') {
|
|
37
|
-
try {
|
|
38
|
-
const parsed = gitUrlParse(url);
|
|
39
|
-
if (parsed.source !== 'github.com' || parsed.owner !== 'mui') {
|
|
40
|
-
cause[remoteName] = `Remote is not a GitHub repository under 'mui' organization: ${url}`;
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
if (!validRemotes.has(remoteName)) {
|
|
44
|
-
validRemotes.set(remoteName, { owner: parsed.owner, repo: parsed.name });
|
|
45
|
-
}
|
|
46
|
-
} catch (error) {
|
|
47
|
-
cause[remoteName] = `Failed to parse URL for remote ${remoteName}: ${url}`;
|
|
48
|
-
}
|
|
49
|
-
} else if (type !== '(push)') {
|
|
50
|
-
throw new Error(`Unexpected line format for "git remote -v": "${line}"`);
|
|
51
|
-
}
|
|
35
|
+
// Exits 1 when neither remote is configured; the error below reports that.
|
|
36
|
+
const { stdout } = await $({
|
|
37
|
+
cwd,
|
|
38
|
+
reject: false,
|
|
39
|
+
})`git config --get-regexp ${'^remote\\.(upstream|origin)\\.url$'}`;
|
|
40
|
+
/** @type {Map<string, string>} */
|
|
41
|
+
const urls = new Map();
|
|
42
|
+
for (const line of stdout.split('\n').filter(Boolean)) {
|
|
43
|
+
const [key, url] = line.split(' ', 2);
|
|
44
|
+
urls.set(key.slice('remote.'.length, -'.url'.length), url);
|
|
52
45
|
}
|
|
53
46
|
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
-
return { ...
|
|
47
|
+
for (const remoteName of ['upstream', 'origin']) {
|
|
48
|
+
const url = urls.get(remoteName);
|
|
49
|
+
const repository = url ? muiRepositoryOf(url) : null;
|
|
50
|
+
if (repository) {
|
|
51
|
+
return { ...repository, remoteName };
|
|
59
52
|
}
|
|
60
53
|
}
|
|
61
54
|
|
|
55
|
+
const found = [...urls].map(([name, url]) => `${name}: ${url}`).join(', ') || 'none';
|
|
62
56
|
throw new Error(
|
|
63
|
-
`
|
|
64
|
-
|
|
57
|
+
`No canonical remote: neither \`upstream\` nor \`origin\` points at a mui repository (${found}). ` +
|
|
58
|
+
'Add an `upstream` remote for it, or name the remote explicitly where the command allows it.',
|
|
65
59
|
);
|
|
66
60
|
}
|
|
67
61
|
|
|
68
62
|
/**
|
|
69
63
|
* Get current git SHA
|
|
64
|
+
* @param {string} [cwd=process.cwd()]
|
|
70
65
|
* @returns {Promise<string>} Current git commit SHA
|
|
71
66
|
*/
|
|
72
|
-
export async function getCurrentGitSha() {
|
|
73
|
-
const result = await
|
|
67
|
+
export async function getCurrentGitSha(cwd = process.cwd()) {
|
|
68
|
+
const result = await $({ cwd })`git rev-parse HEAD`;
|
|
74
69
|
return result.stdout.trim();
|
|
75
70
|
}
|
|
76
71
|
|
|
@@ -84,3 +79,69 @@ export async function remoteGitTagExists(tagName, cwd = process.cwd()) {
|
|
|
84
79
|
const { stdout } = await $({ cwd })`git ls-remote --tags origin refs/tags/${tagName}`;
|
|
85
80
|
return stdout.trim().length > 0;
|
|
86
81
|
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The default branch of `remote`, as the remote itself reports it.
|
|
85
|
+
* @param {string} remote
|
|
86
|
+
* @param {string} cwd
|
|
87
|
+
* @returns {Promise<string>}
|
|
88
|
+
*/
|
|
89
|
+
async function getDefaultBranchOf(remote, cwd) {
|
|
90
|
+
const { stdout } = await $({ cwd })`git ls-remote --symref ${remote} HEAD`;
|
|
91
|
+
const match = /^ref: refs\/heads\/(\S+)\tHEAD$/m.exec(stdout);
|
|
92
|
+
if (!match) {
|
|
93
|
+
throw new Error(`Remote "${remote}" does not report a default branch.`);
|
|
94
|
+
}
|
|
95
|
+
return match[1];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The commit HEAD should be compared against: where it forked from the base branch, or its parent
|
|
100
|
+
* when HEAD is already on the base branch.
|
|
101
|
+
* @param {Object} [options]
|
|
102
|
+
* @param {string} [options.cwd]
|
|
103
|
+
* @param {string} [options.remote] - Defaults to the canonical remote.
|
|
104
|
+
* @param {string} [options.baseBranch] - Defaults to the remote's default branch.
|
|
105
|
+
* @returns {Promise<string>}
|
|
106
|
+
*/
|
|
107
|
+
export async function resolveBaseline(options = {}) {
|
|
108
|
+
const cwd = options.cwd ?? process.cwd();
|
|
109
|
+
const remote = options.remote ?? (await getRepositoryInfo(cwd)).remoteName;
|
|
110
|
+
const baseBranch = options.baseBranch ?? (await getDefaultBranchOf(remote, cwd));
|
|
111
|
+
|
|
112
|
+
await $({ cwd })`git fetch --no-tags ${remote} ${baseBranch}`;
|
|
113
|
+
const [forkPoint, head] = await Promise.all([
|
|
114
|
+
$({ cwd })`git merge-base HEAD FETCH_HEAD`.then((result) => result.stdout.trim()),
|
|
115
|
+
getCurrentGitSha(cwd),
|
|
116
|
+
]);
|
|
117
|
+
if (forkPoint !== head) {
|
|
118
|
+
return forkPoint;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const parent = await $({ cwd, reject: false })`git rev-parse --verify HEAD~1`;
|
|
122
|
+
if (parent.exitCode !== 0) {
|
|
123
|
+
throw new Error(
|
|
124
|
+
'HEAD has no parent commit to compare against. A shallow clone is the usual cause.',
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
return parent.stdout.trim();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The most recent version tag reachable from HEAD — where a changelog's range starts.
|
|
132
|
+
* @param {Object} opts
|
|
133
|
+
* @param {string} opts.cwd
|
|
134
|
+
* @param {boolean} [opts.fetchAll=true] Whether to fetch all tags from all remotes before finding the latest tag.
|
|
135
|
+
* @returns {Promise<string>}
|
|
136
|
+
*/
|
|
137
|
+
export async function findLatestTaggedVersion(opts) {
|
|
138
|
+
const $$ = $({ cwd: opts.cwd });
|
|
139
|
+
const fetchAll = opts.fetchAll ?? true;
|
|
140
|
+
if (fetchAll) {
|
|
141
|
+
// --force to update any existing tags that may have changed to avoid the clobering error.
|
|
142
|
+
const { remoteName } = await getRepositoryInfo(opts.cwd);
|
|
143
|
+
await $$`git fetch --tags --force ${remoteName}`;
|
|
144
|
+
}
|
|
145
|
+
const { stdout } = await $$`git describe --tags --abbrev=0 --match ${'v*'}`; // only include "version-tags"
|
|
146
|
+
return stdout.trim();
|
|
147
|
+
}
|
package/src/utils/github.mjs
CHANGED
|
@@ -261,3 +261,30 @@ export async function endToEndGhAuthGetToken({ log = false } = {}) {
|
|
|
261
261
|
export async function clearGitHubAuth() {
|
|
262
262
|
await credentials.deleteKey(GITHUB_APP_CREDENTIAL_KEY);
|
|
263
263
|
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Returns when a rate-limited request may be retried, or `null` for other errors.
|
|
267
|
+
* https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api#exceeding-the-rate-limit
|
|
268
|
+
*
|
|
269
|
+
* @param {unknown} error
|
|
270
|
+
* @returns {Date | null}
|
|
271
|
+
*/
|
|
272
|
+
export function getRateLimitRetryTime(error) {
|
|
273
|
+
const { status, response, message } = /** @type {any} */ (error) ?? {};
|
|
274
|
+
if (status !== 403 && status !== 429) {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
const headers = response?.headers ?? {};
|
|
278
|
+
const now = Date.now();
|
|
279
|
+
let retryTime;
|
|
280
|
+
if (headers['retry-after']) {
|
|
281
|
+
retryTime = now + Number(headers['retry-after']) * 1000;
|
|
282
|
+
} else if (headers['x-ratelimit-remaining'] === '0' && headers['x-ratelimit-reset']) {
|
|
283
|
+
retryTime = Number(headers['x-ratelimit-reset']) * 1000;
|
|
284
|
+
} else if (/rate limit/i.test(message ?? '')) {
|
|
285
|
+
retryTime = now;
|
|
286
|
+
} else {
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
return new Date(Math.max(retryTime, now + 60_000));
|
|
290
|
+
}
|
package/src/utils/pnpm.mjs
CHANGED
|
@@ -12,6 +12,9 @@ import { parseDocument, isMap } from 'yaml';
|
|
|
12
12
|
/** Canonical npm registry URL, in the form `getPublishRegistry` returns. */
|
|
13
13
|
const NPMJS_REGISTRY = 'https://registry.npmjs.org/';
|
|
14
14
|
|
|
15
|
+
/** Version that `publish-new-package` publishes to reserve the name of a new package. */
|
|
16
|
+
export const PLACEHOLDER_VERSION = '0.0.1';
|
|
17
|
+
|
|
15
18
|
/**
|
|
16
19
|
* @typedef {Object} PrivatePackage
|
|
17
20
|
* @property {string} [name] - Package name
|
|
@@ -189,49 +192,147 @@ function requiresTrustedPublisherBootstrap(registry) {
|
|
|
189
192
|
}
|
|
190
193
|
|
|
191
194
|
/**
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
|
|
195
|
+
* @typedef {Object} RegistryPackage
|
|
196
|
+
* @property {string} registry - Registry that the package publishes to
|
|
197
|
+
* @property {boolean} exists - Whether the package is on the registry
|
|
198
|
+
* @property {Record<string, string>} distTags - Dist-tags of the package
|
|
199
|
+
* @property {string[]} versions - Published versions of the package
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Read each package from its publish registry with `pnpm view`, so the lookup uses the
|
|
204
|
+
* same registry configuration and credentials as `pnpm publish`.
|
|
198
205
|
*
|
|
199
|
-
* @param {PublicPackage[]} packages - Packages to
|
|
200
|
-
* @
|
|
206
|
+
* @param {PublicPackage[]} packages - Packages to read
|
|
207
|
+
* @param {{ npmOnly?: boolean }} [options] - `npmOnly` reads only the packages that publish to npm.
|
|
208
|
+
* Checks that only concern npm use it, so a missing credential for another registry does not block them.
|
|
209
|
+
* @returns {Promise<Map<string, RegistryPackage>>} By package name
|
|
201
210
|
*/
|
|
202
|
-
export async function
|
|
203
|
-
const
|
|
211
|
+
export async function getRegistryPackages(packages, { npmOnly = false } = {}) {
|
|
212
|
+
const entries = await Promise.all(
|
|
204
213
|
packages.map(async (pkg) => {
|
|
205
214
|
const registry = await getPublishRegistry(pkg.path);
|
|
206
|
-
if (
|
|
207
|
-
return
|
|
215
|
+
if (npmOnly && registry !== NPMJS_REGISTRY) {
|
|
216
|
+
return null;
|
|
208
217
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
218
|
+
const { exitCode, stdout, stderr } = await $({
|
|
219
|
+
cwd: pkg.path,
|
|
220
|
+
reject: false,
|
|
221
|
+
// pnpm resolves its own `packageManager` version from `--registry`, which may not serve it.
|
|
222
|
+
env: { PNPM_CONFIG_PM_ON_FAIL: 'ignore' },
|
|
223
|
+
})`pnpm view ${pkg.name} dist-tags versions --json --registry ${registry}`;
|
|
224
|
+
let info;
|
|
225
|
+
try {
|
|
226
|
+
info = JSON.parse(stdout || '{}');
|
|
227
|
+
} catch {
|
|
228
|
+
info = {};
|
|
214
229
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
// silently disable the check, so fail loudly instead.
|
|
230
|
+
// Anything but a 404 tells nothing about whether the package exists. Treating it as
|
|
231
|
+
// "not published" would silently disable the checks, so fail loudly instead.
|
|
232
|
+
if (exitCode !== 0 && info.error?.code !== 'ERR_PNPM_FETCH_404') {
|
|
219
233
|
throw new Error(
|
|
220
|
-
`Failed to
|
|
234
|
+
`Failed to read ${pkg.name} from ${registry}: ${info.error?.message ?? stderr}`,
|
|
221
235
|
);
|
|
222
236
|
}
|
|
223
|
-
|
|
237
|
+
/** @type {RegistryPackage} */
|
|
238
|
+
const registryPackage = {
|
|
239
|
+
registry,
|
|
240
|
+
exists: exitCode === 0,
|
|
241
|
+
distTags: info['dist-tags'] ?? {},
|
|
242
|
+
versions: [info.versions ?? []].flat(),
|
|
243
|
+
};
|
|
244
|
+
return /** @type {const} */ ([pkg.name, registryPackage]);
|
|
224
245
|
}),
|
|
225
246
|
);
|
|
247
|
+
return new Map(entries.filter((entry) => entry !== null));
|
|
248
|
+
}
|
|
226
249
|
|
|
227
|
-
|
|
250
|
+
/**
|
|
251
|
+
* Filter to the packages that must be published by hand before CI can take over.
|
|
252
|
+
*
|
|
253
|
+
* A brand new package has to be pushed once manually (see
|
|
254
|
+
* `code-infra publish-new-package`) before the OIDC-based workflow can publish
|
|
255
|
+
* it, so the release fails with a clear message instead of a confusing 404
|
|
256
|
+
* midway through. See {@link getPackageVersionInfo} for the version-level check.
|
|
257
|
+
*
|
|
258
|
+
* @param {PublicPackage[]} packages - Packages to check
|
|
259
|
+
* @param {Map<string, RegistryPackage>} registryPackages - Registry data from {@link getRegistryPackages}
|
|
260
|
+
* @returns {PublicPackage[]} The subset needing a manual first publish
|
|
261
|
+
*/
|
|
262
|
+
export function getPackagesNeedingManualPublish(packages, registryPackages) {
|
|
263
|
+
return packages.filter((pkg) => {
|
|
264
|
+
const registryPackage = registryPackages.get(pkg.name);
|
|
265
|
+
return (
|
|
266
|
+
registryPackage !== undefined &&
|
|
267
|
+
!registryPackage.exists &&
|
|
268
|
+
requiresTrustedPublisherBootstrap(registryPackage.registry)
|
|
269
|
+
);
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Why publishing `version` with `tag` would move the dist-tag to the wrong release line.
|
|
275
|
+
*
|
|
276
|
+
* @param {string} tag - Dist-tag to publish with
|
|
277
|
+
* @param {string} version - Version to publish
|
|
278
|
+
* @param {string} current - Version that the dist-tag points to on the registry
|
|
279
|
+
* @returns {string | null} The reason, or null when the publish is safe
|
|
280
|
+
*/
|
|
281
|
+
function getDistTagConflict(tag, version, current) {
|
|
282
|
+
if (semver.lt(version, current)) {
|
|
283
|
+
return `"${tag}" can only move to a newer version, but ${version} is lower than the current ${current}`;
|
|
284
|
+
}
|
|
285
|
+
// A tag that already points to a prerelease can move to the next one, for packages still in beta.
|
|
286
|
+
if (
|
|
287
|
+
(tag === 'latest' || tag.startsWith('latest-')) &&
|
|
288
|
+
semver.prerelease(version) &&
|
|
289
|
+
!semver.prerelease(current)
|
|
290
|
+
) {
|
|
291
|
+
return `"${tag}" cannot point to a prerelease (${version})`;
|
|
292
|
+
}
|
|
293
|
+
if (tag.startsWith('latest-') && semver.major(version) !== semver.major(current)) {
|
|
294
|
+
return `"${tag}" cannot cross a major (${current} to ${version})`;
|
|
295
|
+
}
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* @typedef {Object} DistTagConflict
|
|
301
|
+
* @property {PublicPackage} pkg - Package to publish
|
|
302
|
+
* @property {string} reason - Why the dist-tag would move to the wrong release line
|
|
303
|
+
*/
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Find the packages whose publish with `tag` would move the dist-tag to the wrong release line.
|
|
307
|
+
*
|
|
308
|
+
* @param {PublicPackage[]} packages - Packages to publish
|
|
309
|
+
* @param {string} tag - Dist-tag to publish with
|
|
310
|
+
* @param {Map<string, RegistryPackage>} registryPackages - Registry data from {@link getRegistryPackages}
|
|
311
|
+
* @returns {DistTagConflict[]}
|
|
312
|
+
*/
|
|
313
|
+
export function getDistTagConflicts(packages, tag, registryPackages) {
|
|
314
|
+
return packages.flatMap((pkg) => {
|
|
315
|
+
const registryPackage = registryPackages.get(pkg.name);
|
|
316
|
+
// pnpm skips versions that are already published, such as unchanged packages on a legacy branch.
|
|
317
|
+
if (!registryPackage || registryPackage.versions.includes(pkg.version)) {
|
|
318
|
+
return [];
|
|
319
|
+
}
|
|
320
|
+
// A package that is not on the registry yet has no dist-tags to protect, and npm points
|
|
321
|
+
// `latest` at the first version, which is the placeholder for a new package.
|
|
322
|
+
const current = semver.valid(registryPackage.distTags[tag]);
|
|
323
|
+
if (!current || current === PLACEHOLDER_VERSION) {
|
|
324
|
+
return [];
|
|
325
|
+
}
|
|
326
|
+
const reason = getDistTagConflict(tag, pkg.version, current);
|
|
327
|
+
return reason ? [{ pkg, reason }] : [];
|
|
328
|
+
});
|
|
228
329
|
}
|
|
229
330
|
|
|
230
331
|
/**
|
|
231
332
|
* Get package version info from registry.
|
|
232
333
|
*
|
|
233
334
|
* Resolves through `pnpm view`, which reports a lookup failure the same way it
|
|
234
|
-
* reports a missing version. Use {@link
|
|
335
|
+
* reports a missing version. Use {@link getRegistryPackages} where
|
|
235
336
|
* absence has to be told apart from an error.
|
|
236
337
|
*
|
|
237
338
|
* @param {string} packageName - Name of the package
|
|
@@ -6,6 +6,9 @@ level: error
|
|
|
6
6
|
nonword: true
|
|
7
7
|
action:
|
|
8
8
|
name: replace
|
|
9
|
+
# Wider than upstream Google.Latin: also catches e.g/eg./i.e/ie. and any trailing
|
|
10
|
+
# punctuation, so no separate rule asks for "e.g." (which this one forbids).
|
|
11
|
+
# The lookbehind skips matches after a dot or inside a word (example.eg).
|
|
9
12
|
swap:
|
|
10
|
-
'\
|
|
11
|
-
'\
|
|
13
|
+
'(?<![\w.])e\.?g\.?(?=[^\w.]|$)': for example
|
|
14
|
+
'(?<![\w.])i\.?e\.?(?=[^\w.]|$)': that is
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Write things correctly, please no wrong references.
|
|
2
|
-
extends: substitution
|
|
3
|
-
message: Use '%s' instead of '%s'
|
|
4
|
-
level: error
|
|
5
|
-
ignorecase: false
|
|
6
|
-
# swap maps tokens in form of bad: good
|
|
7
|
-
# for more information: https://vale.sh/docs/topics/styles/#substitution
|
|
8
|
-
swap:
|
|
9
|
-
eg: e.g.
|
|
10
|
-
eg\.: e.g.
|
|
11
|
-
e\.g: e.g.
|
|
12
|
-
ie: i.e.
|
|
13
|
-
ie\.: i.e.
|
|
14
|
-
i\.e: i.e.
|