-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Enable eslint rules prefer-rest-params and prefer-spread #55181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@typescript-bot perf test this |
Heya @jakebailey, I've started to run the perf test suite on this PR at 075c733. You can monitor the build here. Update: The results are in! |
@jakebailey Here they are:
CompilerComparison Report - main..55181
System
Hosts
Scenarios
TSServerComparison Report - main..55181
System
Hosts
Scenarios
StartupComparison Report - main..55181
System
Hosts
Scenarios
Developer Information: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good as long as there's no performance difference.
@typescript-bot new perf test this faster |
Heya @jakebailey, I've started to run the tsc-only perf test suite on this PR at 35bb3c3. You can monitor the build here. Update: The results are in! |
Now that I think harder, I wonder if this was written this way to work around #498, which no longer applies given our emit target is no longer ancient. |
@jakebailey Here they are:
CompilerComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
Aha, yes, I think I'm on the right track in that thinking: Playground Link export function trace(host: ModuleResolutionHost, message: DiagnosticMessage, ...args: any[]): void;
export function trace(host: ModuleResolutionHost): void {
host.trace!(formatMessage.apply(undefined, arguments));
}
export function trace2(host: ModuleResolutionHost, message: DiagnosticMessage, ...args: any[]): void {
host.trace!(formatMessage(message, ...args));
} is in ES5 export function trace(host) {
host.trace(formatMessage.apply(undefined, arguments));
}
export function trace2(host, message) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
host.trace(formatMessage.apply(void 0, __spreadArray([message], args, false)));
} But post-modules, we're not emitting in ES5 anymore. This gives me more confidence in this change. |
And, perf is nice and clean. |
This is somewhat involved as our diagnostic handling was all
arguments
based.I somewhat recently tried to make this consistent in #53193 but apparently didn't go all the way down to the bottom, which this PR necessarily has to do.
There are some places where I chose to just ignore things. I'm unsure if there are better ways to write things but most of those uses also already disabled a lint for using non-arrow functions.
It's possible that there's a perf factor here but I can't seem to observe one, and the callers to the diagnostics stuff already use spread.