Fix trunk tests
MODIFY
packages/@romejs/cli-diagnostics/buildMessageCodeFrame.ts
packages/@romejs/cli-diagnostics/buildMessageCodeFrame.ts
@@ -122,15 +122,6 @@ export default function buildMessageCodeFrame(
});
}
- // If there's no lines to target then return the normal marker
- if (
- formattedLines.length === 0 ||
- end.line === number1Neg1 ||
- start.line === number1Neg1
- ) {
- return CODE_FRAME_INDENT + markerMessage;
- }
-
// If we have too many lines in our selection, then collapse them to an ellipsis
const pruned = formattedLines.length > MAX_CODE_FRAME_LINES + 2;
if (pruned) {
@@ -149,6 +140,15 @@ export default function buildMessageCodeFrame(
}
}
+ // If there's no lines to target then return the normal marker
+ if (
+ formattedLines.length === 0 ||
+ end.line === number1Neg1 ||
+ start.line === number1Neg1
+ ) {
+ return CODE_FRAME_INDENT + markerMessage;
+ }
+
// Don't output a gutter if there's only a single line
const noGutter = allLines.length === 1;

MODIFY
packages/@romejs/js-compiler/__rtests__/__rsnapshots__/analyzeDependencies.ts.rsnap
packages/@romejs/js-compiler/__rtests__/__rsnapshots__/analyzeDependencies.ts.rsnap
"discovers export star": "Object {\n diagnostics: Array []\n firstTopAwaitLocation: undefined\n importFirstUsage: Array []\n moduleType: 'es'\n syntax: Array []\n exports: Array [\n externalAll {\n kind: 'value'\n source: 'foobar'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 29\n index: 30\n line: 2\n }\n start: Object {\n column: 6\n index: 7\n line: 2\n }\n }\n }\n ]\n dependencies: Array [\n es {\n kind: 'value'\n all: true\n async: false\n names: Array []\n optional: false\n source: 'foobar'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 28\n index: 29\n line: 2\n }\n start: Object {\n column: 20\n index: 21\n line: 2\n }\n }\n }\n ]\n}",
"discovers import star": "Object {\n diagnostics: Array []\n exports: Array []\n firstTopAwaitLocation: undefined\n importFirstUsage: Array []\n moduleType: 'es'\n syntax: Array []\n dependencies: Array [\n es {\n kind: 'value'\n all: false\n async: false\n names: Array []\n optional: false\n source: 'foobar'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 35\n index: 36\n line: 2\n }\n start: Object {\n column: 27\n index: 28\n line: 2\n }\n }\n }\n ]\n}",
"discovers import specifiers": "Object {\n diagnostics: Array []\n exports: Array []\n firstTopAwaitLocation: undefined\n importFirstUsage: Array []\n moduleType: 'es'\n syntax: Array []\n dependencies: Array [\n es {\n kind: 'value'\n all: false\n async: false\n optional: false\n source: 'foobar'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 63\n index: 64\n line: 2\n }\n start: Object {\n column: 55\n index: 56\n line: 2\n }\n }\n names: Array [\n value {\n name: 'bar'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 17\n index: 18\n line: 2\n }\n start: Object {\n column: 14\n index: 15\n line: 2\n }\n }\n }\n value {\n name: 'foo'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 22\n index: 23\n line: 2\n }\n start: Object {\n column: 19\n index: 20\n line: 2\n }\n }\n }\n value {\n name: 'default'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 38\n index: 39\n line: 2\n }\n start: Object {\n column: 24\n index: 25\n line: 2\n }\n }\n }\n value {\n name: 'ya'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 48\n index: 49\n line: 2\n }\n start: Object {\n column: 40\n index: 41\n line: 2\n }\n }\n }\n ]\n }\n ]\n}",
- "discovers import default": "Object {\n diagnostics: Array []\n exports: Array []\n firstTopAwaitLocation: undefined\n importFirstUsage: Array []\n moduleType: 'es'\n syntax: Array []\n dependencies: Array [\n es {\n kind: 'value'\n all: false\n async: false\n optional: false\n source: 'foobar'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 30\n index: 31\n line: 2\n }\n start: Object {\n column: 22\n index: 23\n line: 2\n }\n }\n names: Array [\n value {\n name: 'default'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 16\n index: 17\n line: 2\n }\n start: Object {\n column: 13\n index: 14\n line: 2\n }\n }\n }\n ]\n }\n ]\n}",
+ "discovers import default": "Object {\n diagnostics: Array []\n exports: Array []\n firstTopAwaitLocation: undefined\n importFirstUsage: Array []\n moduleType: 'es'\n syntax: Array []\n dependencies: Array [\n es {\n kind: 'value'\n all: false\n async: false\n optional: false\n source: 'foobar'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 30\n index: 31\n line: 2\n }\n start: Object {\n column: 22\n index: 23\n line: 2\n }\n }\n names: Array [\n value {\n name: 'default'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 16\n index: 17\n line: 2\n }\n start: Object {\n column: 6\n index: 7\n line: 2\n }\n }\n }\n ]\n }\n ]\n}",
"discovers commonjs exports": "Object {\n dependencies: Array []\n diagnostics: Array []\n firstTopAwaitLocation: undefined\n importFirstUsage: Array []\n moduleType: 'cjs'\n syntax: Array []\n exports: Array [\n local {\n kind: 'value'\n name: 'yes'\n valueType: 'other'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 33\n index: 34\n line: 2\n }\n start: Object {\n column: 20\n index: 21\n line: 2\n }\n }\n }\n local {\n kind: 'value'\n name: 'default'\n loc: undefined\n valueType: 'other'\n }\n ]\n}",
"discovers commonjs module.exports": "Object {\n dependencies: Array []\n diagnostics: Array []\n firstTopAwaitLocation: undefined\n importFirstUsage: Array []\n moduleType: 'cjs'\n syntax: Array []\n exports: Array [\n local {\n kind: 'value'\n name: 'default'\n valueType: 'other'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 36\n index: 37\n line: 2\n }\n start: Object {\n column: 23\n index: 24\n line: 2\n }\n }\n }\n local {\n kind: 'value'\n name: 'default'\n loc: undefined\n valueType: 'other'\n }\n ]\n}",
"discovers top level await": "Object {\n dependencies: Array []\n diagnostics: Array []\n exports: Array []\n importFirstUsage: Array []\n moduleType: 'es'\n syntax: Array []\n firstTopAwaitLocation: Object {\n filename: 'unknown'\n end: Object {\n column: 20\n index: 21\n line: 2\n }\n start: Object {\n column: 6\n index: 7\n line: 2\n }\n }\n}",
"correctly identifies a file with es exports as es": "Object {\n dependencies: Array []\n diagnostics: Array []\n firstTopAwaitLocation: undefined\n importFirstUsage: Array []\n moduleType: 'es'\n syntax: Array []\n exports: Array [\n local {\n kind: 'value'\n name: 'foo'\n valueType: 'other'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 22\n index: 23\n line: 2\n }\n start: Object {\n column: 19\n index: 20\n line: 2\n }\n }\n }\n ]\n}",
"correctly identifies a file with cjs exports as cjs": "Object {\n dependencies: Array []\n firstTopAwaitLocation: undefined\n importFirstUsage: Array []\n moduleType: 'es'\n syntax: Array []\n exports: Array [\n local {\n kind: 'value'\n name: 'foo'\n valueType: 'other'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 25\n index: 26\n line: 2\n }\n start: Object {\n column: 20\n index: 21\n line: 2\n }\n }\n }\n ]\n diagnostics: Array [\n Object {\n category: 'analyzeDependencies'\n filename: 'unknown'\n language: 'js'\n message: 'You cannot use CommonJS exports in an ES module'\n mtime: undefined\n sourceType: 'module'\n origins: Array [Object {category: 'analyzeDependencies'}]\n end: Object {\n column: 25\n index: 26\n line: 2\n }\n start: Object {\n column: 6\n index: 7\n line: 2\n }\n }\n ]\n}",
"correctly identifies a file with no imports or exports as unknown": "Object {\n dependencies: Array []\n diagnostics: Array []\n exports: Array []\n firstTopAwaitLocation: undefined\n importFirstUsage: Array []\n moduleType: 'es'\n syntax: Array []\n}",
- "disallow mix of es and cjs exports": "Object {\n dependencies: Array []\n firstTopAwaitLocation: undefined\n importFirstUsage: Array []\n moduleType: 'cjs'\n syntax: Array []\n diagnostics: Array [\n Object {\n category: 'parse/js'\n filename: 'unknown'\n message: '<emphasis>import</emphasis> and <emphasis>export</emphasis> can only appear in a module'\n mtime: undefined\n origins: Array [Object {category: 'js-parser'}]\n end: Object {\n column: 31\n index: 32\n line: 2\n }\n start: Object {\n column: 6\n index: 7\n line: 2\n }\n advice: Array [\n log {\n category: 'info'\n message: 'Change the extension to <emphasis>.mjs</emphasis> to turn this file into a module'\n }\n log {\n category: 'info'\n message: 'Add <emphasis>\"type\": \"module\"</emphasis> to your <emphasis>package.json</emphasis>'\n }\n ]\n }\n ]\n exports: Array [\n local {\n kind: 'value'\n name: 'foo'\n valueType: 'other'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 22\n index: 23\n line: 2\n }\n start: Object {\n column: 19\n index: 20\n line: 2\n }\n }\n }\n local {\n kind: 'value'\n name: 'bar'\n valueType: 'other'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 25\n index: 58\n line: 3\n }\n start: Object {\n column: 20\n index: 53\n line: 3\n }\n }\n }\n local {\n kind: 'value'\n name: 'default'\n loc: undefined\n valueType: 'other'\n }\n ]\n}"
+ "disallow mix of es and cjs exports": "Object {\n dependencies: Array []\n firstTopAwaitLocation: undefined\n importFirstUsage: Array []\n moduleType: 'cjs'\n syntax: Array []\n diagnostics: Array [\n Object {\n category: 'parse/js'\n filename: 'unknown'\n message: '<emphasis>import</emphasis> and <emphasis>export</emphasis> can only appear in a module'\n mtime: undefined\n sourceType: 'script'\n origins: Array [Object {category: 'js-parser'}]\n end: Object {\n column: 31\n index: 32\n line: 2\n }\n start: Object {\n column: 6\n index: 7\n line: 2\n }\n advice: Array [\n log {\n category: 'info'\n message: 'Change the extension to <emphasis>.mjs</emphasis> to turn this file into a module'\n }\n log {\n category: 'info'\n message: 'Add <emphasis>\"type\": \"module\"</emphasis> to your <filelink emphasis target=\"package.json\" />'\n }\n ]\n }\n ]\n exports: Array [\n local {\n kind: 'value'\n name: 'foo'\n valueType: 'other'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 22\n index: 23\n line: 2\n }\n start: Object {\n column: 19\n index: 20\n line: 2\n }\n }\n }\n local {\n kind: 'value'\n name: 'bar'\n valueType: 'other'\n loc: Object {\n filename: 'unknown'\n end: Object {\n column: 25\n index: 58\n line: 3\n }\n start: Object {\n column: 20\n index: 53\n line: 3\n }\n }\n }\n local {\n kind: 'value'\n name: 'default'\n loc: undefined\n valueType: 'other'\n }\n ]\n}"
}
\ No newline at end of file

MODIFY
packages/@romejs/string-utils/__rtests__/toCamelCase.ts
packages/@romejs/string-utils/__rtests__/toCamelCase.ts
@@ -12,7 +12,7 @@ test('toCamelCase', t => {
const testCases = [
{input: 'rometest', expected: 'rometest'},
{input: 'rome test', expected: 'romeTest'},
- {input: 'RoMe TeSt', expected: 'romeTest'},
+ {input: 'RoMe TeSt', expected: 'RoMeTeSt'},
{input: 'ROME TEST', expected: 'romeTest'},
];

Fix trunk tests