update snapshot for preferFunctionDeclarations.test.ts
A test in preferFunctionDeclarations.test.ts was using ts/flow syntax whilst using the js linter which didn't produce a useful snapshot.
MODIFY
packages/@romejs/js-compiler/transforms/lint/preferFunctionDeclarations.test.md
packages/@romejs/js-compiler/transforms/lint/preferFunctionDeclarations.test.md
@@ -207,37 +207,9 @@ Object {
```javascript
Object {
- src: 'const foo any = function() {};\n'
+ src: 'const foo string = function() {};\n'
suppressions: Array []
diagnostics: Array [
- Object {
- category: 'parse/js'
- filename: 'unknown'
- message: 'A type annotation is only valid inside of a TypeScript or Flow file'
- mtime: undefined
- sourceType: 'module'
- origins: Array [Object {category: 'js-parser'}]
- end: Object {
- column: 9
- index: 9
- line: 1
- }
- start: Object {
- column: 9
- index: 9
- line: 1
- }
- advice: Array [
- log {
- category: 'info'
- message: 'Did you mean <emphasis>TypeScript</emphasis>? Change the file extension to <emphasis>.ts</emphasis> or <emphasis>.tsx</emphasis>'
- }
- log {
- category: 'info'
- message: 'Did you mean <emphasis>Flow</emphasis>? Add a <emphasis>@flow</emphasis> comment annotation to the top of the file'
- }
- ]
- }
Object {
category: 'lint/unusedVariables'
filename: 'unknown'
@@ -247,8 +219,8 @@ Object {
sourceType: 'module'
origins: Array [Object {category: 'lint'}]
end: Object {
- column: 14
- index: 14
+ column: 17
+ index: 17
line: 1
}
start: Object {

MODIFY
packages/@romejs/js-compiler/transforms/lint/preferFunctionDeclarations.test.ts
packages/@romejs/js-compiler/transforms/lint/preferFunctionDeclarations.test.ts
@@ -22,5 +22,10 @@ test('prefer function declarations', async t => {
);
// Should ignore functions with return types since you can't express that with a declaration
- t.snapshot(await testLint('const foo: any = function () {};', true));
+ t.snapshot(
+ await testLint('const foo: string = function () {};', true, 'module', [
+ 'ts',
+ 'flow',
+ ]),
+ );
});

update snapshot for preferFunctionDeclarations.test.ts

A test in preferFunctionDeclarations.test.ts was using ts/flow syntax whilst using the js linter which didn't produce a useful snapshot.