-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`lint https://github.com/mmkal/expect-type 1`] = ` | ||
" | ||
> [email protected] eslint <div>/expect-type | ||
> eslint --max-warnings 0 "." "--fix" "--max-warnings" "0" | ||
<div>/expect-type/src/branding.ts | ||
<line>:<col> error The \`Function\` type accepts any function-like value. | ||
Prefer explicitly defining any function parameters and return type @typescript-eslint/no-unsafe-function-type | ||
<div>/expect-type/src/index.ts | ||
<line>:<col> error The \`Function\` type accepts any function-like value. | ||
Prefer explicitly defining any function parameters and return type @typescript-eslint/no-unsafe-function-type | ||
<div>/expect-type/src/utils.ts | ||
<line>:<col> error 'secret' is assigned a value but only used as a type. Allowed unused vars must match /^_/u @typescript-eslint/no-unused-vars | ||
<div>/expect-type/test/ts-output.ts | ||
<line>:<col> warning Use default import for module \`node:path\` unicorn/import-style | ||
<div>/expect-type/test/types.test.ts | ||
<line>:<col> error Expected an assignment or function call and instead saw an expression @typescript-eslint/no-unused-expressions | ||
<line>:<col> error Expected an assignment or function call and instead saw an expression @typescript-eslint/no-unused-expressions | ||
<div>/expect-type/test/usage.test.ts | ||
<line>:<col> error 'A' is defined but only used as a type. Allowed unused vars must match /^_/u @typescript-eslint/no-unused-vars | ||
<line>:<col> error 'B' is defined but only used as a type. Allowed unused vars must match /^_/u @typescript-eslint/no-unused-vars | ||
<line>:<col> error 'C' is defined but only used as a type. Allowed unused vars must match /^_/u @typescript-eslint/no-unused-vars | ||
✖ 9 problems (8 errors, 1 warning) | ||
ELIFECYCLE Command failed with exit code 1." | ||
`; | ||
exports[`lint https://github.com/mmkal/trpc-cli 1`] = ` | ||
" | ||
<div>/trpc-cli/src/index.ts | ||
<line>:<col> error The \`Function\` type accepts any function-like value. | ||
Prefer explicitly defining any function parameters and return type @typescript-eslint/no-unsafe-function-type | ||
<line>:<col> error Expected an error object to be thrown @typescript-eslint/only-throw-error | ||
<div>/trpc-cli/src/util.ts | ||
<line>:<col> error The \`Function\` type accepts any function-like value. | ||
Prefer explicitly defining any function parameters and return type @typescript-eslint/no-unsafe-function-type | ||
✖ 3 problems (3 errors, 0 warnings) | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,23 +7,34 @@ const reposToTest = [ | |
'https://github.com/mmkal/trpc-cli', | ||
] | ||
|
||
const ts = Date.now().toString() | ||
|
||
for (const repo of reposToTest) { | ||
test( | ||
`lint ${repo}`, | ||
async () => { | ||
const {execa} = await import('execa') | ||
await execa('pnpm', ['build']) | ||
const tmp = path.join(`/tmp/eslint-plugin-mmkal-testing`, Date.now().toString()) | ||
const tmp = path.join(`/tmp/eslint-plugin-mmkal-testing`, ts) | ||
fs.mkdirSync(tmp, {recursive: true}) | ||
await execa('git', ['clone', repo], {cwd: tmp}) | ||
const [cloneName, ...otherFiles] = fs.readdirSync(tmp) | ||
const [cloneName, ...otherFiles] = fs.readdirSync(tmp).filter(f => f === repo.split('/').pop()) | ||
const clone = path.join(tmp, cloneName) | ||
expect(otherFiles).toEqual([]) | ||
await execa('pnpm', ['install'], {cwd: clone}) | ||
await execa(path.join(process.cwd(), 'node_modules', '.bin', 'link'), [process.cwd()], {cwd: clone}) | ||
const {all: lint} = await execa('pnpm', ['eslint', '.', '--fix', '--max-warnings', '0'], {cwd: clone}) | ||
const {all: lint} = await execa('pnpm', ['eslint', '.', '--fix', '--max-warnings', '0'], { | ||
all: true, | ||
cwd: clone, | ||
reject: false, | ||
}) | ||
|
||
expect(lint!.toLowerCase()).not.toContain('error') | ||
const snapshot = lint | ||
.replaceAll(tmp, '<dir>') | ||
.replaceAll('/private<dir>/', '<dir>/') | ||
.replaceAll(ts, '<timestamp>') | ||
.replaceAll(/\d+:\d+/g, '<line>:<col>') | ||
expect(snapshot).toMatchSnapshot() | ||
Check failure on line 37 in test/mmkal-repos.test.ts GitHub Actions / testtest/mmkal-repos.test.ts > lint https://github.com/mmkal/expect-type
Check failure on line 37 in test/mmkal-repos.test.ts GitHub Actions / testtest/mmkal-repos.test.ts > lint https://github.com/mmkal/trpc-cli
|
||
}, | ||
{timeout: 30_000}, | ||
) | ||
|