-
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.
Merge remote-tracking branch 'origin/main' into deps
- Loading branch information
Showing
4 changed files
with
102 additions
and
1 deletion.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 <dir>/expect-type | ||
> eslint --max-warnings 0 "." "--fix" "--max-warnings" "0" | ||
<dir>/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 | ||
<dir>/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 | ||
<dir>/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 | ||
<dir>/expect-type/test/ts-output.ts | ||
<line>:<col> warning Use default import for module \`node:path\` unicorn/import-style | ||
<dir>/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 | ||
<dir>/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`] = ` | ||
" | ||
<dir>/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 | ||
<dir>/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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import * as fs from 'fs' | ||
import * as path from 'path' | ||
import {expect, test} from 'vitest' | ||
|
||
const reposToTest = [ | ||
'https://github.com/mmkal/expect-type', // | ||
'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`, ts) | ||
fs.mkdirSync(tmp, {recursive: true}) | ||
await execa('git', ['clone', repo], {cwd: 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'], { | ||
all: true, | ||
cwd: clone, | ||
reject: false, | ||
}) | ||
|
||
const snapshot = lint | ||
.replaceAll(tmp, '<dir>') | ||
.replaceAll('/private<dir>/', '<dir>/') | ||
.replaceAll(ts, '<timestamp>') | ||
.replaceAll(/\d+:\d+/g, '<line>:<col>') | ||
expect(snapshot).toMatchSnapshot() | ||
}, | ||
{timeout: 30_000}, | ||
) | ||
} |