This commit is contained in:
ryan-0324 2024-06-01 20:07:54 -04:00 committed by GitHub
parent c68fba4c6a
commit 66b0e724bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 1183 additions and 363 deletions

View file

@ -0,0 +1,38 @@
name: Test packages/discord-types
on:
pull_request:
paths:
- packages/discord-types/**
push:
paths:
- packages/discord-types/**
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: packages/discord-types
sparse-checkout-cone-mode: false
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: ^20.11.0
cache: pnpm
- name: Move packages/discord-types to root
run: |
mv packages/discord-types .
rm -rf packages
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Check for TypeScript errors and lint
run: pnpm test

View file

@ -1,17 +1,21 @@
name: test name: test
on: on:
push: push:
paths-ignore:
- packages/discord-types
pull_request: pull_request:
branches: branches:
- main - main
- dev - dev
paths-ignore:
- packages/discord-types
jobs: jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v3 # Install pnpm using packageManager key in package.json - uses: pnpm/action-setup@v4 # Install pnpm using packageManager key in package.json
- name: Use Node.js 20 - name: Use Node.js 20
uses: actions/setup-node@v4 uses: actions/setup-node@v4

View file

@ -50,40 +50,41 @@
"devDependencies": { "devDependencies": {
"@types/chrome": "^0.0.246", "@types/chrome": "^0.0.246",
"@types/diff": "^5.0.3", "@types/diff": "^5.0.3",
"@types/lodash": "^4.14.194", "@types/lodash": "~4.17.4",
"@types/node": "^18.16.3", "@types/node": "^18.16.3",
"@types/react": "^18.2.0", "@types/react": "~18.2.21",
"@types/react-dom": "^18.2.1", "@types/react-dom": "~18.2.7",
"@types/yazl": "^2.4.2", "@types/yazl": "^2.4.2",
"@typescript-eslint/eslint-plugin": "^5.59.1", "@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^5.59.1", "@typescript-eslint/parser": "^7.11.0",
"@vencord/discord-types": "workspace:^",
"diff": "^5.1.0", "diff": "^5.1.0",
"discord-types": "^1.3.26", "discord-types": "^1.3.26",
"esbuild": "^0.15.18", "esbuild": "^0.15.18",
"eslint": "^8.46.0", "eslint": "^8.57.0",
"eslint-import-resolver-alias": "^1.1.2", "eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-path-alias": "^1.0.0", "eslint-plugin-path-alias": "^1.1.0",
"eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-simple-import-sort": "^12.1.0",
"eslint-plugin-unused-imports": "^2.0.0", "eslint-plugin-unused-imports": "^3.2.0",
"highlight.js": "10.6.0", "highlight.js": "10.6.0",
"html-minifier-terser": "^7.2.0", "html-minifier-terser": "^7.2.0",
"moment": "^2.29.4", "moment": "2.22.2",
"puppeteer-core": "^19.11.1", "puppeteer-core": "^19.11.1",
"standalone-electron-types": "^1.0.0", "standalone-electron-types": "^1.0.0",
"stylelint": "^15.6.0", "stylelint": "^15.6.0",
"stylelint-config-standard": "^33.0.0", "stylelint-config-standard": "^33.0.0",
"ts-patch": "^3.1.2", "ts-patch": "^3.1.2",
"tsx": "^3.12.7", "tsx": "^3.12.7",
"type-fest": "^3.9.0", "type-fest": "^4.18.3",
"typescript": "^5.4.5", "typescript": "^5.4.5",
"typescript-transform-paths": "^3.4.7", "typescript-transform-paths": "^3.4.7",
"zip-local": "^0.3.5" "zip-local": "^0.3.5"
}, },
"packageManager": "pnpm@9.1.0", "packageManager": "pnpm@9.1.4",
"pnpm": { "pnpm": {
"patchedDependencies": { "patchedDependencies": {
"eslint-plugin-path-alias@1.0.0": "patches/eslint-plugin-path-alias@1.0.0.patch", "eslint@8.57.0": "patches/eslint@8.57.0.patch",
"eslint@8.46.0": "patches/eslint@8.46.0.patch" "eslint-plugin-path-alias@1.1.0": "patches/eslint-plugin-path-alias@1.1.0.patch"
}, },
"peerDependencyRules": { "peerDependencyRules": {
"ignoreMissing": [ "ignoreMissing": [

View file

@ -10,6 +10,12 @@
"directory": "packages/discord-types" "directory": "packages/discord-types"
}, },
"files": ["src"], "files": ["src"],
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "tsc --noEmit && eslint .",
"test-ts": "tsc --noEmit"
},
"sideEffects": false, "sideEffects": false,
"types": "./src/index.d.ts", "types": "./src/index.d.ts",
"dependencies": { "dependencies": {

View file

@ -0,0 +1,77 @@
/*
* discord-types
* Copyright (C) 2024 Vencord project contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
/*
// bigint enums are not yet possible: https://github.com/microsoft/TypeScript/issues/37783
export const enum Permissions {
CREATE_INSTANT_INVITE = 1n << 0n,
KICK_MEMBERS = 1n << 1n,
BAN_MEMBERS = 1n << 2n,
ADMINISTRATOR = 1n << 3n,
MANAGE_CHANNELS = 1n << 4n,
MANAGE_GUILD = 1n << 5n,
ADD_REACTIONS = 1n << 6n,
VIEW_AUDIT_LOG = 1n << 7n,
PRIORITY_SPEAKER = 1n << 8n,
STREAM = 1n << 9n,
VIEW_CHANNEL = 1n << 10n,
SEND_MESSAGES = 1n << 11n,
SEND_TTS_MESSAGES = 1n << 12n,
MANAGE_MESSAGES = 1n << 13n,
EMBED_LINKS = 1n << 14n,
ATTACH_FILES = 1n << 15n,
READ_MESSAGE_HISTORY = 1n << 16n,
MENTION_EVERYONE = 1n << 17n,
USE_EXTERNAL_EMOJIS = 1n << 18n,
VIEW_GUILD_ANALYTICS = 1n << 19n,
CONNECT = 1n << 20n,
SPEAK = 1n << 21n,
MUTE_MEMBERS = 1n << 22n,
DEAFEN_MEMBERS = 1n << 23n,
MOVE_MEMBERS = 1n << 24n,
USE_VAD = 1n << 25n,
CHANGE_NICKNAME = 1n << 26n,
MANAGE_NICKNAMES = 1n << 27n,
MANAGE_ROLES = 1n << 28n,
MANAGE_WEBHOOKS = 1n << 29n,
MANAGE_GUILD_EXPRESSIONS = 1n << 30n,
USE_APPLICATION_COMMANDS = 1n << 31n,
REQUEST_TO_SPEAK = 1n << 32n,
MANAGE_EVENTS = 1n << 33n,
MANAGE_THREADS = 1n << 34n,
CREATE_PUBLIC_THREADS = 1n << 35n,
CREATE_PRIVATE_THREADS = 1n << 36n,
USE_EXTERNAL_STICKERS = 1n << 37n,
SEND_MESSAGES_IN_THREADS = 1n << 38n,
USE_EMBEDDED_ACTIVITIES = 1n << 39n,
MODERATE_MEMBERS = 1n << 40n,
VIEW_CREATOR_MONETIZATION_ANALYTICS = 1n << 41n,
USE_SOUNDBOARD = 1n << 42n,
CREATE_GUILD_EXPRESSIONS = 1n << 43n,
CREATE_EVENTS = 1n << 44n,
USE_EXTERNAL_SOUNDS = 1n << 45n,
SEND_VOICE_MESSAGES = 1n << 46n,
USE_CLYDE_AI = 1n << 47n,
SET_VOICE_CHANNEL_STATUS = 1n << 48n,
SEND_POLLS = 1n << 49n,
}
*/
export interface PermissionOverwriteMap {
[roleIdOrUserId: string]: PermissionOverwrite;
}
export interface PermissionOverwrite {
allow: /* Permissions */ bigint;
deny: /* Permissions */ bigint;
id: string;
type: PermissionOverwriteType;
}
export const enum PermissionOverwriteType {
ROLE = 0,
MEMBER = 1,
}

View file

@ -31,59 +31,3 @@ export interface Role {
export const enum RoleFlags { export const enum RoleFlags {
IN_PROMPT = 1, IN_PROMPT = 1,
} }
/*
// bigint enums are not yet possible: https://github.com/microsoft/TypeScript/issues/37783
export const enum Permissions {
CREATE_INSTANT_INVITE = 1n << 0n,
KICK_MEMBERS = 1n << 1n,
BAN_MEMBERS = 1n << 2n,
ADMINISTRATOR = 1n << 3n,
MANAGE_CHANNELS = 1n << 4n,
MANAGE_GUILD = 1n << 5n,
ADD_REACTIONS = 1n << 6n,
VIEW_AUDIT_LOG = 1n << 7n,
PRIORITY_SPEAKER = 1n << 8n,
STREAM = 1n << 9n,
VIEW_CHANNEL = 1n << 10n,
SEND_MESSAGES = 1n << 11n,
SEND_TTS_MESSAGES = 1n << 12n,
MANAGE_MESSAGES = 1n << 13n,
EMBED_LINKS = 1n << 14n,
ATTACH_FILES = 1n << 15n,
READ_MESSAGE_HISTORY = 1n << 16n,
MENTION_EVERYONE = 1n << 17n,
USE_EXTERNAL_EMOJIS = 1n << 18n,
VIEW_GUILD_ANALYTICS = 1n << 19n,
CONNECT = 1n << 20n,
SPEAK = 1n << 21n,
MUTE_MEMBERS = 1n << 22n,
DEAFEN_MEMBERS = 1n << 23n,
MOVE_MEMBERS = 1n << 24n,
USE_VAD = 1n << 25n,
CHANGE_NICKNAME = 1n << 26n,
MANAGE_NICKNAMES = 1n << 27n,
MANAGE_ROLES = 1n << 28n,
MANAGE_WEBHOOKS = 1n << 29n,
MANAGE_GUILD_EXPRESSIONS = 1n << 30n,
USE_APPLICATION_COMMANDS = 1n << 31n,
REQUEST_TO_SPEAK = 1n << 32n,
MANAGE_EVENTS = 1n << 33n,
MANAGE_THREADS = 1n << 34n,
CREATE_PUBLIC_THREADS = 1n << 35n,
CREATE_PRIVATE_THREADS = 1n << 36n,
USE_EXTERNAL_STICKERS = 1n << 37n,
SEND_MESSAGES_IN_THREADS = 1n << 38n,
USE_EMBEDDED_ACTIVITIES = 1n << 39n,
MODERATE_MEMBERS = 1n << 40n,
VIEW_CREATOR_MONETIZATION_ANALYTICS = 1n << 41n,
USE_SOUNDBOARD = 1n << 42n,
CREATE_GUILD_EXPRESSIONS = 1n << 43n,
CREATE_EVENTS = 1n << 44n,
USE_EXTERNAL_SOUNDS = 1n << 45n,
SEND_VOICE_MESSAGES = 1n << 46n,
USE_CLYDE_AI = 1n << 47n,
SET_VOICE_CHANNEL_STATUS = 1n << 48n,
SEND_POLLS = 1n << 49n,
}
*/

View file

@ -7,6 +7,7 @@
import type { SnakeCasedProperties } from "type-fest"; import type { SnakeCasedProperties } from "type-fest";
import type { Nullish } from "../../internal"; import type { Nullish } from "../../internal";
import type { PermissionOverwriteMap } from "../Permissions";
import type { AvatarDecorationData, UserClanData, UserFlags } from "../UserRecord"; import type { AvatarDecorationData, UserClanData, UserFlags } from "../UserRecord";
import type { ForumChannelRecord, GuildForumChannelRecord, GuildMediaChannelRecord } from "./ForumChannelRecord"; import type { ForumChannelRecord, GuildForumChannelRecord, GuildMediaChannelRecord } from "./ForumChannelRecord";
import type { GuildCategoryChannelRecord, GuildDirectoryChannelRecord, GuildTextualChannelRecord } from "./GuildTextualChannelRecord"; import type { GuildCategoryChannelRecord, GuildDirectoryChannelRecord, GuildTextualChannelRecord } from "./GuildTextualChannelRecord";
@ -188,22 +189,6 @@ export const enum ThreadMemberFlags {
NO_MESSAGES = 1 << 3, NO_MESSAGES = 1 << 3,
} }
interface PermissionOverwriteMap {
[roleIdOrUserId: string]: PermissionOverwrite;
}
export interface PermissionOverwrite {
allow: /* Permissions */ bigint;
deny: /* Permissions */ bigint;
id: string;
type: PermissionOverwriteType;
}
export const enum PermissionOverwriteType {
ROLE = 0,
MEMBER = 1,
}
export interface ChannelRecipient { export interface ChannelRecipient {
avatar: string | null; avatar: string | null;
avatar_decoration_data: SnakeCasedProperties<AvatarDecorationData> | null; avatar_decoration_data: SnakeCasedProperties<AvatarDecorationData> | null;

View file

@ -7,8 +7,10 @@
import type { ExtractAction, FluxAction } from "../flux/fluxActions"; import type { ExtractAction, FluxAction } from "../flux/fluxActions";
import type { ChannelRecord } from "../general/channels/ChannelRecord"; import type { ChannelRecord } from "../general/channels/ChannelRecord";
import type { GuildRecord } from "../general/GuildRecord"; import type { GuildRecord } from "../general/GuildRecord";
import type { PermissionOverwriteMap } from "../general/Permissions";
import type { Role } from "../general/Role"; import type { Role } from "../general/Role";
import type { UserRecord } from "../general/UserRecord"; import type { UserRecord } from "../general/UserRecord";
import type { Nullish } from "../internal";
import type { FluxStore } from "./abstract/FluxStore"; import type { FluxStore } from "./abstract/FluxStore";
export type PermissionStoreAction = ExtractAction<FluxAction, "BACKGROUND_SYNC" | "CACHE_LOADED" | "CACHE_LOADED_LAZY" | "CHANNEL_CREATE" | "CHANNEL_DELETE" | "CHANNEL_UPDATES" | "CONNECTION_CLOSED" | "CONNECTION_OPEN" | "CURRENT_USER_UPDATE" | "GUILD_CREATE" | "GUILD_DELETE" | "GUILD_FEED_FETCH_SUCCESS" | "GUILD_MEMBER_ADD" | "GUILD_MEMBER_UPDATE" | "GUILD_ROLE_CREATE" | "GUILD_ROLE_DELETE" | "GUILD_ROLE_UPDATE" | "GUILD_UPDATE" | "IMPERSONATE_STOP" | "IMPERSONATE_UPDATE" | "LOAD_ARCHIVED_THREADS_SUCCESS" | "LOAD_MESSAGES_SUCCESS" | "LOAD_THREADS_SUCCESS" | "LOGOUT" | "MOD_VIEW_SEARCH_FINISH" | "OVERLAY_INITIALIZE" | "SEARCH_FINISH" | "STAGE_INSTANCE_CREATE" | "STAGE_INSTANCE_DELETE" | "STAGE_INSTANCE_UPDATE" | "THREAD_CREATE" | "THREAD_LIST_SYNC" | "THREAD_MEMBERS_UPDATE" | "THREAD_MEMBER_UPDATE" | "THREAD_UPDATE">; export type PermissionStoreAction = ExtractAction<FluxAction, "BACKGROUND_SYNC" | "CACHE_LOADED" | "CACHE_LOADED_LAZY" | "CHANNEL_CREATE" | "CHANNEL_DELETE" | "CHANNEL_UPDATES" | "CONNECTION_CLOSED" | "CONNECTION_OPEN" | "CURRENT_USER_UPDATE" | "GUILD_CREATE" | "GUILD_DELETE" | "GUILD_FEED_FETCH_SUCCESS" | "GUILD_MEMBER_ADD" | "GUILD_MEMBER_UPDATE" | "GUILD_ROLE_CREATE" | "GUILD_ROLE_DELETE" | "GUILD_ROLE_UPDATE" | "GUILD_UPDATE" | "IMPERSONATE_STOP" | "IMPERSONATE_UPDATE" | "LOAD_ARCHIVED_THREADS_SUCCESS" | "LOAD_MESSAGES_SUCCESS" | "LOAD_THREADS_SUCCESS" | "LOGOUT" | "MOD_VIEW_SEARCH_FINISH" | "OVERLAY_INITIALIZE" | "SEARCH_FINISH" | "STAGE_INSTANCE_CREATE" | "STAGE_INSTANCE_DELETE" | "STAGE_INSTANCE_UPDATE" | "THREAD_CREATE" | "THREAD_LIST_SYNC" | "THREAD_MEMBERS_UPDATE" | "THREAD_MEMBER_UPDATE" | "THREAD_UPDATE">;
@ -16,19 +18,39 @@ export type PermissionStoreAction = ExtractAction<FluxAction, "BACKGROUND_SYNC"
export class PermissionStore<Action extends FluxAction = PermissionStoreAction> extends FluxStore<Action> { export class PermissionStore<Action extends FluxAction = PermissionStoreAction> extends FluxStore<Action> {
static displayName: "PermissionStore"; static displayName: "PermissionStore";
can(e?: any, t?: any, n?: any, i?: any, r?: any): boolean; // TEMP can(
permissions: /* Permissions */ bigint,
context?: GuildRecord | ChannelRecord | Nullish,
overwrites?: PermissionOverwriteMap | Nullish,
roles?: { [roleId: string]: Role; } | Nullish,
excludeGuildPermissions?: boolean | undefined /* = false */
): boolean;
canAccessGuildSettings(guild: GuildRecord): boolean; canAccessGuildSettings(guild: GuildRecord): boolean;
canAccessMemberSafetyPage(guild: GuildRecord): boolean; canAccessMemberSafetyPage(guild: GuildRecord): boolean;
canBasicChannel(e?: any, t?: any, n?: any, i?: any, r?: any): boolean; // TEMP canBasicChannel<Context extends BasicPermissionsObject | GuildRecord | ChannelRecord>(
permissions: Context extends BasicPermissionsObject ? /* Permissions */ bigint : Parameters<BigIntConstructor>[0],
context: Context,
overwrites?: PermissionOverwriteMap | Nullish,
roles?: { [roleId: string]: Role; } | Nullish,
excludeGuildPermissions?: boolean | undefined /* = false */
): boolean;
canImpersonateRole(guild: GuildRecord, role: Role): boolean; canImpersonateRole(guild: GuildRecord, role: Role): boolean;
canManageUser( canManageUser(
permissions: /* Permissions */ bigint, permissions: /* Permissions */ bigint,
userOrUserId: UserRecord | string, userOrUserId: UserRecord | string,
guild: GuildRecord guild: GuildRecord
): boolean; ): boolean;
canWithPartialContext(e?: any, t?: any): boolean; // TEMP canWithPartialContext(
computeBasicPermissions(arg: Record<string, any>): /* Permissions */ bigint; // TEMP context: { guildId: string; } | { channelId: string; },
computePermissions(guildOrChannel: GuildRecord | ChannelRecord, t?: any, n?: any, i?: any): any; // TEMP permissions: /* Permissions */ bigint
): boolean;
computeBasicPermissions(context: BasicPermissionsObject): /* Permissions */ bigint;
computePermissions(
context?: GuildRecord | ChannelRecord | Nullish,
overwrites?: PermissionOverwriteMap | Nullish,
roles?: { [roleId: string]: Role; } | Nullish,
excludeGuildPermissions?: boolean | undefined /* = false */
): /* Permissions */ bigint;
getChannelPermissions(channel: ChannelRecord): /* Permissions */ bigint; getChannelPermissions(channel: ChannelRecord): /* Permissions */ bigint;
getChannelsVersion(): number; getChannelsVersion(): number;
getGuildPermissionProps(guild: GuildRecord): { getGuildPermissionProps(guild: GuildRecord): {
@ -53,3 +75,7 @@ export class PermissionStore<Action extends FluxAction = PermissionStoreAction>
getHighestRole(guild: GuildRecord): Role; getHighestRole(guild: GuildRecord): Role;
isRoleHigher(guild: GuildRecord, roleA: Role, roleB: Role): boolean; isRoleHigher(guild: GuildRecord, roleA: Role, roleB: Role): boolean;
} }
interface BasicPermissionsObject {
basicPermissions: bigint;
}

View file

@ -18,8 +18,8 @@ export class PresenceStore<Action extends FluxAction = PresenceStoreAction> exte
getActivityMetadata(e?: any): any; // TEMP getActivityMetadata(e?: any): any; // TEMP
getAllApplicationActivities(e?: any): any; // TEMP getAllApplicationActivities(e?: any): any; // TEMP
getApplicationActivity(e?: any, t?: any): any; // TEMP getApplicationActivity(e?: any, t?: any): any; // TEMP
getClientStatus(e?: any): any; // TEMP getClientStatus(userId: string): Partial<Record<ClientType, StatusType>> | undefined;
getLastOnlineTimestamp(e?: any): any; // TEMP getLastOnlineTimestamp(userId: string): number | undefined;
getPrimaryActivity(e?: any): any; // TEMP getPrimaryActivity(e?: any): any; // TEMP
getState(): { getState(): {
activities: any; // TEMP activities: any; // TEMP
@ -30,7 +30,48 @@ export class PresenceStore<Action extends FluxAction = PresenceStoreAction> exte
statuses: any; // TEMP statuses: any; // TEMP
}; // TEMP }; // TEMP
getStatus(e?: any): any; // TEMP getStatus(e?: any): any; // TEMP
getUserIds(): any; // TEMP getUserIds(): string[];
isMobileOnline(e?: any): any; // TEMP isMobileOnline(userId: string): boolean;
setCurrentUserOnConnectionOpen(e?: any, t?: any): any; // TEMP setCurrentUserOnConnectionOpen(e?: any, t?: any): any; // TEMP
} }
/** @todo Might have more properties. */
export interface Activity {
application_id: any; // TEMP
assets: any; // TEMP
buttons: any; // TEMP
created_at: any; // TEMP
details: any; // TEMP
emoji: any; // TEMP
flags: any; // TEMP
id: any; // TEMP
name: any; // TEMP
party: any; // TEMP
platform: any; // TEMP
session_id: any; // TEMP
state: any; // TEMP
supported_platforms: any; // TEMP
sync_id: any; // TEMP
timestamps: any; // TEMP
type: any; // TEMP
url: any; // TEMP
}
// Original name: ClientTypes
export const enum ClientType {
DESKTOP = "desktop",
MOBILE = "mobile",
UNKNOWN = "unknown",
WEB = "web",
}
// Original name: StatusTypes
export const enum StatusType {
DND = "dnd",
IDLE = "idle",
INVISIBLE = "invisible",
OFFLINE = "offline",
ONLINE = "online",
STREAMING = "streaming",
UNKNOWN = "unknown",
}

View file

@ -11,6 +11,7 @@ import type { UserProfile } from "../general/UserProfile";
import type { UserRecord } from "../general/UserRecord"; import type { UserRecord } from "../general/UserRecord";
import type { GenericConstructor, Nullish } from "../internal"; import type { GenericConstructor, Nullish } from "../internal";
import type { FluxSnapshot, FluxSnapshotStore } from "./abstract/FluxSnapshotStore"; import type { FluxSnapshot, FluxSnapshotStore } from "./abstract/FluxSnapshotStore";
import type { StatusType } from "./PresenceStore";
export interface UserProfileStoreSnapshotData { export interface UserProfileStoreSnapshotData {
profile: UserProfile | undefined; profile: UserProfile | undefined;
@ -47,14 +48,3 @@ export class UserProfileStore<
loadCache: () => void; loadCache: () => void;
} }
// Original name: StatusTypes
export const enum StatusType {
DND = "dnd",
IDLE = "idle",
INVISIBLE = "invisible",
OFFLINE = "offline",
ONLINE = "online",
STREAMING = "streaming",
UNKNOWN = "unknown",
}

View file

@ -1,13 +0,0 @@
diff --git a/lib/rules/no-relative.js b/lib/rules/no-relative.js
index 71594c83f1f4f733ffcc6047d7f7084348335dbe..d8623d87c89499c442171db3272cba07c9efabbe 100644
--- a/lib/rules/no-relative.js
+++ b/lib/rules/no-relative.js
@@ -41,7 +41,7 @@ module.exports = {
ImportDeclaration(node) {
const importPath = node.source.value;
- if (!/^(\.?\.\/)/.test(importPath)) {
+ if (!/^(\.\.\/)/.test(importPath)) {
return;
}

View file

@ -0,0 +1,22 @@
diff --git a/lib/rules/no-relative.js b/lib/rules/no-relative.js
index a5f0f9d42b255077d10bacfe226ee2ddc0348991..6b7dfd90d2a2aeff77b115d2798f8a8080721d62 100644
--- a/lib/rules/no-relative.js
+++ b/lib/rules/no-relative.js
@@ -43,7 +43,7 @@ module.exports = {
ImportExpression(node) {
const importPath = node.source.value;
- if (!/^(\.?\.\/)/.test(importPath)) {
+ if (!/^(\.\.\/)/.test(importPath)) {
return;
}
@@ -69,7 +69,7 @@ module.exports = {
ImportDeclaration(node) {
const importPath = node.source.value;
- if (!/^(\.?\.\/)/.test(importPath)) {
+ if (!/^(\.\.\/)/.test(importPath)) {
return;
}

View file

@ -1,5 +1,5 @@
diff --git a/lib/rules/no-useless-escape.js b/lib/rules/no-useless-escape.js diff --git a/lib/rules/no-useless-escape.js b/lib/rules/no-useless-escape.js
index 0e0f6f09f2c35f3276173c08f832cde9f2cf56a0..7dc22851715f3574d935f513c1b5e35552985711 100644 index 0e0f6f09f2c35f3276173c08f832cde9f2cf56a0..f764ac7ab6eebbdab22a4d0b12c4fd3919f56368 100644
--- a/lib/rules/no-useless-escape.js --- a/lib/rules/no-useless-escape.js
+++ b/lib/rules/no-useless-escape.js +++ b/lib/rules/no-useless-escape.js
@@ -65,13 +65,31 @@ module.exports = { @@ -65,13 +65,31 @@ module.exports = {

File diff suppressed because it is too large Load diff