reorg after catching up wiht master
MODIFY
packages/@romejs/core/master/fs/MemoryFileSystem.ts
packages/@romejs/core/master/fs/MemoryFileSystem.ts
@@ -11,8 +11,16 @@ import {
ManifestDefinition,
normalizeManifest,
} from '@romejs/codec-js-manifest';
-import {PathPatterns, matchPathPatterns, parsePathPattern} from '@romejs/path-match';
-import {ProjectConfig, ROME_CONFIG_FILENAMES, ProjectDefinition} from '@romejs/project';
+import {
+ PathPatterns,
+ matchPathPatterns,
+ parsePathPattern,
+} from '@romejs/path-match';
+import {
+ ProjectConfig,
+ ROME_CONFIG_FILENAMES,
+ ProjectDefinition,
+} from '@romejs/project';
import {
DiagnosticsProcessor,
getDiagnosticsFromError,

MODIFY
packages/@romejs/core/master/testing/TestRunner.ts
packages/@romejs/core/master/testing/TestRunner.ts
@@ -17,6 +17,7 @@ import {
InspectorClientCloseError,
InspectorClient,
CoverageCollector,
+ NativeStructuredError,
sourceMapManager,
urlToFilename,
ErrorFrame,

ADD
packages/@romejs/js-compiler/transforms/lint/duplicateImportSource.test.md
+# `duplicateImportSource.test.ts`
+
+**DO NOT MODIFY**. This file has been autogenerated. Run `rome test packages/@romejs/js-compiler/transforms/lint/duplicateImportSource.test.ts --update-snapshots` to update.
+
+## `duplicate import source`
+
+```javascript
+Object {
+ src: '\n import foo from \'./testdummy.ts\';\n import {bar} from \'./testdummy.ts\';\n import type {fooType} from \'./testdummy.ts\';\n \n const typedFoo: fooType = {\n type: \'foo\'\n } \n console.log(typedFoo, foo, bar);\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: 18
+ index: 149
+ line: 6
+ }
+ start: Object {
+ column: 18
+ index: 149
+ line: 6
+ }
+ 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/duplicateImportSource'
+ filename: 'unknown'
+ fixable: true
+ language: 'js'
+ message: 'This module has already been imported'
+ mtime: undefined
+ sourceType: 'module'
+ origins: Array [Object {category: 'lint'}]
+ end: Object {
+ column: 39
+ index: 78
+ line: 3
+ }
+ start: Object {
+ column: 4
+ index: 43
+ line: 3
+ }
+ advice: Array [
+ log {
+ category: 'info'
+ message: 'Previously imported here'
+ }
+ frame {
+ filename: 'unknown'
+ end: Object {
+ column: 37
+ index: 38
+ line: 2
+ }
+ start: Object {
+ column: 4
+ index: 5
+ line: 2
+ }
+ }
+ ]
+ }
+ Object {
+ category: 'lint/unusedVariables'
+ filename: 'unknown'
+ language: 'js'
+ message: 'Unused import <emphasis>fooType</emphasis>'
+ mtime: undefined
+ sourceType: 'module'
+ origins: Array [Object {category: 'lint'}]
+ end: Object {
+ column: 24
+ index: 103
+ line: 4
+ }
+ start: Object {
+ column: 17
+ index: 96
+ line: 4
+ }
+ }
+ ]
+}
+```

RENAME
packages/@romejs/js-compiler/transforms/lint/__rtests__/duplicateImportSource.ts
packages/@romejs/js-compiler/transforms/lint/duplicateImportSource.test.ts
*/
import test from '@romejs/test';
-import {
- testLint,
- LINT_ENABLED_FORMAT_DISABLED_CONFIG,
-} from '../../../__rtests__/lint';
+import {testLint} from '../../api/lint.test';
-test('duplicate import source', async t => {
- const res = await testLint(
- `
+test('duplicate import source', async (t) => {
+ const res = await testLint(`
import foo from './testdummy.ts';
import {bar} from './testdummy.ts';
import type {fooType} from './testdummy.ts';
@@ -22,8 +18,6 @@ test('duplicate import source', async t => {
type: 'foo'
}
console.log(typedFoo, foo, bar);
- `,
- LINT_ENABLED_FORMAT_DISABLED_CONFIG,
- );
+ `);
t.snapshot(res);
});

MODIFY
packages/@romejs/js-compiler/transforms/lint/duplicateImportSource.ts
packages/@romejs/js-compiler/transforms/lint/duplicateImportSource.ts
@@ -23,10 +23,8 @@ export default {
const source = bodyNode.source.value;
// Allow duplicate sources if the `importKind` is different
- const sourceKey =
- bodyNode.importKind === undefined
- ? source
- : `${bodyNode.importKind}:${source}`;
+ const sourceKey = bodyNode.importKind === undefined
+ ? source : `${bodyNode.importKind}:${source}`;
const seenLoc = seenSources.get(sourceKey);
if (seenLoc === undefined) {
@@ -68,18 +66,16 @@ export default {
continue;
}
- let specifiers =
- bodyNode.specifiers === undefined ? [] : bodyNode.specifiers;
+ let specifiers = bodyNode.specifiers === undefined
+ ? [] : bodyNode.specifiers;
// Find and concat all duplicate imports
for (let x = i + 1; x < node.body.length; x++) {
const possibleDuplicateNode = node.body[x];
- if (
- possibleDuplicateNode.type === 'ImportDeclaration' &&
+ if (possibleDuplicateNode.type === 'ImportDeclaration' &&
bodyNode.source.value === possibleDuplicateNode.source.value &&
- bodyNode.importKind === possibleDuplicateNode.importKind
- ) {
+ bodyNode.importKind === possibleDuplicateNode.importKind) {
skipImports.add(possibleDuplicateNode);
if (possibleDuplicateNode.specifiers !== undefined) {
specifiers = [

RENAME
packages/@romejs/js-compiler/transforms/lint/__rtests__/testdummy.ts
packages/@romejs/js-compiler/transforms/lint/testdummy.ts
export default 'foo';
+
export const bar = 'baz';
-export type fooType = {
- type: string;
-};
+export type fooType = {type: string};

MODIFY
packages/@romejs/js-generator/node/parentheses.ts
packages/@romejs/js-generator/node/parentheses.ts
* LICENSE file in the root directory of this source tree.
*/
-import {MemberExpression, TSInferType} from '@romejs/js-ast';
-import {isFor, isUnaryLike, isConditional, isBinary} from '@romejs/js-ast-utils';
import {
+ MemberExpression,
+ TSInferType,
+
AnyNode,
FlowNullableTypeAnnotation,
UpdateExpression,
@@ -28,6 +29,7 @@ import {
FlowFunctionTypeAnnotation,
OptionalCallExpression,
} from '@romejs/js-ast';
+import {isFor, isUnaryLike, isConditional, isBinary} from '@romejs/js-ast-utils';
const PRECEDENCE = {
'||': 0,

reorg after catching up wiht master