Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/wait-for-npm-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function propagationTimeoutError(
pending: ReadonlyMap<string, string>,
timeoutSeconds: number,
): Error {
const packageList = [...pending].map(([name, version]) => `${name}@${version}`).join(', ');
const packageList = Array.from(pending, ([name, version]) => `${name}@${version}`).join(', ');
return new Error(
`Timed out after ${timeoutSeconds}s waiting for npm propagation: ${packageList}`,
);
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/theme/components/home/FeatureToolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const determineActiveSection = () => {

// If no section found above, check if we're at the very bottom
if (activeId === activeSection.value) {
const lastSection = sections[sections.length - 1];
const lastSection = sections.at(-1);
if (
lastSection &&
window.innerHeight + window.scrollY >= document.documentElement.scrollHeight - 100
Expand Down
3 changes: 2 additions & 1 deletion docs/.vitepress/theme/components/home/TerminalTranscript.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ const restartAnimation = () => {
visibleLineCount.value = lineIndex + 1;
if (lineIndex === props.transcript.lines.length - 1) {
const completionTimer = window.setTimeout(
() => emit('complete'),
emit,
props.transcript.completionDelay ?? 900,
'complete',
);
timers.push(completionTimer);
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"prepare": "vp config"
},
"devDependencies": {
"@e18e/eslint-plugin": "catalog:",
"@emnapi/core": "catalog:",
"@emnapi/runtime": "catalog:",
"@napi-rs/cli": "catalog:",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ it('keeps local documentation anchors valid', () => {
'utf8',
);
const localSections = source.slice(source.indexOf('const localSections'));
const headings = [...guide.matchAll(/^## (.+)$/gm)].map((match) =>
const headings = Array.from(guide.matchAll(/^## (.+)$/gm), (match) =>
match[1].toLowerCase().replaceAll(' ', '-'),
);
for (const match of localSections.matchAll(/'[^']+': '([^']+)'/g)) {
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/migration/__tests__/vitest-v5.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2232,9 +2232,9 @@ export default defineConfig(CONFIG);`,
'checks.ts': 'export default { test: {} };',
});
const plan = planProject(root);
expect([...plan.projects[0].configFiles].map((file) => path.basename(file)).toSorted()).toEqual(
['checks.ts', 'test-base.ts', 'vite.config.ts'],
);
expect(
Array.from(plan.projects[0].configFiles, (file) => path.basename(file)).toSorted(),
).toEqual(['checks.ts', 'test-base.ts', 'vite.config.ts']);
expect(plan.findings.some(({ code }) => code === 'source-parse')).toBe(false);
expect(plan.changes.some(({ file }) => /plugin-(?:options|base)\.ts$/.test(file))).toBe(false);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/migration/migrator/catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ export function rewritePnpmWorkspaceYaml(
for (const key of updatedOverrideKeys) {
if (key.value.includes('>')) {
const splits = key.value.split('>');
if (splits[splits.length - 1].trim() === 'vite') {
if (splits.at(-1)!.trim() === 'vite') {
updatedOverrides.delete(key);
}
}
Expand Down Expand Up @@ -1253,7 +1253,7 @@ export function rewriteRootWorkspacePackageJson(
for (const key in pkg.pnpm?.overrides) {
if (key.includes('>')) {
const splits = key.split('>');
if (splits[splits.length - 1].trim() === 'vite') {
if (splits.at(-1)!.trim() === 'vite') {
delete pkg.pnpm.overrides[key];
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/migration/migrator/orchestrators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export function rewriteStandaloneProject(
for (const key in pkg.pnpm?.overrides) {
if (key.includes('>')) {
const splits = key.split('>');
if (splits[splits.length - 1].trim() === 'vite') {
if (splits.at(-1)!.trim() === 'vite') {
delete pkg.pnpm.overrides[key];
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/migration/migrator/tsup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,10 @@ export async function migrateTsupToTsdown(
}
}
for (const [configPath, sharedConfig] of sharedConfigs) {
const message = `${displayRelative(configPath, projectPath)} is shared by ${[
...sharedConfig.consumers.values(),
]
.map((consumer) => consumer.label)
const message = `${displayRelative(configPath, projectPath)} is shared by ${Array.from(
sharedConfig.consumers.values(),
(consumer) => consumer.label,
)
.toSorted()
.join(', ')}. It was preserved and must be migrated manually.`;
if (options?.report) {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/migration/migrator/vitest-v5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ export function planVitestV5Migration(
];
const projects: ProjectPlan[] = [];
const projectSources = new Map(
[...new Set(directories)].map((directory) => [
Array.from(new Set(directories), (directory) => [
directory,
new Map(filesInProject(directory).map((file) => [file, fs.readFileSync(file, 'utf8')])),
]),
Expand Down Expand Up @@ -931,7 +931,7 @@ function currentProjectConfigs(plan: VitestV5MigrationPlan): Map<string, string[
entries.flatMap((entry) => (entry.file ? [entry.file] : [])),
);
return new Map(
[...filesByProject].map(([directory, files]) => [
Array.from(filesByProject, ([directory, files]) => [
directory,
files.filter((file) => configs.has(file)),
]),
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/migration/vitest-v5/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ export class SourceEditor {
}
const propertyIndent =
multilinePrefix && object.properties.length ? indent : `${objectIndent} `;
const entries = [...additions.values()].map((property) =>
const entries = Array.from(additions.values(), (property) =>
printAddedProperty(property, propertyIndent, newline),
);
// A generated line comment must end before the original inline properties
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/migration/vitest-v5/scopes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ export function resolveVitestV5TestModes(
}
}
const modes = new Map<string, VitestV5TestMode>(
[...sources.keys()].map((file) => {
Array.from(sources.keys(), (file) => {
const matching: Array<{ scope: TestScope; certain: boolean }> = [];
let benchmarkFile = false;
// Match Vitest's source-text check, including its exact spelling.
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/utils/package-overrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function extractOverrideTargetName(key: string): string {
// Yarn uses `from/target`; retain a trailing scoped target as one name.
if (target.includes('/')) {
const segments = target.split('/');
const last = segments[segments.length - 1];
const last = segments.at(-1)!;
const scope = segments[segments.length - 2];
target = scope?.startsWith('@') ? `${scope}/${last}` : last;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/tools/src/sync-remote-deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ function globToRegExp(pattern: string): RegExp {
function mergeMinimumReleaseAgeExclude(entries: string[]): string[] {
// Dedupe exact-string duplicates (Set preserves insertion order) and parse
// each entry once.
const parsed = [...new Set(entries)].map((entry) => {
const parsed = Array.from(new Set(entries), (entry) => {
const { name, version } = parseExcludeEntry(entry);
return { entry, name, version };
});
Expand Down
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ catalog:
'@babel/preset-env': ^7.29.7
'@babel/preset-typescript': ^7.29.7
'@clack/core': ^1.5.1
'@e18e/eslint-plugin': ^0.8.1
'@emnapi/core': 2.0.0-alpha.5
'@emnapi/runtime': 2.0.0-alpha.5
'@iconify/vue': ^5.0.0
Expand Down
21 changes: 21 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,33 @@ export default defineConfig({
typeCheck: true,
},
plugins: ['unicorn', 'typescript', 'oxc'],
jsPlugins: ['@e18e/eslint-plugin'],
categories: {
correctness: 'error',
perf: 'error',
suspicious: 'error',
},
rules: {
// e18e's recommended rules, with exceptions for existing integrations and regex style.
'e18e/ban-dependencies': ['error', { allowed: ['cross-spawn', 'glob'] }],
'e18e/prefer-array-at': 'error',
'e18e/prefer-array-fill': 'error',
'e18e/prefer-array-from-map': 'error',
'e18e/prefer-array-some': 'error',
'e18e/prefer-array-to-reversed': 'error',
'e18e/prefer-array-to-sorted': 'error',
'e18e/prefer-array-to-spliced': 'error',
'e18e/prefer-date-now': 'error',
'e18e/prefer-includes': 'error',
'e18e/prefer-nullish-coalescing': 'error',
'e18e/prefer-object-has-own': 'error',
'e18e/prefer-regex-test': 'error',
// Its concat autofix can nest array arguments without TypeScript ESLint's type information.
'e18e/prefer-spread-syntax': 'off',
'e18e/prefer-static-regex': 'off',
'e18e/prefer-string-fromcharcode': 'error',
'e18e/prefer-timer-args': 'error',
'e18e/prefer-url-canparse': 'error',
'eslint/no-await-in-loop': 'off',
'no-console': ['error', { allow: ['error'] }],
'no-shadow': 'off',
Expand Down
Loading