Skip to content

chore(dev-deps): update eslint, prettier, vitest #333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { FC, ReactNode } from 'react';
import type { ButtonTheme } from '@components/Buttons/Button/ButtonTheme';

import cn from 'classnames';
import type { FC, ReactNode } from 'react';
import styles from './Button.module.scss';

interface Props {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState, type ComponentProps } from 'react';
import FileTree from '@tutorialkit/react/core/FileTree';
import { useState, type ComponentProps } from 'react';

export default function ExampleFileTree() {
const [files, setFiles] = useState(INITIAL_FILES);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Terminal as XTerm } from '@xterm/xterm';
import { Suspense, lazy, useEffect, useState } from 'react';
import { useTheme } from './hooks/useTheme';
import type { Terminal as XTerm } from '@xterm/xterm';
import { useWebContainer } from './hooks/useWebcontainer';

const Terminal = lazy(() => import('@tutorialkit/react/core/Terminal'));
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorialkit.dev/src/content/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineCollection } from 'astro:content';
import { docsSchema } from '@astrojs/starlight/schema';
import { defineCollection } from 'astro:content';

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
Expand Down
10 changes: 5 additions & 5 deletions extensions/vscode/scripts/build.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { watch } from 'chokidar';
import * as esbuild from 'esbuild';
import { execa } from 'execa';
import fs from 'node:fs';
import { createRequire } from 'node:module';
import { join, dirname } from 'path';
import { Worker } from 'node:worker_threads';
import { join, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { Worker } from 'node:worker_threads';
import { watch } from 'chokidar';
import * as esbuild from 'esbuild';
import { execa } from 'execa';

const __dirname = dirname(fileURLToPath(import.meta.url));
const require = createRequire(import.meta.url);
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/scripts/load-schema-worker.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { parentPort } from 'node:worker_threads';
import { zodToJsonSchema } from 'zod-to-json-schema';
import { contentSchema } from '@tutorialkit/types';
import { zodToJsonSchema } from 'zod-to-json-schema';

parentPort.postMessage(zodToJsonSchema(contentSchema));
4 changes: 2 additions & 2 deletions extensions/vscode/src/commands/tutorialkit.add.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { cmd } from '.';
import { Node, NodeType } from '../models/Node';
import * as vscode from 'vscode';
import { Node, NodeType } from '../models/Node';
import { FILES_FOLDER, SOLUTION_FOLDER } from '../models/tree/constants';
import { updateNodeMetadataInVFS } from '../models/tree/update';
import { cmd } from '.';

let kebabCase: (string: string) => string;
let capitalize: (string: string) => string;
Expand Down
4 changes: 2 additions & 2 deletions extensions/vscode/src/commands/tutorialkit.delete.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { cmd } from '.';
import * as vscode from 'vscode';
import { Node } from '../models/Node';
import { getLessonsTreeView } from '../global-state';
import { Node } from '../models/Node';
import { updateNodeMetadataInVFS } from '../models/tree/update';
import { cmd } from '.';

export async function deleteNode(selectedNode: Node | undefined, selectedNodes: Node[] | undefined) {
let nodes: readonly Node[] = (selectedNodes ? selectedNodes : [selectedNode]).filter((node) => node !== undefined);
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/commands/tutorialkit.initialize.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vscode from 'vscode';
import { cmd } from '.';
import isTutorialKitWorkspace from '../utils/isTutorialKit';
import { cmd } from '.';

export async function initialize(toastIfEmpty = false) {
const tutorialWorkpaces = (vscode.workspace.workspaceFolders || []).filter(isTutorialKitWorkspace);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as vscode from 'vscode';
import { extContext } from '../extension';
import { LessonsTreeDataProvider } from '../views/lessonsTree';
import { setLessonsTreeDataProvider, setLessonsTreeView } from '../global-state';
import { LessonsTreeDataProvider } from '../views/lessonsTree';

export async function loadTutorial(uri: vscode.Uri) {
const treeDataProvider = new LessonsTreeDataProvider(uri, extContext);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vscode from 'vscode';
import { cmd } from '.';
import isTutorialKitWorkspace from '../utils/isTutorialKit';
import { cmd } from '.';

export async function selectTutorial() {
const tutorialWorkpaces = (vscode.workspace.workspaceFolders || []).filter(isTutorialKitWorkspace);
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as serverProtocol from '@volar/language-server/protocol';
import { createLabsInfo } from '@volar/vscode';
import * as vscode from 'vscode';
import * as lsp from 'vscode-languageclient/node';
import { useCommands } from './commands';
import { useLessonTree } from './views/lessonsTree';
import * as lsp from 'vscode-languageclient/node';

export let extContext: vscode.ExtensionContext;

Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/global-state.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { TreeView } from 'vscode';
import type { LessonsTreeDataProvider } from './views/lessonsTree';
import type { Node } from './models/Node';
import type { LessonsTreeDataProvider } from './views/lessonsTree';

let lessonsTreeDataProvider: LessonsTreeDataProvider;
let lessonsTreeView: TreeView<Node>;
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/models/Node.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as vscode from 'vscode';
import type { TutorialSchema, PartSchema, ChapterSchema, LessonSchema } from '@tutorialkit/types';
import * as vscode from 'vscode';

export class Node {
/**
Expand Down
4 changes: 2 additions & 2 deletions extensions/vscode/src/models/tree/load.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as vscode from 'vscode';
import grayMatter from 'gray-matter';
import * as vscode from 'vscode';
import { Utils } from 'vscode-uri';
import { Metadata, Node } from '../Node';
import { METADATA_FILES, FILES_FOLDER, SOLUTION_FOLDER } from './constants';
import { Utils } from 'vscode-uri';

export async function loadTutorialTree(tutorialFolderPath: vscode.Uri, tutorialName: string): Promise<Node> {
const metaFilePath = vscode.Uri.joinPath(tutorialFolderPath, 'meta.md');
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/models/tree/update.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as vscode from 'vscode';
import grayMatter from 'gray-matter';
import * as vscode from 'vscode';
import { Node } from '../Node';

export async function updateNodeMetadataInVFS(node: Node) {
Expand Down
4 changes: 2 additions & 2 deletions extensions/vscode/src/utils/isTutorialKit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as fs from 'fs';
import * as path from 'path';
import * as fs from 'node:fs';
import * as path from 'node:path';
import * as vscode from 'vscode';

/**
Expand Down
6 changes: 3 additions & 3 deletions extensions/vscode/src/views/lessonsTree.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import path from 'node:path';
import * as vscode from 'vscode';
import path from 'path';
import { cmd } from '../commands';
import { Node } from '../models/Node';
import { getIcon } from '../utils/getIcon';
import { loadChildrenForNode, loadTutorialTree } from '../models/tree/load';
import { METADATA_FILES } from '../models/tree/constants';
import { loadChildrenForNode, loadTutorialTree } from '../models/tree/load';
import { getIcon } from '../utils/getIcon';

export const tutorialMimeType = 'application/tutorialkit.unit';

Expand Down
4 changes: 2 additions & 2 deletions integration/cli/create-tutorial.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path from 'node:path';
import fs from 'node:fs/promises';
import { describe, beforeEach, afterAll, expect, it } from 'vitest';
import path from 'node:path';
import { execa } from 'execa';
import { temporaryDirectory } from 'tempy';
import { describe, beforeEach, afterAll, expect, it } from 'vitest';

const baseDir = path.resolve(__dirname, '../..');

Expand Down
2 changes: 1 addition & 1 deletion integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"dependencies": {
"execa": "^9.2.0",
"tempy": "^3.1.0",
"vitest": "^1.6.0"
"vitest": "^2.1.1"
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
"license": "MIT",
"packageManager": "[email protected]",
"devDependencies": {
"@blitz/eslint-plugin": "0.1.0",
"@blitz/eslint-plugin": "0.1.2",
"@commitlint/config-conventional": "^19.2.2",
"add-stream": "^1.0.0",
"chalk": "^5.3.0",
"commitlint": "^19.3.0",
"conventional-changelog": "^6.0.0",
"eslint-plugin-astro": "^1.2.3",
"eslint-plugin-astro": "^1.2.4",
"husky": "^9.0.11",
"is-ci": "^3.0.1",
"prettier": "^3.3.2",
"prettier": "^3.3.3",
"prettier-plugin-astro": "^0.14.1",
"tempfile": "^5.0.0"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@
"esbuild-node-externals": "^1.13.1",
"execa": "^9.2.0",
"typescript": "^5.4.5",
"vite-plugin-inspect": "0.8.4",
"vitest": "^1.6.0"
"vitest": "^2.1.1"
},
"peerDependencies": {
"astro": "^4.15.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import assert from 'node:assert';
import path from 'node:path';
import { existsSync, rmSync, copyFileSync } from 'node:fs';
import { cp, rm } from 'node:fs/promises';
import { execa } from 'execa';
import path from 'node:path';
import chokidar from 'chokidar';
import esbuild from 'esbuild';
import { nodeExternalsPlugin } from 'esbuild-node-externals';
import { execa } from 'execa';

const isWatch = process.argv.includes('--watch');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect } from 'react';
import { useStore } from '@nanostores/react';
import { WorkspacePanel } from '@tutorialkit/react';
import type { Lesson } from '@tutorialkit/types';
import { useEffect } from 'react';
import { themeStore } from '../stores/theme-store.js';
import { tutorialStore } from './webcontainer.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/default/components/webcontainer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// must be imported first
// eslint-disable-next-line -- must be imported first
import { useAuth } from './setup.js';

import { safeBoot, TutorialStore } from '@tutorialkit/runtime';
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/default/utils/content.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import path from 'node:path';
import type { ChapterSchema, Lesson, LessonSchema, PartSchema, Tutorial, TutorialSchema } from '@tutorialkit/types';
import { interpolateString } from '@tutorialkit/types';
import { getCollection } from 'astro:content';
import path from 'node:path';
import { DEFAULT_LOCALIZATION } from './content/default-localization';
import { getFilesRefList } from './content/files-ref';
import { squash } from './content/squash.js';
import { logger } from './logger';
import { joinPaths } from './url';
import { getFilesRefList } from './content/files-ref';

export async function getTutorial(): Promise<Tutorial> {
const collection = sortCollection(await getCollection('tutorial'));
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/default/utils/content/files-ref.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'node:path';
import type { FilesRefList } from '@tutorialkit/types';
import { folderPathToFilesRef } from '@tutorialkit/types';
import glob from 'fast-glob';
import path from 'node:path';
import { IGNORED_FILES } from '../constants';

const CONTENT_DIR = path.join(process.cwd(), 'src/content/tutorial');
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/default/utils/content/squash.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, test, expect } from 'vitest';
import type { Lesson } from '@tutorialkit/types';
import { describe, it, test, expect } from 'vitest';
import { squash } from './squash.js';

type Metadata = Partial<Lesson['data']>;
Expand Down
5 changes: 2 additions & 3 deletions packages/astro/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { AstroConfig, AstroIntegration } from 'astro';
import { fileURLToPath } from 'node:url';
import type { AstroConfig, AstroIntegration } from 'astro';
import { extraIntegrations } from './integrations.js';
import { updateMarkdownConfig } from './remark/index.js';
import { tutorialkitCore } from './vite-plugins/core.js';
import { userlandCSS, watchUserlandCSS } from './vite-plugins/css.js';
import { tutorialkitStore } from './vite-plugins/store.js';
import { overrideComponents, type OverrideComponentsOptions } from './vite-plugins/override-components.js';
import { tutorialkitStore } from './vite-plugins/store.js';
import { WebContainerFiles } from './webcontainer-files/index.js';

export interface Options {
Expand Down Expand Up @@ -101,7 +101,6 @@ export default function createPlugin({
tutorialkitStore,
tutorialkitCore,
overrideComponents({ components, defaultRoutes: !!defaultRoutes }),
process.env.TUTORIALKIT_DEV ? (await import('vite-plugin-inspect')).default() : null,
],
},
});
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import mdx from '@astrojs/mdx';
import react from '@astrojs/react';
import { pluginCollapsibleSections } from '@expressive-code/plugin-collapsible-sections';
import { pluginLineNumbers } from '@expressive-code/plugin-line-numbers';
import { getInlineContentForPackage } from '@tutorialkit/theme';
import expressiveCode from 'astro-expressive-code';
import UnoCSS from 'unocss/astro';
import { getInlineContentForPackage } from '@tutorialkit/theme';

export function extraIntegrations({ root }: { root: string }) {
return [
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/remark/import-file.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import fs from 'node:fs';
import path from 'node:path';
import type { BaseSchema, ChapterSchema, LessonSchema, PartSchema, TutorialSchema } from '@tutorialkit/types';
import frontMatter from 'front-matter';
import * as kleur from 'kleur/colors';
import type { Root } from 'mdast';
import fs from 'node:fs';
import path from 'node:path';
import type { Transformer } from 'unified';
import { visit } from 'unist-util-visit';

Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/vite-plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
* the correct location to make sure the CSS customization are added after the
* default values.
*/
import fs from 'node:fs/promises';
import path from 'node:path';
import type { AstroIntegrationLogger } from 'astro';
import { watch } from 'chokidar';
import fs from 'fs/promises';
import path from 'path';
import type { ViteDevServer, VitePlugin } from '../types.js';
import type { AstroIntegrationLogger } from 'astro';

const CUSTOM_PATHS = ['theme.css', 'theme/index.css'];

Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/webcontainer-files/cache.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'node:path';
import type { AstroIntegrationLogger } from 'astro';
import { dim } from 'kleur/colors';
import path from 'node:path';
import type { ViteDevServer } from '../types.js';
import { withResolvers } from '../utils.js';
import { FILES_FOLDER_NAME, SOLUTION_FOLDER_NAME } from './constants.js';
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/webcontainer-files/filesmap.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { AstroIntegrationLogger } from 'astro';
import glob from 'fast-glob';
import fs from 'node:fs';
import path from 'node:path';
import type { AstroIntegrationLogger } from 'astro';
import glob from 'fast-glob';
import { z } from 'zod';
import type { Files } from '../types';
import { EXTEND_CONFIG_FILEPATH, IGNORED_FILES } from './constants';
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/webcontainer-files/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FSWatcher, watch } from 'chokidar';
import { dim } from 'kleur/colors';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { FSWatcher, watch } from 'chokidar';
import { dim } from 'kleur/colors';
import type { AstroBuildDoneOptions, AstroServerSetupOptions } from '../types.js';
import { FilesMapCache } from './cache.js';
import { FILES_FOLDER_NAME, IGNORED_FILES, SOLUTION_FOLDER_NAME } from './constants.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"esbuild-node-externals": "^1.13.1",
"fs-extra": "^11.2.0",
"tempy": "^3.1.0",
"vitest": "^1.6.0"
"vitest": "^2.1.1"
},
"engines": {
"node": ">=18.18.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/scripts/build-release.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import fsExtra from 'fs-extra';
import ignore from 'ignore';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { execa } from 'execa';
import fsExtra from 'fs-extra';
import ignore from 'ignore';
import { temporaryDirectoryTask } from 'tempy';
import { distFolder, overwritesFolder, templateDest, templatePath } from './_constants.js';
import { success } from './logger.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'node:fs';
import esbuild from 'esbuild';
import { nodeExternalsPlugin } from 'esbuild-node-externals';
import fs from 'node:fs';
import { distFolder, outDir } from './_constants.js';

const isWatch = process.argv.includes('--watch');
Expand Down
Loading