build: disable license fixer (#11768)

This commit is contained in:
Alex Rudenko 2024-01-29 10:13:21 +01:00 committed by GitHub
parent 96b7af5988
commit a91a9e1aa4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,13 +13,13 @@ const createRule = ESLintUtils.RuleCreator(name => {
const copyrightPattern = /Copyright ([0-9]{4}) Google Inc\./; const copyrightPattern = /Copyright ([0-9]{4}) Google Inc\./;
const currentYear = new Date().getFullYear; // const currentYear = new Date().getFullYear;
const licenseHeader = `/** // const licenseHeader = `/**
* @license // * @license
* Copyright ${currentYear} Google Inc. // * Copyright ${currentYear} Google Inc.
* SPDX-License-Identifier: Apache-2.0 // * SPDX-License-Identifier: Apache-2.0
*/`; // */`;
const enforceLicenseRule = createRule<[], 'licenseRule'>({ const enforceLicenseRule = createRule<[], 'licenseRule'>({
name: 'check-license', name: 'check-license',
@ -29,7 +29,7 @@ const enforceLicenseRule = createRule<[], 'licenseRule'>({
description: 'Validate existence of license header', description: 'Validate existence of license header',
requiresTypeChecking: false, requiresTypeChecking: false,
}, },
fixable: 'code', fixable: undefined, // TODO: change to 'code' once fixer works.
schema: [], schema: [],
messages: { messages: {
licenseRule: 'Add license header.', licenseRule: 'Add license header.',
@ -65,13 +65,14 @@ const enforceLicenseRule = createRule<[], 'licenseRule'>({
// Add header license // Add header license
if (!header || !header.value.includes('@license')) { if (!header || !header.value.includes('@license')) {
const startLoc: [number, number] = [0, 88]; // const startLoc: [number, number] = [0, 88];
context.report({ context.report({
node: node, node: node,
messageId: 'licenseRule', messageId: 'licenseRule',
fix(fixer) { // TODO: fix the fixer.
return fixer.insertTextBeforeRange(startLoc, licenseHeader); // fix(fixer) {
}, // return fixer.insertTextBeforeRange(startLoc, licenseHeader);
// },
}); });
} }
}, },