From 45eb2e6fea40d91117a68444dc5bdc8c877524b5 Mon Sep 17 00:00:00 2001 From: eleanorjboyd Date: Mon, 16 Dec 2024 16:12:55 -0800 Subject: [PATCH 1/2] cleanup eslintignore file and create cleanup script --- .eslintignore | 18 +------------- scripts/cleanup-eslintignore.js | 44 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 scripts/cleanup-eslintignore.js diff --git a/.eslintignore b/.eslintignore index 50f4df4044d1..dd8d8db61611 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,3 @@ -pythonExtensionApi/out/ # The following files were grandfathered out of eslint. They can be removed as time permits. @@ -42,7 +41,6 @@ src/test/utils/fs.ts src/test/api.functional.test.ts -src/test/testing/mocks.ts src/test/testing/common/debugLauncher.unit.test.ts src/test/testing/common/services/configSettingService.unit.test.ts @@ -85,9 +83,7 @@ src/test/common/application/commands/reloadCommand.unit.test.ts src/test/common/installer/channelManager.unit.test.ts src/test/common/installer/pipInstaller.unit.test.ts -src/test/common/installer/installer.invalidPath.unit.test.ts src/test/common/installer/pipEnvInstaller.unit.test.ts -src/test/common/installer/productPath.unit.test.ts src/test/common/socketCallbackHandler.test.ts @@ -103,17 +99,14 @@ src/test/common/process/proc.unit.test.ts src/test/common/interpreterPathService.unit.test.ts -src/test/python_files/formatting/dummy.ts src/test/debugger/extension/adapter/adapter.test.ts src/test/debugger/extension/adapter/outdatedDebuggerPrompt.unit.test.ts src/test/debugger/extension/adapter/factory.unit.test.ts -src/test/debugger/extension/adapter/activator.unit.test.ts src/test/debugger/extension/adapter/logging.unit.test.ts src/test/debugger/extension/hooks/childProcessAttachHandler.unit.test.ts src/test/debugger/extension/hooks/childProcessAttachService.unit.test.ts src/test/debugger/utils.ts -src/test/debugger/common/protocolparser.test.ts src/test/debugger/envVars.test.ts src/test/telemetry/index.unit.test.ts @@ -121,9 +114,7 @@ src/test/telemetry/envFileTelemetry.unit.test.ts src/test/application/diagnostics/checks/macPythonInterpreter.unit.test.ts src/test/application/diagnostics/checks/pythonInterpreter.unit.test.ts -src/test/application/diagnostics/checks/invalidLaunchJsonDebugger.unit.test.ts src/test/application/diagnostics/checks/powerShellActivation.unit.test.ts -src/test/application/diagnostics/checks/invalidPythonPathInDebugger.unit.test.ts src/test/application/diagnostics/checks/envPathVariable.unit.test.ts src/test/application/diagnostics/applicationDiagnostics.unit.test.ts src/test/application/diagnostics/promptHandler.unit.test.ts @@ -154,25 +145,18 @@ src/client/activation/extensionSurvey.ts src/client/activation/common/analysisOptions.ts src/client/activation/languageClientMiddleware.ts -src/client/formatters/serviceRegistry.ts -src/client/formatters/helper.ts -src/client/formatters/dummyFormatter.ts -src/client/formatters/baseFormatter.ts src/client/testing/serviceRegistry.ts src/client/testing/main.ts src/client/testing/configurationFactory.ts src/client/testing/common/constants.ts src/client/testing/common/testUtils.ts -src/client/testing/common/socketServer.ts -src/client/testing/common/runner.ts src/client/common/helpers.ts src/client/common/net/browser.ts src/client/common/net/socket/socketCallbackHandler.ts src/client/common/net/socket/socketServer.ts src/client/common/net/socket/SocketStream.ts -src/client/common/editor.ts src/client/common/contextKey.ts src/client/common/experiments/telemetry.ts src/client/common/platform/serviceRegistry.ts @@ -257,7 +241,6 @@ src/client/debugger/extension/attachQuickPick/psProcessParser.ts src/client/debugger/extension/attachQuickPick/picker.ts src/client/application/serviceRegistry.ts -src/client/application/diagnostics/surceMapSupportService.ts src/client/application/diagnostics/base.ts src/client/application/diagnostics/applicationDiagnostics.ts src/client/application/diagnostics/filter.ts @@ -267,3 +250,4 @@ src/client/application/diagnostics/commands/ignore.ts src/client/application/diagnostics/commands/factory.ts src/client/application/diagnostics/commands/execVSCCommand.ts src/client/application/diagnostics/commands/launchBrowser.ts + diff --git a/scripts/cleanup-eslintignore.js b/scripts/cleanup-eslintignore.js new file mode 100644 index 000000000000..d836d520e138 --- /dev/null +++ b/scripts/cleanup-eslintignore.js @@ -0,0 +1,44 @@ +const fs = require('fs'); +const path = require('path'); + +const baseDir = process.cwd(); +const eslintignorePath = path.join(baseDir, '.eslintignore'); + +fs.readFile(eslintignorePath, 'utf8', (err, data) => { + if (err) { + console.error('Error reading .eslintignore file:', err); + return; + } + + const lines = data.split('\n'); + const files = lines.map((line) => line.trim()).filter((line) => line && !line.startsWith('#')); + const nonExistentFiles = []; + + files.forEach((file) => { + const filePath = path.join(baseDir, file); + if (!fs.existsSync(filePath)) { + nonExistentFiles.push(file); + } + }); + + if (nonExistentFiles.length > 0) { + console.log('The following files listed in .eslintignore do not exist:'); + nonExistentFiles.forEach((file) => console.log(file)); + + const updatedLines = lines.filter((line) => { + const trimmedLine = line.trim(); + return !nonExistentFiles.includes(trimmedLine); + }); + const updatedData = `${updatedLines.join('\n')}\n`; + + fs.writeFile(eslintignorePath, updatedData, 'utf8', (err) => { + if (err) { + console.error('Error writing to .eslintignore file:', err); + return; + } + console.log('Non-existent files have been removed from .eslintignore.'); + }); + } else { + console.log('All files listed in .eslintignore exist.'); + } +}); From e9d455ce1ccde2e8ada229eb0f49153ea8801e3e Mon Sep 17 00:00:00 2001 From: eleanorjboyd Date: Mon, 16 Dec 2024 16:26:07 -0800 Subject: [PATCH 2/2] add exception for pythonExtensionApi/out/ --- .eslintignore | 1 + scripts/cleanup-eslintignore.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.eslintignore b/.eslintignore index dd8d8db61611..a3a6e01b0ad6 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,4 @@ +pythonExtensionApi/out/ # The following files were grandfathered out of eslint. They can be removed as time permits. diff --git a/scripts/cleanup-eslintignore.js b/scripts/cleanup-eslintignore.js index d836d520e138..848f5a9c4910 100644 --- a/scripts/cleanup-eslintignore.js +++ b/scripts/cleanup-eslintignore.js @@ -16,7 +16,7 @@ fs.readFile(eslintignorePath, 'utf8', (err, data) => { files.forEach((file) => { const filePath = path.join(baseDir, file); - if (!fs.existsSync(filePath)) { + if (!fs.existsSync(filePath) && file !== 'pythonExtensionApi/out/') { nonExistentFiles.push(file); } }); @@ -27,7 +27,7 @@ fs.readFile(eslintignorePath, 'utf8', (err, data) => { const updatedLines = lines.filter((line) => { const trimmedLine = line.trim(); - return !nonExistentFiles.includes(trimmedLine); + return !nonExistentFiles.includes(trimmedLine) || trimmedLine === 'pythonExtensionApi/out/'; }); const updatedData = `${updatedLines.join('\n')}\n`;