Ran scripts/lint/add and fixed what the sortComp warning message pointed to
MODIFY
packages/@romejs/compiler/lint/rules/react/sortComp.test.md
packages/@romejs/compiler/lint/rules/react/sortComp.test.md
Binary files a/packages/@romejs/compiler/lint/rules/react/sortComp.test.md and b/packages/@romejs/compiler/lint/rules/react/sortComp.test.md differ

MODIFY
packages/@romejs/compiler/lint/rules/react/sortComp.test.ts
packages/@romejs/compiler/lint/rules/react/sortComp.test.ts
import {test} from "rome";
import {testLint} from "../../utils/testing";
+import {dedent} from "@romejs/string-utils";
test(
"react sort comp",
@@ -8,7 +9,7 @@ test(
t,
{
valid: [
- `
+ dedent`
// Must validate a full class
class Hello extends React.Component {
displayName = ''
@@ -32,7 +33,7 @@ test(
}
};
`,
- `
+ dedent`
// Must validate a class with missing groups
class Hello extends React.Component {
render() {
@@ -40,7 +41,7 @@ test(
}
};
`,
- `
+ dedent`
// Must put a custom method in \'everything-else\'
class Hello extends React.Component {
onClick() {}
@@ -49,7 +50,7 @@ test(
}
};
`,
- `
+ dedent`
// Must validate a full React class
class Hello extends React.Component {
displayName = \'\'
@@ -75,106 +76,99 @@ test(
}
};
`,
- [
- "// Must validate React 16.3 lifecycle methods with the default parser",
- "class Hello extends React.Component {",
- " constructor() {}",
- " static getDerivedStateFromProps() {}",
- " UNSAFE_componentWillMount() {}",
- " componentDidMount() {}",
- " UNSAFE_componentWillReceiveProps() {}",
- " shouldComponentUpdate() {}",
- " UNSAFE_componentWillUpdate() {}",
- " getSnapshotBeforeUpdate() {}",
- " componentDidUpdate() {}",
- " componentDidCatch() {}",
- " componentWillUnmount() {}",
- " testInstanceMethod() {}",
- " render() { return (<div>Hello</div>); }",
- "}",
- ].join("\n"),
- [
- "// Must validate a full React 16.3 ES6 class",
- "class Hello extends React.Component {",
- " static displayName = ''",
- " static propTypes = {}",
- " static defaultProps = {}",
- " constructor() {}",
- " state = {}",
- " static getDerivedStateFromProps = () => {}",
- " UNSAFE_componentWillMount = () => {}",
- " componentDidMount = () => {}",
- " UNSAFE_componentWillReceiveProps = () => {}",
- " shouldComponentUpdate = () => {}",
- " UNSAFE_componentWillUpdate = () => {}",
- " getSnapshotBeforeUpdate = () => {}",
- " componentDidUpdate = () => {}",
- " componentDidCatch = () => {}",
- " componentWillUnmount = () => {}",
- " testArrowMethod = () => {}",
- " testInstanceMethod() {}",
- " render = () => (<div>Hello</div>)",
- "}",
- ].join("\n"),
- [
- "// Must allow us to use 'constructor' as a method name",
- "class Hello extends React.Component {",
- " constructor() {}",
- " displayName() {}",
- " render() {",
- " return <div>Hello</div>;",
- " }",
- "}",
- ].join("\n"),
- [
- "// Must ignore stateless components",
- "function Hello(props) {",
- " return <div>Hello {props.name}</div>",
- "}",
- ].join("\n"),
- [
- "// Must ignore stateless components (arrow function with explicit return)",
- "var Hello = props => (",
- " <div>Hello {props.name}</div>",
- ")",
- ].join("\n"),
- [
- "// Non-react classes should be ignored, even in expressions",
- "return class Hello {",
- " render() {",
- " return <div>{this.props.text}</div>;",
- " }",
- " props: { text: string };",
- " constructor() {}",
- " state: Object = {};",
- "}",
- ].join("\n"),
- [
- "// Non-react classes should be ignored, even in expressions",
- "return class {",
- " render() {",
- " return <div>{this.props.text}</div>;",
- " }",
- " props: { text: string };",
- " constructor() {}",
- " state: Object = {};",
- "}",
- ].join("\n"),
- // [
- // "// static lifecycle methods can be grouped (with statics)",
- // "class Hello extends React.Component {",
- // " static getDerivedStateFromProps() {}",
- // " constructor() {}",
- // "}",
- // ].join("\n"),
- [
- "// static lifecycle methods can be grouped (with lifecycle)",
- "class Hello extends React.Component {",
- " constructor() {}",
- " static getDerivedStateFromProps() {}",
- "}",
- ].join("\n"),
- `
+ dedent`
+ // Must validate React 16.3 lifecycle methods with the default parser
+ class Hello extends React.Component {
+ constructor() {}
+ static getDerivedStateFromProps() {}
+ UNSAFE_componentWillMount() {}
+ componentDidMount() {}
+ UNSAFE_componentWillReceiveProps() {}
+ shouldComponentUpdate() {}
+ UNSAFE_componentWillUpdate() {}
+ getSnapshotBeforeUpdate() {}
+ componentDidUpdate() {}
+ componentDidCatch() {}
+ componentWillUnmount() {}
+ testInstanceMethod() {}
+ render() { return (<div>Hello</div>); }
+ }
+ `,
+ dedent`
+ // Must validate a full React 16.3 ES6 class
+ class Hello extends React.Component {
+ static displayName = ''
+ static propTypes = {}
+ static defaultProps = {}
+ constructor() {}
+ state = {}
+ static getDerivedStateFromProps = () => {}
+ UNSAFE_componentWillMount = () => {}
+ componentDidMount = () => {}
+ UNSAFE_componentWillReceiveProps = () => {}
+ shouldComponentUpdate = () => {}
+ UNSAFE_componentWillUpdate = () => {}
+ getSnapshotBeforeUpdate = () => {}
+ componentDidUpdate = () => {}
+ componentDidCatch = () => {}
+ componentWillUnmount = () => {}
+ testArrowMethod = () => {}
+ testInstanceMethod() {}
+ render = () => (<div>Hello</div>)
+ }
+ `,
+ dedent`
+ // Must allow us to use 'constructor' as a method name
+ class Hello extends React.Component {
+ constructor() {}
+ displayName() {}
+ render() {
+ return <div>Hello</div>;
+ }
+ }
+ `,
+ dedent`
+ // Must ignore stateless components
+ function Hello(props) {
+ return <div>Hello {props.name}</div>
+ }
+ `,
+ dedent`
+ // Must ignore stateless components (arrow function with explicit return)
+ var Hello = props => (
+ <div>Hello {props.name}</div>
+ )
+ `,
+ dedent`
+ // Non-react classes should be ignored, even in expressions
+ return class Hello {
+ render() {
+ return <div>{this.props.text}</div>;
+ }
+ props: { text: string };
+ constructor() {}
+ state: Object = {};
+ }
+ `,
+ dedent`
+ // Non-react classes should be ignored, even in expressions
+ return class {
+ render() {
+ return <div>{this.props.text}</div>;
+ }
+ props: { text: string };
+ constructor() {}
+ state: Object = {};
+ }
+ `,
+ dedent`
+ // static lifecycle methods can be grouped (with lifecycle)
+ class Hello extends React.Component {
+ constructor() {}
+ static getDerivedStateFromProps() {}
+ }
+ `,
+ dedent`
class MyComponent extends React.Component {
static propTypes;
state = {};
@@ -184,7 +178,7 @@ test(
}
}
`,
- `
+ dedent`
class MyComponent extends React.Component {
static getDerivedStateFromProps() {}
static foo;
@@ -193,7 +187,7 @@ test(
}
}
`,
- `
+ dedent`
class MyComponent extends React.Component {
static getDerivedStateFromProps() {}
static foo = 'some-str';
@@ -202,7 +196,7 @@ test(
}
}
`,
- `
+ dedent`
class MyComponent extends React.Component {
static getDerivedStateFromProps() {}
foo = {};
@@ -212,7 +206,7 @@ test(
}
}
`,
- `
+ dedent`
class MyComponent extends React.Component {
static getDerivedStateFromProps() {}
static bar = 1;
@@ -222,7 +216,7 @@ test(
}
}
`,
- `
+ dedent`
class MyComponent extends React.Component {
constructor() {
super(props);
@@ -237,46 +231,46 @@ test(
`,
],
invalid: [
- [
- "// Must force a lifecycle method to be placed before render",
- "class Hello extends React.Component {",
- " render() {",
- " return <div>Hello</div>;",
- " }",
- " displayName = 'Hello'",
- "};",
- ].join("\n"),
- [
- "// Must force a custom method to be placed before render",
- "class Hello extends React.Component {",
- " render() {",
- " return <div>Hello</div>;",
- " }",
- " onClick() {}",
- "};",
- ].join("\n"),
- [
- "// Must force a custom method to be placed before render, even in function",
- "var Hello = () => {",
- " return class Test extends React.Component {",
- " render () {",
- " return <div>Hello</div>;",
- " }",
- " onClick () {}",
- " }",
- "};",
- ].join("\n"),
- [
- "// Type Annotations should not be at the top by default",
- "class Hello extends React.Component {",
- " props: { text: string };",
- " constructor() {}",
- " state: Object = {};",
- " render() {",
- " return <div>{this.props.text}</div>;",
- " }",
- "}",
- ].join("\n"),
+ dedent`
+ // Must force a lifecycle method to be placed before render
+ class Hello extends React.Component {
+ render() {
+ return <div>Hello</div>;
+ }
+ displayName = 'Hello'
+ };
+ `,
+ dedent`
+ // Must force a custom method to be placed before render
+ class Hello extends React.Component {
+ render() {
+ return <div>Hello</div>;
+ }
+ onClick() {}
+ };
+ `,
+ dedent`
+ // Must force a custom method to be placed before render, even in function
+ var Hello = () => {
+ return class Test extends React.Component {
+ render () {
+ return <div>Hello</div>;
+ }
+ onClick () {}
+ }
+ };
+ `,
+ dedent`
+ // Type Annotations should not be at the top by default
+ class Hello extends React.Component {
+ props: { text: string };
+ constructor() {}
+ state: Object = {};
+ render() {
+ return <div>{this.props.text}</div>;
+ }
+ }
+ `,
],
},
{category: "lint/react/sortComp"},

MODIFY
packages/@romejs/compiler/lint/rules/react/sortComp.ts
packages/@romejs/compiler/lint/rules/react/sortComp.ts
@@ -265,9 +265,20 @@ export default {
// Add after error
position = "after";
}
+
+ let errorNode = toMove.node;
+
+ // Make the warning message point to the function name
+ if (
+ toMove.node.type === "JSClassMethod" ||
+ toMove.node.type === "JSClassProperty"
+ ) {
+ errorNode = toMove.node.key;
+ }
+
// Add diagnostics to the node
path.context.addNodeDiagnostic(
- toMove.node,
+ errorNode,
descriptions.LINT.REACT_SORT_COMP(
inOrder.name,
toMove.name,

MODIFY
packages/@romejs/core/server/fs/runtime-modules.ts
packages/@romejs/core/server/fs/runtime-modules.ts
@@ -14,19 +14,19 @@ modules.set(
new Map([
[
"index.ts",
- '/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nexport {TestHelper, test, testOptions} from "./test";\n',
+ '/**\r\n * Copyright (c) Facebook, Inc. and its affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n */\r\n\r\nexport {TestHelper, test, testOptions} from "./test";\r\n',
],
[
"package.json",
- '{\n "name": "@romejs-runtime/rome",\n "type": "module",\n "private": true,\n "main": "index.ts"\n}\n',
+ '{\r\n "name": "@romejs-runtime/rome",\r\n "type": "module",\r\n "private": true,\r\n "main": "index.ts"\r\n}\r\n',
],
[
"test.ts",
- '/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {JSONPropertyValue} from "./types";\n\nexport type AsyncFunc = () => void | undefined | Promise<void>;\n\nexport type SyncThrower = () => void;\n\nexport type ExpectedError = undefined | string | RegExp | Function;\n\nexport type TestSnapshotOptions = {\n\tfilename?: string;\n\tlanguage?: string;\n};\n\n// These diagnostics are subsets of the official diagnostics\n// We can potentially normalize these and ensure backwards compatibility with the official diagnostics\n\nexport type TestDiagnosticLogCategory = "none" | "info" | "warn" | "error";\n\nexport type TestDiagnosticAdviceInspect = {\n\ttype: "inspect";\n\tdata: JSONPropertyValue;\n};\n\nexport type TestDiagnosticAdviceList = {\n\ttype: "list";\n\tlist: Array<string>;\n};\n\nexport type TestDiagnosticAdviceCode = {\n\ttype: "code";\n\tcode: string;\n};\n\nexport type TestDiagnosticAdviceLog = {\n\ttype: "log";\n\tcategory: TestDiagnosticLogCategory;\n\ttext: string;\n};\n\nexport type TestDiagnosticAdviceItem =\n\t| TestDiagnosticAdviceInspect\n\t| TestDiagnosticAdviceCode\n\t| TestDiagnosticAdviceLog\n\t| TestDiagnosticAdviceList;\n\nexport interface TestHelper {\n\taddToAdvice(item: TestDiagnosticAdviceItem): void;\n\tclearAdvice(): void;\n\tonTeardown(callback: AsyncFunc): void;\n\tclearTimeout(): void;\n\textendTimeout(time: number): void;\n\tsetTimeout(time: number): void;\n\tcheckTimeout(): void;\n\ttruthy(value: unknown, message?: string): void;\n\tfalsy(value: unknown, message?: string): void;\n\ttrue(value: unknown, message?: string): void;\n\tfalse(value: unknown, message?: string): void;\n\tis(received: unknown, expected: unknown, message?: string): void;\n\tnot(received: unknown, expected: unknown, message?: string): void;\n\tlooksLike(received: unknown, expected: unknown, message?: string): void;\n\tnotLooksLike(received: unknown, expected: unknown, message?: string): void;\n\tthrows(\n\t\tthrower: SyncThrower,\n\t\texpected?: ExpectedError,\n\t\tmessage?: string,\n\t): void;\n\tthrowsAsync(\n\t\tthrower: AsyncFunc,\n\t\texpected?: ExpectedError,\n\t\tmessage?: string,\n\t): Promise<void>;\n\tnotThrows(nonThrower: SyncThrower, message?: string): void;\n\tnotThrowsAsync(nonThrower: AsyncFunc, message?: string): Promise<void>;\n\tregex(contents: string, regex: RegExp, message?: string): void;\n\tnotRegex(contents: string, regex: RegExp, message?: string): void;\n\tsnapshot(\n\t\texpected: unknown,\n\t\tmessage?: string,\n\t\topts?: TestSnapshotOptions,\n\t): string;\n\tinlineSnapshot(received: unknown, expected?: string | boolean | number): void;\n\tnamedSnapshot(\n\t\tname: string,\n\t\texpected: unknown,\n\t\tmessage?: string,\n\t\topts?: TestSnapshotOptions,\n\t): string;\n}\n\nexport type TestName = string | Array<string>;\n\ndeclare const __ROME__TEST_OPTIONS__: GlobalTestOptions;\n\nexport type GlobalTestOptions =\n\t| undefined\n\t| {\n\t\t\tdirname?: string;\n\t\t\tregister?: (err: Error, opts: TestOptions, callback: TestCallback) => void;\n\t\t};\n\ntype NamelessTestOptions = {\n\ttimeout?: number;\n\tonly?: boolean;\n};\n\nexport type TestCallback = (t: TestHelper) => void | undefined | Promise<void>;\n\nexport type TestOptions = NamelessTestOptions & {\n\tname: TestName;\n};\n\ntype TestArg = TestName | NamelessTestOptions | TestCallback | undefined;\n\nexport const testOptions: NonNullable<GlobalTestOptions> =\n\t__ROME__TEST_OPTIONS__ === undefined ? {} : __ROME__TEST_OPTIONS__;\n\nfunction registerTest(\n\tcallsiteError: Error,\n\topts: TestOptions,\n\tcallback: TestCallback,\n) {\n\tconst register = testOptions.register;\n\n\tif (typeof register !== "function") {\n\t\tthrow new Error("Test harness does not exist");\n\t}\n\n\tregister(callsiteError, opts, callback);\n}\n\nfunction isOptionsObject(arg: TestArg): arg is NamelessTestOptions {\n\treturn typeof arg === "object" && arg != null && !Array.isArray(arg);\n}\n\nfunction splitArgs(\n\targs: TestRegisterFunctionArgs,\n): {\n\toptions: TestOptions;\n\tcallback: TestCallback;\n} {\n\tconst name = args.shift();\n\tif (typeof name !== "string" && !Array.isArray(name)) {\n\t\tthrow new Error("Expected test name to be a string or an array of strings");\n\t}\n\n\tconst callback = args.pop();\n\tif (typeof callback !== "function") {\n\t\tthrow new Error("Expected options callback");\n\t}\n\n\tconst options = args.pop();\n\tif (options !== undefined && !isOptionsObject(options)) {\n\t\tthrow new Error("Expected options object");\n\t}\n\n\tif (args.length > 0) {\n\t\tthrow new Error("Expected to have exhausted test register arguments");\n\t}\n\n\treturn {\n\t\toptions: {\n\t\t\t...options,\n\t\t\tname,\n\t\t},\n\t\tcallback,\n\t};\n}\n\ntype TestRegisterFunctionArgs =\n\t| [TestName, TestCallback]\n\t| [TestName, NamelessTestOptions, TestCallback];\n\ntype TestRegisterFunction = (...args: TestRegisterFunctionArgs) => void;\n\nexport const test: TestRegisterFunction & {\n\tonly: TestRegisterFunction;\n} = function(...args: TestRegisterFunctionArgs) {\n\tconst {options, callback} = splitArgs(args);\n\tregisterTest(new Error(), options, callback);\n};\n\ntest.only = function(...args: TestRegisterFunctionArgs) {\n\tconst {options, callback} = splitArgs(args);\n\tregisterTest(\n\t\tnew Error(),\n\t\t{\n\t\t\t...options,\n\t\t\tonly: true,\n\t\t},\n\t\tcallback,\n\t);\n};\n',
+ '/**\r\n * Copyright (c) Facebook, Inc. and its affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n */\r\n\r\nimport {JSONPropertyValue} from "./types";\r\n\r\nexport type AsyncFunc = () => void | undefined | Promise<void>;\r\n\r\nexport type SyncThrower = () => void;\r\n\r\nexport type ExpectedError = undefined | string | RegExp | Function;\r\n\r\nexport type TestSnapshotOptions = {\r\n\tfilename?: string;\r\n\tlanguage?: string;\r\n};\r\n\r\n// These diagnostics are subsets of the official diagnostics\r\n// We can potentially normalize these and ensure backwards compatibility with the official diagnostics\r\n\r\nexport type TestDiagnosticLogCategory = "none" | "info" | "warn" | "error";\r\n\r\nexport type TestDiagnosticAdviceInspect = {\r\n\ttype: "inspect";\r\n\tdata: JSONPropertyValue;\r\n};\r\n\r\nexport type TestDiagnosticAdviceList = {\r\n\ttype: "list";\r\n\tlist: Array<string>;\r\n};\r\n\r\nexport type TestDiagnosticAdviceCode = {\r\n\ttype: "code";\r\n\tcode: string;\r\n};\r\n\r\nexport type TestDiagnosticAdviceLog = {\r\n\ttype: "log";\r\n\tcategory: TestDiagnosticLogCategory;\r\n\ttext: string;\r\n};\r\n\r\nexport type TestDiagnosticAdviceItem =\r\n\t| TestDiagnosticAdviceInspect\r\n\t| TestDiagnosticAdviceCode\r\n\t| TestDiagnosticAdviceLog\r\n\t| TestDiagnosticAdviceList;\r\n\r\nexport interface TestHelper {\r\n\taddToAdvice(item: TestDiagnosticAdviceItem): void;\r\n\tclearAdvice(): void;\r\n\tonTeardown(callback: AsyncFunc): void;\r\n\tclearTimeout(): void;\r\n\textendTimeout(time: number): void;\r\n\tsetTimeout(time: number): void;\r\n\tcheckTimeout(): void;\r\n\ttruthy(value: unknown, message?: string): void;\r\n\tfalsy(value: unknown, message?: string): void;\r\n\ttrue(value: unknown, message?: string): void;\r\n\tfalse(value: unknown, message?: string): void;\r\n\tis(received: unknown, expected: unknown, message?: string): void;\r\n\tnot(received: unknown, expected: unknown, message?: string): void;\r\n\tlooksLike(received: unknown, expected: unknown, message?: string): void;\r\n\tnotLooksLike(received: unknown, expected: unknown, message?: string): void;\r\n\tthrows(\r\n\t\tthrower: SyncThrower,\r\n\t\texpected?: ExpectedError,\r\n\t\tmessage?: string,\r\n\t): void;\r\n\tthrowsAsync(\r\n\t\tthrower: AsyncFunc,\r\n\t\texpected?: ExpectedError,\r\n\t\tmessage?: string,\r\n\t): Promise<void>;\r\n\tnotThrows(nonThrower: SyncThrower, message?: string): void;\r\n\tnotThrowsAsync(nonThrower: AsyncFunc, message?: string): Promise<void>;\r\n\tregex(contents: string, regex: RegExp, message?: string): void;\r\n\tnotRegex(contents: string, regex: RegExp, message?: string): void;\r\n\tsnapshot(\r\n\t\texpected: unknown,\r\n\t\tmessage?: string,\r\n\t\topts?: TestSnapshotOptions,\r\n\t): string;\r\n\tinlineSnapshot(received: unknown, expected?: string | boolean | number): void;\r\n\tnamedSnapshot(\r\n\t\tname: string,\r\n\t\texpected: unknown,\r\n\t\tmessage?: string,\r\n\t\topts?: TestSnapshotOptions,\r\n\t): string;\r\n}\r\n\r\nexport type TestName = string | Array<string>;\r\n\r\ndeclare const __ROME__TEST_OPTIONS__: GlobalTestOptions;\r\n\r\nexport type GlobalTestOptions =\r\n\t| undefined\r\n\t| {\r\n\t\t\tdirname?: string;\r\n\t\t\tregister?: (err: Error, opts: TestOptions, callback: TestCallback) => void;\r\n\t\t};\r\n\r\ntype NamelessTestOptions = {\r\n\ttimeout?: number;\r\n\tonly?: boolean;\r\n};\r\n\r\nexport type TestCallback = (t: TestHelper) => void | undefined | Promise<void>;\r\n\r\nexport type TestOptions = NamelessTestOptions & {\r\n\tname: TestName;\r\n};\r\n\r\ntype TestArg = TestName | NamelessTestOptions | TestCallback | undefined;\r\n\r\nexport const testOptions: NonNullable<GlobalTestOptions> =\r\n\t__ROME__TEST_OPTIONS__ === undefined ? {} : __ROME__TEST_OPTIONS__;\r\n\r\nfunction registerTest(\r\n\tcallsiteError: Error,\r\n\topts: TestOptions,\r\n\tcallback: TestCallback,\r\n) {\r\n\tconst register = testOptions.register;\r\n\r\n\tif (typeof register !== "function") {\r\n\t\tthrow new Error("Test harness does not exist");\r\n\t}\r\n\r\n\tregister(callsiteError, opts, callback);\r\n}\r\n\r\nfunction isOptionsObject(arg: TestArg): arg is NamelessTestOptions {\r\n\treturn typeof arg === "object" && arg != null && !Array.isArray(arg);\r\n}\r\n\r\nfunction splitArgs(\r\n\targs: TestRegisterFunctionArgs,\r\n): {\r\n\toptions: TestOptions;\r\n\tcallback: TestCallback;\r\n} {\r\n\tconst name = args.shift();\r\n\tif (typeof name !== "string" && !Array.isArray(name)) {\r\n\t\tthrow new Error("Expected test name to be a string or an array of strings");\r\n\t}\r\n\r\n\tconst callback = args.pop();\r\n\tif (typeof callback !== "function") {\r\n\t\tthrow new Error("Expected options callback");\r\n\t}\r\n\r\n\tconst options = args.pop();\r\n\tif (options !== undefined && !isOptionsObject(options)) {\r\n\t\tthrow new Error("Expected options object");\r\n\t}\r\n\r\n\tif (args.length > 0) {\r\n\t\tthrow new Error("Expected to have exhausted test register arguments");\r\n\t}\r\n\r\n\treturn {\r\n\t\toptions: {\r\n\t\t\t...options,\r\n\t\t\tname,\r\n\t\t},\r\n\t\tcallback,\r\n\t};\r\n}\r\n\r\ntype TestRegisterFunctionArgs =\r\n\t| [TestName, TestCallback]\r\n\t| [TestName, NamelessTestOptions, TestCallback];\r\n\r\ntype TestRegisterFunction = (...args: TestRegisterFunctionArgs) => void;\r\n\r\nexport const test: TestRegisterFunction & {\r\n\tonly: TestRegisterFunction;\r\n} = function(...args: TestRegisterFunctionArgs) {\r\n\tconst {options, callback} = splitArgs(args);\r\n\tregisterTest(new Error(), options, callback);\r\n};\r\n\r\ntest.only = function(...args: TestRegisterFunctionArgs) {\r\n\tconst {options, callback} = splitArgs(args);\r\n\tregisterTest(\r\n\t\tnew Error(),\r\n\t\t{\r\n\t\t\t...options,\r\n\t\t\tonly: true,\r\n\t\t},\r\n\t\tcallback,\r\n\t);\r\n};\r\n',
],
[
"types.ts",
- "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n// These are copied from packages/@romejs/codec-json/types.ts\nexport type JSONValue =\n\t| null\n\t| string\n\t| number\n\t| boolean\n\t| JSONObject\n\t| JSONArray;\n\nexport type JSONPropertyValue = undefined | void | JSONValue;\n\nexport type JSONObject = {\n\t[x: string]: JSONPropertyValue;\n};\n\nexport type JSONArray = Array<JSONValue>;\n",
+ "/**\r\n * Copyright (c) Facebook, Inc. and its affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n */\r\n\r\n// These are copied from packages/@romejs/codec-json/types.ts\r\nexport type JSONValue =\r\n\t| null\r\n\t| string\r\n\t| number\r\n\t| boolean\r\n\t| JSONObject\r\n\t| JSONArray;\r\n\r\nexport type JSONPropertyValue = undefined | void | JSONValue;\r\n\r\nexport type JSONObject = {\r\n\t[x: string]: JSONPropertyValue;\r\n};\r\n\r\nexport type JSONArray = Array<JSONValue>;\r\n",
],
]),
);

MODIFY
website/src/docs/lint/rules/index.md
website/src/docs/lint/rules/index.md
@@ -124,6 +124,7 @@ showHero: false
| no-useless-fragment | |
| no-will-update-set-state | |
| require-render-return | |
+| sort-comp | |
| style-prop-object | |
| void-dom-elements-no-children | |

Ran scripts/lint/add and fixed what the sortComp warning message pointed to