From 348b6179e82b6271884f9f6b227cd2166d6652bb Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 8 Jun 2023 14:41:55 +1000 Subject: [PATCH 1/3] Add @typescript-eslint/parser to user tests --- .../parser/fixtures/project/file.ts | 0 .../parser/fixtures/project/something.ts | 1 + .../parser/fixtures/project/tsconfig.json | 3 +++ userTests/@typescript-eslint/parser/index.ts | 24 +++++++++++++++++++ .../@typescript-eslint/parser/package.json | 12 ++++++++++ .../@typescript-eslint/parser/tsconfig.json | 6 +++++ 6 files changed, 46 insertions(+) create mode 100644 userTests/@typescript-eslint/parser/fixtures/project/file.ts create mode 100644 userTests/@typescript-eslint/parser/fixtures/project/something.ts create mode 100644 userTests/@typescript-eslint/parser/fixtures/project/tsconfig.json create mode 100644 userTests/@typescript-eslint/parser/index.ts create mode 100644 userTests/@typescript-eslint/parser/package.json create mode 100644 userTests/@typescript-eslint/parser/tsconfig.json diff --git a/userTests/@typescript-eslint/parser/fixtures/project/file.ts b/userTests/@typescript-eslint/parser/fixtures/project/file.ts new file mode 100644 index 0000000..e69de29 diff --git a/userTests/@typescript-eslint/parser/fixtures/project/something.ts b/userTests/@typescript-eslint/parser/fixtures/project/something.ts new file mode 100644 index 0000000..3a56b4d --- /dev/null +++ b/userTests/@typescript-eslint/parser/fixtures/project/something.ts @@ -0,0 +1 @@ +export const something = () => {}; diff --git a/userTests/@typescript-eslint/parser/fixtures/project/tsconfig.json b/userTests/@typescript-eslint/parser/fixtures/project/tsconfig.json new file mode 100644 index 0000000..92c0a75 --- /dev/null +++ b/userTests/@typescript-eslint/parser/fixtures/project/tsconfig.json @@ -0,0 +1,3 @@ +{ + "compilerOptions": { "types": ["node"] } +} diff --git a/userTests/@typescript-eslint/parser/index.ts b/userTests/@typescript-eslint/parser/index.ts new file mode 100644 index 0000000..bd0dd79 --- /dev/null +++ b/userTests/@typescript-eslint/parser/index.ts @@ -0,0 +1,24 @@ +import * as parser from "@typescript-eslint/parser"; +import * as path from "path"; + +const code = ` +import { something } from '__PLACEHOLDER__'; + +something(); +`; + +const fixturesDirectory = path.resolve(__dirname, "fixtures"); +const projectDirectory = path.resolve(fixturesDirectory, "project"); + +parser + .parseAndGenerateServices(code, { + comment: true, + filePath: path.resolve(projectDirectory, "file.ts"), + loc: true, + moduleResolver: path.resolve(fixturesDirectory, "./moduleResolver.js"), + project: "./tsconfig.json", + range: true, + tokens: true, + tsconfigRootDir: projectDirectory, + }) + .services.program.getSemanticDiagnostics(); diff --git a/userTests/@typescript-eslint/parser/package.json b/userTests/@typescript-eslint/parser/package.json new file mode 100644 index 0000000..a3eb469 --- /dev/null +++ b/userTests/@typescript-eslint/parser/package.json @@ -0,0 +1,12 @@ +{ + "name": "typescript-eslint-parser-test", + "version": "1.0.0", + "description": "", + "main": "index.js", + "author": "", + "license": "Apache-2.0", + "dependencies": { + "@typescript-eslint/parser": "latest", + "typescript": "latest" + } +} diff --git a/userTests/@typescript-eslint/parser/tsconfig.json b/userTests/@typescript-eslint/parser/tsconfig.json new file mode 100644 index 0000000..6895316 --- /dev/null +++ b/userTests/@typescript-eslint/parser/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "strict": true, + "types": [] + } +} From 80038e8d2b18b72c0f09e6c97a6c499c821872c0 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 8 Jun 2023 14:45:51 +1000 Subject: [PATCH 2/3] Heck, add typescript-eslint also --- userTests/typescript-eslint/test.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 userTests/typescript-eslint/test.json diff --git a/userTests/typescript-eslint/test.json b/userTests/typescript-eslint/test.json new file mode 100644 index 0000000..9d17d06 --- /dev/null +++ b/userTests/typescript-eslint/test.json @@ -0,0 +1,4 @@ +{ + "cloneUrl": "https://github.com/typescript-eslint/typescript-eslint.git", + "types": [] +} From a54c2fd2ab69fdb88100e6e3e1895c16b75ea4f3 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 8 Jun 2023 14:48:08 +1000 Subject: [PATCH 3/3] Switch name to typescript-eslint-parser --- .../parser => typescript-eslint-parser}/fixtures/project/file.ts | 0 .../fixtures/project/something.ts | 0 .../fixtures/project/tsconfig.json | 0 .../parser => typescript-eslint-parser}/index.ts | 0 .../parser => typescript-eslint-parser}/package.json | 0 .../parser => typescript-eslint-parser}/tsconfig.json | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename userTests/{@typescript-eslint/parser => typescript-eslint-parser}/fixtures/project/file.ts (100%) rename userTests/{@typescript-eslint/parser => typescript-eslint-parser}/fixtures/project/something.ts (100%) rename userTests/{@typescript-eslint/parser => typescript-eslint-parser}/fixtures/project/tsconfig.json (100%) rename userTests/{@typescript-eslint/parser => typescript-eslint-parser}/index.ts (100%) rename userTests/{@typescript-eslint/parser => typescript-eslint-parser}/package.json (100%) rename userTests/{@typescript-eslint/parser => typescript-eslint-parser}/tsconfig.json (100%) diff --git a/userTests/@typescript-eslint/parser/fixtures/project/file.ts b/userTests/typescript-eslint-parser/fixtures/project/file.ts similarity index 100% rename from userTests/@typescript-eslint/parser/fixtures/project/file.ts rename to userTests/typescript-eslint-parser/fixtures/project/file.ts diff --git a/userTests/@typescript-eslint/parser/fixtures/project/something.ts b/userTests/typescript-eslint-parser/fixtures/project/something.ts similarity index 100% rename from userTests/@typescript-eslint/parser/fixtures/project/something.ts rename to userTests/typescript-eslint-parser/fixtures/project/something.ts diff --git a/userTests/@typescript-eslint/parser/fixtures/project/tsconfig.json b/userTests/typescript-eslint-parser/fixtures/project/tsconfig.json similarity index 100% rename from userTests/@typescript-eslint/parser/fixtures/project/tsconfig.json rename to userTests/typescript-eslint-parser/fixtures/project/tsconfig.json diff --git a/userTests/@typescript-eslint/parser/index.ts b/userTests/typescript-eslint-parser/index.ts similarity index 100% rename from userTests/@typescript-eslint/parser/index.ts rename to userTests/typescript-eslint-parser/index.ts diff --git a/userTests/@typescript-eslint/parser/package.json b/userTests/typescript-eslint-parser/package.json similarity index 100% rename from userTests/@typescript-eslint/parser/package.json rename to userTests/typescript-eslint-parser/package.json diff --git a/userTests/@typescript-eslint/parser/tsconfig.json b/userTests/typescript-eslint-parser/tsconfig.json similarity index 100% rename from userTests/@typescript-eslint/parser/tsconfig.json rename to userTests/typescript-eslint-parser/tsconfig.json