Skip to content

Commit

Permalink
Bump dependencies - Sep 2024 (microsoft#4424)
Browse files Browse the repository at this point in the history
Notable:
- Typescript 5.6: iterator functions  and more
- typescript-eslint 8: new rules, breaking change to some other, found a
few bugs/test not actually testing
- eslint 9: new rules
- removed deprecation/deprecation plugin as typescript eslint has rule
for it now(and updated) many places where it wasn't reporting correctly
  • Loading branch information
timotheeguerin authored and sarangan12 committed Sep 16, 2024
1 parent 494cbe3 commit ea7fde0
Show file tree
Hide file tree
Showing 88 changed files with 396 additions and 431 deletions.
27 changes: 27 additions & 0 deletions .chronus/changes/upgrade-deps-sep-2024-2024-8-13-0-37-48.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking
changeKind: dependencies
packages:
- "@typespec/bundler"
- "@typespec/compiler"
- "@typespec/eslint-plugin"
- "@typespec/html-program-viewer"
- "@typespec/http-server-csharp"
- "@typespec/http-server-javascript"
- "@typespec/http"
- "@typespec/internal-build-utils"
- "@typespec/json-schema"
- "@typespec/library-linter"
- "@typespec/openapi"
- "@typespec/openapi3"
- "@typespec/playground"
- "@typespec/prettier-plugin-typespec"
- "@typespec/protobuf"
- "@typespec/rest"
- tmlanguage-generator
- typespec-vscode
- "@typespec/versioning"
- "@typespec/xml"
---

Bump dependencies
4 changes: 4 additions & 0 deletions api-extractor.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
"compilerMessageReporting": {
"default": {
"logLevel": "error"
},
"TS2552": {
"logLevel": "none", // False positive with non support for 5.6 yet
"addToApiReportFile": false
}
},

Expand Down
31 changes: 19 additions & 12 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
// @ts-check
import eslint from "@eslint/js";
import deprecation from "eslint-plugin-deprecation";
import reactHooks from "eslint-plugin-react-hooks";
import unicorn from "eslint-plugin-unicorn";
import vitest from "eslint-plugin-vitest";
import { dirname } from "path";
import tsEslint from "typescript-eslint";
import { fileURLToPath } from "url";

/** Config that will apply to all files */
const allFilesConfig = tsEslint.config({
Expand All @@ -22,13 +19,23 @@ const allFilesConfig = tsEslint.config({
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{ varsIgnorePattern: "^_", argsIgnorePattern: ".*", ignoreRestSiblings: true },
{
varsIgnorePattern: "^_",
argsIgnorePattern: ".*",
ignoreRestSiblings: true,
caughtErrorsIgnorePattern: ".*",
},
],

// This rule is bugged https://github.com/typescript-eslint/typescript-eslint/issues/6538
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-unused-expressions": [
"warn",
{ allowShortCircuit: true, allowTernary: true },
],

/**
* Unicorn
Expand Down Expand Up @@ -65,21 +72,21 @@ const allFilesConfig = tsEslint.config({
*/
export function getTypeScriptProjectRules(root) {
return tsEslint.config({
files: ["**/*.ts", "**/*.tsx"],
ignores: ["packages/http-client-csharp/**/*"], // Ignore isolated modules
plugins: {
deprecation,
},
files: ["**/packages/*/src/**/*.ts", "**/packages/*/src/**/*.tsx"],
ignores: ["**/packages/http-client-csharp/**/*", "**/packages/http-client-java/**/*"], // Ignore isolated modules
plugins: {},
languageOptions: {
parserOptions: {
project: "./tsconfig.json",
projectService: {
allowDefaultProject: ["packages/*/vitest.config.ts"],
},
tsconfigRootDir: root,
},
},
rules: {
// Only put rules here that need typescript project information
"@typescript-eslint/no-floating-promises": "error",
"deprecation/deprecation": ["warn"],
"@typescript-eslint/no-deprecated": "warn",
},
});
}
Expand Down Expand Up @@ -140,5 +147,5 @@ export default tsEslint.config(
],
},
...TypeSpecCommonEslintConfigs,
...getTypeScriptProjectRules(dirname(fileURLToPath(import.meta.url)))
...getTypeScriptProjectRules(import.meta.dirname)
);
42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,38 @@
"sync-labels": "tsx ./eng/common/scripts/labels/sync-labels.ts --config ./eng/common/config/labels.ts"
},
"devDependencies": {
"@chronus/chronus": "^0.11.0",
"@chronus/github": "^0.4.1",
"@eslint/js": "^8.57.0",
"@microsoft/api-extractor": "^7.47.7",
"@chronus/chronus": "^0.12.1",
"@chronus/github": "^0.4.3",
"@eslint/js": "^9.10.0",
"@microsoft/api-extractor": "^7.47.9",
"@octokit/core": "^6.1.2",
"@octokit/plugin-paginate-graphql": "^5.2.2",
"@octokit/plugin-rest-endpoint-methods": "^13.2.4",
"@pnpm/find-workspace-packages": "^6.0.9",
"@types/micromatch": "^4.0.9",
"@types/node": "~18.11.19",
"@typescript-eslint/parser": "^7.17.0",
"@typescript-eslint/utils": "^7.17.0",
"@vitest/coverage-v8": "^2.0.4",
"@types/node": "~22.5.4",
"@typescript-eslint/parser": "^8.5.0",
"@typescript-eslint/utils": "^8.5.0",
"@vitest/coverage-v8": "^2.1.0",
"c8": "^10.1.2",
"cspell": "^8.12.1",
"eslint": "^8.57.0",
"cspell": "^8.14.2",
"eslint": "^9.10.0",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-unicorn": "^54.0.0",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-react-hooks": "^5.1.0-rc-94e652d5-20240912",
"eslint-plugin-unicorn": "^55.0.0",
"eslint-plugin-vitest": "^0.5.4",
"micromatch": "^4.0.7",
"picocolors": "~1.0.1",
"micromatch": "^4.0.8",
"picocolors": "~1.1.0",
"prettier": "~3.3.3",
"prettier-plugin-organize-imports": "~4.0.0",
"rimraf": "~6.0.1",
"syncpack": "^12.3.3",
"tsx": "^4.16.2",
"typescript": "~5.5.4",
"typescript-eslint": "^7.17.0",
"vitest": "^2.0.4",
"yaml": "~2.4.5"
"syncpack": "^13.0.0",
"tsx": "^4.19.1",
"typescript": "~5.6.2",
"typescript-eslint": "^8.5.0",
"vitest": "^2.1.0",
"yaml": "~2.5.1"
},
"syncpack": {
"dependencyTypes": [
Expand Down
10 changes: 5 additions & 5 deletions packages/best-practices/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@
"@typespec/compiler": "workspace:~"
},
"devDependencies": {
"@types/node": "~18.11.19",
"@types/node": "~22.5.4",
"@typespec/compiler": "workspace:~",
"@vitest/coverage-v8": "^2.0.4",
"@vitest/ui": "^2.0.4",
"@vitest/coverage-v8": "^2.1.0",
"@vitest/ui": "^2.1.0",
"c8": "^10.1.2",
"rimraf": "~6.0.1",
"typescript": "~5.5.4",
"vitest": "^2.0.4"
"typescript": "~5.6.2",
"vitest": "^2.1.0"
}
}
14 changes: 7 additions & 7 deletions packages/bundle-uploader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@
"!dist/test/**"
],
"dependencies": {
"@azure/identity": "~4.4.0",
"@azure/identity": "~4.4.1",
"@azure/storage-blob": "~12.24.0",
"@pnpm/find-workspace-packages": "^6.0.9",
"@typespec/bundler": "workspace:~",
"json5": "^2.2.3",
"picocolors": "~1.0.1",
"picocolors": "~1.1.0",
"semver": "^7.6.3"
},
"devDependencies": {
"@types/node": "~18.11.19",
"@types/node": "~22.5.4",
"@types/semver": "^7.5.8",
"@vitest/coverage-v8": "^2.0.4",
"@vitest/ui": "^2.0.4",
"@vitest/coverage-v8": "^2.1.0",
"@vitest/ui": "^2.1.0",
"c8": "^10.1.2",
"rimraf": "~6.0.1",
"typescript": "~5.5.4",
"vitest": "^2.0.4"
"typescript": "~5.6.2",
"vitest": "^2.1.0"
}
}
18 changes: 9 additions & 9 deletions packages/bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@
"@rollup/plugin-node-resolve": "~15.2.3",
"@rollup/plugin-virtual": "~3.0.2",
"@typespec/compiler": "workspace:~",
"picocolors": "~1.0.1",
"rollup": "~4.19.0",
"picocolors": "~1.1.0",
"rollup": "~4.21.3",
"yargs": "~17.7.2"
},
"devDependencies": {
"@types/node": "~18.11.19",
"@types/yargs": "~17.0.32",
"@vitest/coverage-v8": "^2.0.4",
"@vitest/ui": "^2.0.4",
"@types/node": "~22.5.4",
"@types/yargs": "~17.0.33",
"@vitest/coverage-v8": "^2.1.0",
"@vitest/ui": "^2.1.0",
"c8": "^10.1.2",
"rimraf": "~6.0.1",
"typescript": "~5.5.4",
"vite": "^5.3.4",
"vitest": "^2.0.4"
"typescript": "~5.6.2",
"vite": "^5.4.4",
"vitest": "^2.1.0"
}
}
11 changes: 1 addition & 10 deletions packages/bundler/src/bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@ import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import nodeResolve from "@rollup/plugin-node-resolve";
import virtual from "@rollup/plugin-virtual";
import {
compile,
getNormalizedAbsolutePath,
joinPaths,
NodeHost,
normalizePath,
resolvePath,
} from "@typespec/compiler";
import { compile, joinPaths, NodeHost, normalizePath, resolvePath } from "@typespec/compiler";
import { mkdir, readFile, realpath, writeFile } from "fs/promises";
import { basename, join, resolve } from "path";
import { OutputChunk, rollup, RollupBuild, RollupOptions, watch } from "rollup";
Expand Down Expand Up @@ -91,7 +84,6 @@ export async function watchTypeSpecBundle(
},
});

// eslint-disable-next-line @typescript-eslint/no-misused-promises
watcher.on("event", async (event) => {
switch (event.code) {
case "BUNDLE_START":
Expand Down Expand Up @@ -257,7 +249,6 @@ function createBundleEntrypoint({
const relativeTypeSpecFiles: Record<string, string> = {};
for (const [name, content] of Object.entries(typespecSourceFiles)) {
relativeTypeSpecFiles[relativeTo(libraryPath, name)] = content;
getNormalizedAbsolutePath;
}
return [
`export * from "${absoluteMain}";`,
Expand Down
18 changes: 9 additions & 9 deletions packages/compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,34 +87,34 @@
"change-case": "~5.4.4",
"globby": "~14.0.2",
"mustache": "~4.2.0",
"picocolors": "~1.0.1",
"picocolors": "~1.1.0",
"prettier": "~3.3.3",
"prompts": "~2.4.2",
"semver": "^7.6.3",
"temporal-polyfill": "^0.2.5",
"vscode-languageserver": "~9.0.1",
"vscode-languageserver-textdocument": "~1.0.11",
"yaml": "~2.4.5",
"vscode-languageserver-textdocument": "~1.0.12",
"yaml": "~2.5.1",
"yargs": "~17.7.2"
},
"devDependencies": {
"@types/babel__code-frame": "~7.0.6",
"@types/mustache": "~4.2.5",
"@types/node": "~18.11.19",
"@types/node": "~22.5.4",
"@types/prompts": "~2.4.9",
"@types/semver": "^7.5.8",
"@types/yargs": "~17.0.32",
"@types/yargs": "~17.0.33",
"@typespec/internal-build-utils": "workspace:~",
"@vitest/coverage-v8": "^2.0.4",
"@vitest/ui": "^2.0.4",
"@vitest/coverage-v8": "^2.1.0",
"@vitest/ui": "^2.1.0",
"c8": "^10.1.2",
"grammarkdown": "~3.3.2",
"rimraf": "~6.0.1",
"source-map-support": "~0.5.21",
"tmlanguage-generator": "workspace:~",
"ts-node": "~10.9.2",
"typescript": "~5.5.4",
"vitest": "^2.0.4",
"typescript": "~5.6.2",
"vitest": "^2.1.0",
"vscode-oniguruma": "~2.0.1",
"vscode-textmate": "~9.1.0"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/src/core/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5285,7 +5285,7 @@ export function createChecker(program: Program): Checker {
const defaultValue = checkDefaultValue(prop.default, type.type);
if (defaultValue !== null) {
type.defaultValue = defaultValue;
// eslint-disable-next-line deprecation/deprecation
// eslint-disable-next-line @typescript-eslint/no-deprecated
type.default = checkLegacyDefault(prop.default);
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/compiler/src/core/cli/actions/compile/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ function logProgramResult(
console.log(); // Insert a newline

if (program.emitters.length === 0 && !program.compilerOptions.noEmit) {
// eslint-disable-next-line no-console
log(
"No emitter was configured, no output was generated. Use `--emit <emitterName>` to pick emitter or specify it in the TypeSpec config."
);
Expand Down
9 changes: 6 additions & 3 deletions packages/compiler/src/core/cli/actions/compile/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function createWatcher(
function watchFile(file: string): FSWatcher {
const watcher = watch(
file,
dupFilter((event: WatchEventType, _name: string) => {
dupFilter((event: WatchEventType, _name: string | null) => {
onFileChanged(event, file);
})
);
Expand Down Expand Up @@ -67,8 +67,11 @@ export function createWatchHost(host: CliCompilerHost): WatchHost {
}
function createDupsFilter() {
let memo: Record<string, [WatchEventType, string]> = {};
return function (fn: (e: WatchEventType, name: string) => void) {
return function (event: WatchEventType, name: string) {
return function (fn: (e: WatchEventType, name: string | null) => void) {
return function (event: WatchEventType, name: string | null) {
if (name === null) {
return;
}
memo[name] = [event, name];
setTimeout(function () {
Object.values(memo).forEach((args) => {
Expand Down
1 change: 0 additions & 1 deletion packages/compiler/src/core/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export * from "./projected-names-utils.js";

export {
explainStringTemplateNotSerializable,
// eslint-disable-next-line deprecation/deprecation
stringTemplateToString,
} from "./string-template-utils.js";
export { printIdentifier as formatIdentifier, printIdentifier } from "./syntax-utils.js";
Expand Down
2 changes: 0 additions & 2 deletions packages/compiler/src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ export {
type Discriminator,
} from "./intrinsic-type-state.js";
export {
// eslint-disable-next-line deprecation/deprecation
createCadlLibrary,
createLinterRule as createRule,
createTypeSpecLibrary,
defineLinter,
definePackageFlags,
paramMessage,
// eslint-disable-next-line deprecation/deprecation
setCadlNamespace,
setTypeSpecNamespace,
} from "./library.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/src/core/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function getCaller() {
function getCallStack() {
const _prepareStackTrace = Error.prepareStackTrace;
Error.prepareStackTrace = (_, stack) => stack;
const stack = (new Error() as any).stack.slice(1); // eslint-disable-line unicorn/error-message
const stack = (new Error() as any).stack.slice(1);
Error.prepareStackTrace = _prepareStackTrace;
return stack;
}
Loading

0 comments on commit ea7fde0

Please sign in to comment.