Remove lineNumber from lint exceptions

This commit is contained in:
Evan Hahn 2021-05-04 11:41:59 -05:00 committed by GitHub
parent fb00464033
commit 36d8ef9678
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 2096 deletions

View file

@ -1,11 +1,11 @@
// Copyright 2018-2020 Signal Messenger, LLC
// Copyright 2018-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable no-console */
import { readFileSync } from 'fs';
import { orderBy } from 'lodash';
import { omit, orderBy } from 'lodash';
import { ExceptionType } from './types';
@ -25,5 +25,19 @@ export function loadJSON<T>(target: string): T {
export function sortExceptions(
exceptions: Array<ExceptionType>
): Array<ExceptionType> {
return orderBy(exceptions, ['path', 'lineNumber', 'rule']);
return orderBy(exceptions, [
'path',
'rule',
'reasonCategory',
'updated',
'reasonDetail',
]).map(removeLegacyAttributes);
}
// This is here in case any open changesets still touch `lineNumber`. We should remove
// this after 2021-06-01 to be conservative.
function removeLegacyAttributes(
exception: Readonly<ExceptionType>
): ExceptionType {
return omit(exception, ['lineNumber']);
}