Skip to content

Commit 9476060

Browse files
committed
feature: @putout/operator-find-file-up: types
1 parent 5c302be commit 9476060

7 files changed

Lines changed: 18 additions & 11 deletions

File tree

packages/operator-find-file-up/.madrun.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import {run} from 'madrun';
22

33
export default {
4-
'wisdom': () => run(['lint', 'test']),
4+
'wisdom': () => run(['lint', 'coverage', 'test:dts']),
55
'test': () => `tape 'test/*.js' 'lib/**/*.spec.js'`,
6+
'test:dts': () => `check-dts test/*.ts`,
67
'watch:test': async () => `nodemon -w lib -x "${await run('test')}"`,
78
'lint': () => 'putout .',
89
'fresh:lint': () => run('lint', '--fresh'),

packages/operator-find-file-up/.nycrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"exclude": [
55
"**/*.spec.*",
66
"**/*.config.*",
7+
"**/*.ts",
78
"**/fixture",
89
".*.*",
910
"test"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import {NodePath} from '@putout/babel';
2+
3+
export function findFileUp(file: NodePath, name: string): NodePath | null;
4+

packages/operator-find-file-up/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
"url": "git+https://github.com/coderaiser/putout.git"
1515
},
1616
"scripts": {
17+
"wisdom": "madrun wisdom",
1718
"test": "madrun test",
19+
"test:dts": "madrun test:dts",
1820
"watch:test": "madrun watch:test",
1921
"lint": "madrun lint",
2022
"fresh:lint": "madrun fresh:lint",
@@ -37,6 +39,7 @@
3739
"@putout/operator-json": "^3.0.0",
3840
"@putout/plugin-nodejs": "*",
3941
"@putout/test": "^15.0.0",
42+
"check-dts": "^1.0.0",
4043
"eslint": "^10.0.0",
4144
"eslint-plugin-putout": "^31.0.0",
4245
"madrun": "^13.0.0",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import {findFileUp} from '../lib/find-file-up.js';
2+
3+
// THROWS Expected 2 arguments, but got 1
4+
findFileUp(5);

packages/putout/test/operator.errors.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,30 @@ const {
1111
isKeyword,
1212
findFile,
1313
matchFiles,
14+
findFileUp,
1415
} = operator;
1516

1617
// THROWS Expected 2 arguments, but got 1.
1718
replaceWith(1);
18-
1919
// THROWS Expected 2-4 arguments, but got 1.
2020
compare('hello');
21-
2221
// THROWS Expected 2 arguments, but got 1.
2322
traverse(1);
24-
2523
// THROWS Argument of type 'number' is not assignable to parameter of type 'string'
2624
toJS(5);
27-
2825
// THROWS Expected 2 arguments, but got 1
2926
hasTagName(5);
30-
3127
// THROWS Expected 2 arguments, but got 1.
3228
replaceWith(1);
33-
3429
// THROWS Argument of type 'number' is not assignable to parameter of type 'AddArgsOptions'
3530
addArgs(5);
36-
3731
// THROWS Argument of type 'number' is not assignable to parameter of type 'DeclareOptions'
3832
declare(5);
39-
4033
// THROWS Argument of type 'number' is not assignable to parameter of type 'string'
4134
isKeyword(5);
42-
4335
// THROWS Argument of type 'number' is not assignable to parameter of type 'NodePath_Final'.
4436
findFile(5, 'hello');
45-
4637
// THROWS Expected 1 arguments, but got 2.
4738
matchFiles(5, 'hello');
39+
// THROWS Expected 2 arguments, but got 1
40+
findFileUp(5);

packages/putout/types/operator.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ export * from '@putout/operator-ignore';
99
export * from '@putout/operator-add-args';
1010
export * from '@putout/operator-filesystem';
1111
export * from '@putout/operator-match-files';
12+
export * from '@putout/operator-find-file-up';
1213

0 commit comments

Comments
 (0)