chore: re-add eslint-plugin-import-x

This commit is contained in:
Simon Chan 2024-05-20 15:57:17 +08:00
parent 493683b80c
commit fdf0a863d9
No known key found for this signature in database
GPG key ID: A8B69F750B9BCEDD
35 changed files with 668 additions and 619 deletions

View file

@ -38,15 +38,15 @@
"@yume-chan/adb-server-node-tcp": "workspace:^0.0.23",
"@yume-chan/android-bin": "workspace:^0.0.23",
"@yume-chan/stream-extra": "workspace:^0.0.23",
"commander": "^12.0.0",
"commander": "^12.1.0",
"source-map-support": "^0.5.21",
"tslib": "^2.6.2"
},
"devDependencies": {
"@types/node": "^20.12.8",
"@types/node": "^20.12.12",
"@yume-chan/eslint-config": "workspace:^1.0.0",
"@yume-chan/tsconfig": "workspace:^1.0.0",
"jest": "^30.0.0-alpha.3",
"jest": "^30.0.0-alpha.4",
"prettier": "^3.2.5",
"typescript": "^5.4.5"
}

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{
"pnpmShrinkwrapHash": "ca7743cb8480b533789651d98878a7900c9455fa",
"pnpmShrinkwrapHash": "ab66fdfb3a225f67f9a6328586015487b6aa4d04",
"preferredVersionsHash": "bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f"
}

View file

@ -40,11 +40,11 @@
"@yume-chan/struct": "workspace:^0.0.23"
},
"devDependencies": {
"@jest/globals": "^30.0.0-alpha.3",
"@jest/globals": "^30.0.0-alpha.4",
"@yume-chan/eslint-config": "workspace:^1.0.0",
"@yume-chan/tsconfig": "workspace:^1.0.0",
"cross-env": "^7.0.3",
"jest": "^30.0.0-alpha.3",
"jest": "^30.0.0-alpha.4",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"typescript": "^5.4.5"

View file

@ -37,10 +37,10 @@
"@yume-chan/struct": "workspace:^0.0.23"
},
"devDependencies": {
"@types/node": "^20.12.8",
"@types/node": "^20.12.12",
"@yume-chan/eslint-config": "workspace:^1.0.0",
"@yume-chan/tsconfig": "workspace:^1.0.0",
"jest": "^30.0.0-alpha.3",
"jest": "^30.0.0-alpha.4",
"prettier": "^3.2.5",
"typescript": "^5.4.5"
}

View file

@ -39,12 +39,12 @@
"@yume-chan/struct": "workspace:^0.0.23"
},
"devDependencies": {
"@jest/globals": "^30.0.0-alpha.3",
"@types/node": "^20.12.8",
"@jest/globals": "^30.0.0-alpha.4",
"@types/node": "^20.12.12",
"@yume-chan/eslint-config": "workspace:^1.0.0",
"@yume-chan/tsconfig": "workspace:^1.0.0",
"cross-env": "^7.0.3",
"jest": "^30.0.0-alpha.3",
"jest": "^30.0.0-alpha.4",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"typescript": "^5.4.5"

View file

@ -40,11 +40,13 @@ export class AdbPower extends AdbCommandBase {
}
powerButton(longPress = false) {
return this.adb.subprocess.spawnAndWaitLegacy([
"input",
"keyevent",
longPress ? "--longpress POWER" : "POWER",
]);
const args = ["input", "keyevent"];
if (longPress) {
args.push("--longpress");
}
args.push("POWER");
return this.adb.subprocess.spawnAndWaitLegacy(args);
}
/**

View file

@ -1,12 +1,14 @@
import { PromiseResolver } from "@yume-chan/async";
import type {
PushReadableStreamController,
ReadableStream,
WritableStreamDefaultWriter,
} from "@yume-chan/stream-extra";
import {
MaybeConsumable,
PushReadableStream,
StructDeserializeStream,
WritableStream,
type PushReadableStreamController,
type ReadableStream,
type WritableStreamDefaultWriter,
} from "@yume-chan/stream-extra";
import type { StructValueType } from "@yume-chan/struct";
import Struct, { placeholder } from "@yume-chan/struct";

View file

@ -1,8 +1,8 @@
import type { ReadableStream } from "@yume-chan/stream-extra";
import {
AbortController,
DistributionStream,
MaybeConsumable,
type ReadableStream,
} from "@yume-chan/stream-extra";
import Struct, { placeholder } from "@yume-chan/struct";

View file

@ -2,6 +2,7 @@ import { describe, expect, it } from "@jest/globals";
import { EMPTY_UINT8_ARRAY, encodeUtf8 } from "@yume-chan/struct";
import { decodeBase64 } from "../utils/base64.js";
import type { AdbCredentialStore } from "./auth.js";
import { AdbAuthType, AdbPublicKeyAuthenticator } from "./auth.js";
import type { AdbPacketData } from "./packet.js";

View file

@ -1,5 +1,7 @@
import { describe, expect, it } from "@jest/globals";
import { decodeBase64 } from "../utils/base64.js";
import { adbGeneratePublicKey, modInverse } from "./crypto.js";
describe("modInverse", () => {

View file

@ -7,12 +7,14 @@ import {
getUint32LittleEndian,
setUint32LittleEndian,
} from "@yume-chan/no-data-view";
import type {
ReadableWritablePair,
WritableStreamDefaultWriter,
} from "@yume-chan/stream-extra";
import {
AbortController,
Consumable,
WritableStream,
type ReadableWritablePair,
type WritableStreamDefaultWriter,
} from "@yume-chan/stream-extra";
import { EMPTY_UINT8_ARRAY } from "@yume-chan/struct";

View file

@ -1,14 +1,13 @@
import { PromiseResolver } from "@yume-chan/async";
import type { Disposable } from "@yume-chan/event";
import {
MaybeConsumable,
PushReadableStream,
type AbortSignal,
type PushReadableStreamController,
type ReadableStream,
type WritableStream,
type WritableStreamDefaultController,
import type {
AbortSignal,
PushReadableStreamController,
ReadableStream,
WritableStream,
WritableStreamDefaultController,
} from "@yume-chan/stream-extra";
import { MaybeConsumable, PushReadableStream } from "@yume-chan/stream-extra";
import { EMPTY_UINT8_ARRAY } from "@yume-chan/struct";
import type { AdbSocket } from "../adb.js";

View file

@ -1,9 +1,9 @@
import { PromiseResolver } from "@yume-chan/async";
import type { ReadableWritablePair } from "@yume-chan/stream-extra";
import {
AbortController,
Consumable,
WritableStream,
type ReadableWritablePair,
} from "@yume-chan/stream-extra";
import type { ValueOrPromise } from "@yume-chan/struct";
import { decodeUtf8, encodeUtf8 } from "@yume-chan/struct";

View file

@ -37,11 +37,11 @@
"@yume-chan/struct": "workspace:^0.0.23"
},
"devDependencies": {
"@jest/globals": "^30.0.0-alpha.3",
"@jest/globals": "^30.0.0-alpha.4",
"@yume-chan/eslint-config": "workspace:^1.0.0",
"@yume-chan/tsconfig": "workspace:^1.0.0",
"cross-env": "^7.0.3",
"jest": "^30.0.0-alpha.3",
"jest": "^30.0.0-alpha.4",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"typescript": "^5.4.5"

View file

@ -36,11 +36,11 @@
"@yume-chan/async": "^2.2.0"
},
"devDependencies": {
"@jest/globals": "^30.0.0-alpha.3",
"@jest/globals": "^30.0.0-alpha.4",
"@yume-chan/eslint-config": "workspace:^1.0.0",
"@yume-chan/tsconfig": "workspace:^1.0.0",
"cross-env": "^7.0.3",
"jest": "^30.0.0-alpha.3",
"jest": "^30.0.0-alpha.4",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"typescript": "^5.4.5"

View file

@ -30,6 +30,6 @@
"gh-release-fetch": "^4.0.3"
},
"devDependencies": {
"@types/node": "^20.12.8"
"@types/node": "^20.12.12"
}
}

View file

@ -30,12 +30,12 @@
"prepublishOnly": "npm run build"
},
"devDependencies": {
"@jest/globals": "^30.0.0-alpha.3",
"@types/node": "^20.12.8",
"@jest/globals": "^30.0.0-alpha.4",
"@types/node": "^20.12.12",
"@yume-chan/eslint-config": "workspace:^1.0.0",
"@yume-chan/tsconfig": "workspace:^1.0.0",
"cross-env": "^7.0.3",
"jest": "^30.0.0-alpha.3",
"jest": "^30.0.0-alpha.4",
"prettier": "^3.2.5",
"tinybench": "^2.8.0",
"ts-jest": "^29.1.2",

View file

@ -1,4 +1,5 @@
import { describe, expect, it } from "@jest/globals";
import { getInt8 } from "./int8.js";
describe("getInt8", () => {

View file

@ -30,12 +30,12 @@
"prepublishOnly": "npm run build"
},
"devDependencies": {
"@jest/globals": "^30.0.0-alpha.3",
"@jest/globals": "^30.0.0-alpha.4",
"@types/audioworklet": "^0.0.55",
"@yume-chan/eslint-config": "workspace:^1.0.0",
"@yume-chan/tsconfig": "workspace:^1.0.0",
"cross-env": "^7.0.3",
"jest": "^30.0.0-alpha.3",
"jest": "^30.0.0-alpha.4",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"typescript": "^5.4.5"

View file

@ -43,11 +43,11 @@
"yuv-canvas": "^1.2.11"
},
"devDependencies": {
"@jest/globals": "^30.0.0-alpha.3",
"@jest/globals": "^30.0.0-alpha.4",
"@yume-chan/eslint-config": "workspace:^1.0.0",
"@yume-chan/tsconfig": "workspace:^1.0.0",
"cross-env": "^7.0.3",
"jest": "^30.0.0-alpha.3",
"jest": "^30.0.0-alpha.4",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"typescript": "^5.4.5"

View file

@ -40,11 +40,11 @@
"@yume-chan/stream-extra": "workspace:^0.0.23"
},
"devDependencies": {
"@jest/globals": "^30.0.0-alpha.3",
"@jest/globals": "^30.0.0-alpha.4",
"@yume-chan/eslint-config": "workspace:^1.0.0",
"@yume-chan/tsconfig": "workspace:^1.0.0",
"cross-env": "^7.0.3",
"jest": "^30.0.0-alpha.3",
"jest": "^30.0.0-alpha.4",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"typescript": "^5.4.5"

View file

@ -1,21 +1,21 @@
import { EventEmitter } from "@yume-chan/event";
import { getUint32LittleEndian } from "@yume-chan/no-data-view";
import type {
ScrcpyMediaStreamDataPacket,
ScrcpyMediaStreamPacket,
} from "@yume-chan/scrcpy";
import {
Av1,
ScrcpyVideoCodecId,
h264ParseConfiguration,
h265ParseConfiguration,
type ScrcpyMediaStreamDataPacket,
type ScrcpyMediaStreamPacket,
} from "@yume-chan/scrcpy";
import type {
ScrcpyVideoDecoder,
ScrcpyVideoDecoderCapability,
} from "@yume-chan/scrcpy-decoder-tinyh264";
import {
WritableStream,
type WritableStreamDefaultController,
} from "@yume-chan/stream-extra";
import type { WritableStreamDefaultController } from "@yume-chan/stream-extra";
import { WritableStream } from "@yume-chan/stream-extra";
import { BitmapFrameRenderer } from "./bitmap.js";
import type { FrameRenderer } from "./renderer.js";

View file

@ -40,11 +40,11 @@
"tslib": "^2.6.2"
},
"devDependencies": {
"@jest/globals": "^30.0.0-alpha.3",
"@jest/globals": "^30.0.0-alpha.4",
"@yume-chan/eslint-config": "workspace:^1.0.0",
"@yume-chan/tsconfig": "workspace:^1.0.0",
"cross-env": "^7.0.3",
"jest": "^30.0.0-alpha.3",
"jest": "^30.0.0-alpha.4",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"typescript": "^5.4.5"

View file

@ -1,7 +1,5 @@
import {
Consumable,
type WritableStreamDefaultWriter,
} from "@yume-chan/stream-extra";
import type { WritableStreamDefaultWriter } from "@yume-chan/stream-extra";
import { Consumable } from "@yume-chan/stream-extra";
import type { ScrcpyOptions } from "../options/index.js";

View file

@ -1,10 +1,8 @@
// cspell: ignore autosync
import { PromiseResolver } from "@yume-chan/async";
import Struct, {
placeholder,
type AsyncExactReadable,
} from "@yume-chan/struct";
import type { AsyncExactReadable } from "@yume-chan/struct";
import Struct, { placeholder } from "@yume-chan/struct";
import type { ScrcpySetClipboardControlMessage } from "../control/index.js";

View file

@ -1,10 +1,13 @@
import type { ReadableStream } from "@yume-chan/stream-extra";
import type { ValueOrPromise } from "@yume-chan/struct";
import { ScrcpyOptions1_21 } from "./1_21.js";
import { ScrcpyOptions2_0, omit } from "./2_0.js";
import { ScrcpyOptions2_2, type ScrcpyOptionsInit2_2 } from "./2_2.js";
import type { ScrcpyOptionsInit2_2 } from "./2_2.js";
import { ScrcpyOptions2_2 } from "./2_2.js";
import type { ScrcpyAudioStreamMetadata } from "./codec.js";
import { ScrcpyAudioCodec } from "./codec.js";
import { ScrcpyOptionsBase } from "./types.js";
import type { ValueOrPromise } from "@yume-chan/struct";
import { ScrcpyAudioCodec, type ScrcpyAudioStreamMetadata } from "./codec.js";
export interface ScrcpyOptionsInit2_3
extends Omit<ScrcpyOptionsInit2_2, "audioCodec"> {

View file

@ -36,11 +36,11 @@
"@yume-chan/struct": "workspace:^0.0.23"
},
"devDependencies": {
"@jest/globals": "^30.0.0-alpha.3",
"@jest/globals": "^30.0.0-alpha.4",
"@yume-chan/eslint-config": "workspace:^1.0.0",
"@yume-chan/tsconfig": "workspace:^1.0.0",
"cross-env": "^7.0.3",
"jest": "^30.0.0-alpha.3",
"jest": "^30.0.0-alpha.4",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"typescript": "^5.4.5"

View file

@ -6,10 +6,11 @@ import type {
WritableStreamDefaultWriter,
} from "./stream.js";
import {
WritableStream as NativeWritableStream,
ReadableStream as NativeReadableStream,
WritableStream as NativeWritableStream,
} from "./stream.js";
import { createTask, type Task } from "./task.js";
import type { Task } from "./task.js";
import { createTask } from "./task.js";
function isPromiseLike(value: unknown): value is PromiseLike<unknown> {
return typeof value === "object" && value !== null && "then" in value;

View file

@ -1,9 +1,11 @@
import { Consumable } from "./consumable.js";
import type { WritableStreamDefaultController } from "./stream.js";
import type {
QueuingStrategy,
WritableStreamDefaultController,
} from "./stream.js";
import {
WritableStream as NativeWritableStream,
TransformStream,
type QueuingStrategy,
} from "./stream.js";
export type MaybeConsumable<T> = T | Consumable<T>;

View file

@ -37,11 +37,11 @@
"@yume-chan/no-data-view": "workspace:^0.0.23"
},
"devDependencies": {
"@jest/globals": "^30.0.0-alpha.3",
"@jest/globals": "^30.0.0-alpha.4",
"@yume-chan/eslint-config": "workspace:^1.0.0",
"@yume-chan/tsconfig": "workspace:^1.0.0",
"cross-env": "^7.0.3",
"jest": "^30.0.0-alpha.3",
"jest": "^30.0.0-alpha.4",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"typescript": "^5.4.5"

View file

@ -4,6 +4,7 @@ import {
setInt64,
setUint64,
} from "@yume-chan/no-data-view";
import type {
AsyncExactReadable,
ExactReadable,

View file

@ -15,11 +15,11 @@ import {
EMPTY_UINT8_ARRAY,
Uint8ArrayBufferFieldConverter,
} from "./base.js";
import type { VariableLengthBufferLikeFieldOptions } from "./variable-length.js";
import {
VariableLengthBufferLikeFieldDefinition,
VariableLengthBufferLikeFieldLengthValue,
VariableLengthBufferLikeStructFieldValue,
type VariableLengthBufferLikeFieldOptions,
} from "./variable-length.js";
class MockLengthFieldValue extends StructFieldValue<any> {

View file

@ -1,6 +1,7 @@
/// <reference types="node" />
import eslint from "@eslint/js";
import eslintImportX from "eslint-plugin-import-x";
import { dirname, resolve } from "path";
import tslint from "typescript-eslint";
import { fileURLToPath } from "url";
@ -8,11 +9,25 @@ import { fileURLToPath } from "url";
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..", "..");
export default tslint.config(
eslint.configs.recommended,
...tslint.configs.recommendedTypeChecked,
{
ignores: ["**/*.js", "**/*.d.ts"],
},
eslint.configs.recommended,
{
rules: {
"no-constant-condition": ["error", { checkLoops: false }],
"no-plusplus": "error",
"no-multiple-empty-lines": [
"error",
{
max: 1,
maxEOF: 1,
maxBOF: 0,
},
],
},
},
...tslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
@ -25,41 +40,6 @@ export default tslint.config(
},
},
rules: {
"no-constant-condition": ["error", { checkLoops: false }],
"no-plusplus": "error",
"no-multiple-empty-lines": [
"error",
{
max: 1,
maxEOF: 1,
maxBOF: 0,
},
],
// "import/consistent-type-specifier-style": [
// "error",
// "prefer-top-level",
// ],
// "import/no-cycle": "error",
// "import/no-duplicates": ["error", { "prefer-inline": false }],
// "import/order": [
// "error",
// {
// groups: [
// "builtin",
// "external",
// "internal",
// "parent",
// "sibling",
// "index",
// ],
// "newlines-between": "always",
// alphabetize: {
// order: "asc",
// },
// },
// ],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unsafe-enum-comparison": "off",
"@typescript-eslint/no-namespace": "off",
@ -69,8 +49,35 @@ export default tslint.config(
"@typescript-eslint/consistent-indexed-object-style": "error",
"@typescript-eslint/no-this-alias": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-import-type-side-effects": "error",
},
},
{
plugins: { "import-x": eslintImportX },
rules: {
"import-x/consistent-type-specifier-style": [
"error",
"prefer-top-level",
],
"import-x/no-cycle": "error",
"import-x/no-duplicates": ["error", { "prefer-inline": false }],
"import-x/order": [
"error",
{
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
],
"newlines-between": "always",
alphabetize: {
order: "asc",
},
},
],
},
},
);

View file

@ -7,11 +7,12 @@
"run-eslint": "run-eslint.js"
},
"dependencies": {
"@eslint/js": "^9.2.0",
"@types/node": "^20.12.8",
"eslint": "^9.2.0",
"@eslint/js": "^9.3.0",
"@types/node": "^20.12.12",
"eslint": "^9.3.0",
"eslint-plugin-import-x": "^0.5.0",
"typescript": "^5.4.5",
"typescript-eslint": "^7.8.0"
"typescript-eslint": "^7.9.0"
},
"devDependencies": {
"prettier": "^3.2.5"