From 16b09d35e58d4a49a51d961a67d8c35dc18b3b68 Mon Sep 17 00:00:00 2001 From: Marco Pasqualetti <24919330+marcalexiei@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:40:44 +0100 Subject: [PATCH] `expiring-todo-comments`: Fix compatibility with ESLint 9.15 (#2497) Co-authored-by: fisker --- package.json | 3 ++- rules/expiring-todo-comments.js | 15 ++++++++++----- test/integration/projects.mjs | 1 + test/package.mjs | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 0c0f92fd38..1ca5fa25e2 100644 --- a/package.json +++ b/package.json @@ -176,7 +176,8 @@ ], "eslint-plugin/require-meta-docs-url": "off", "eslint-plugin/require-meta-has-suggestions": "off", - "eslint-plugin/require-meta-schema": "off" + "eslint-plugin/require-meta-schema": "off", + "eslint-plugin/require-meta-schema-description": "off" } } ] diff --git a/rules/expiring-todo-comments.js b/rules/expiring-todo-comments.js index f38a50adb4..9f18f36896 100644 --- a/rules/expiring-todo-comments.js +++ b/rules/expiring-todo-comments.js @@ -271,13 +271,17 @@ function semverComparisonForOperator(operator) { }[operator]; } +const DEFAULT_OPTIONS = { + terms: ['todo', 'fixme', 'xxx'], + ignore: [], + ignoreDatesOnPullRequests: true, + allowWarningComments: true, +}; + /** @param {import('eslint').Rule.RuleContext} context */ const create = context => { const options = { - terms: ['todo', 'fixme', 'xxx'], - ignore: [], - ignoreDatesOnPullRequests: true, - allowWarningComments: true, + ...DEFAULT_OPTIONS, date: new Date().toISOString().slice(0, 10), ...context.options[0], }; @@ -564,7 +568,7 @@ const schema = [ }, allowWarningComments: { type: 'boolean', - default: false, + default: true, }, date: { type: 'string', @@ -584,6 +588,7 @@ module.exports = { recommended: true, }, schema, + defaultOptions: [{...DEFAULT_OPTIONS}], messages, }, }; diff --git a/test/integration/projects.mjs b/test/integration/projects.mjs index 1ed4bd7571..1dbb1fd76f 100644 --- a/test/integration/projects.mjs +++ b/test/integration/projects.mjs @@ -223,6 +223,7 @@ export default [ // Invalid syntax 'src/vs/platform/files/test/node/fixtures/**', 'src/vs/workbench/services/search/test/node/fixtures/examples/**', + 'extensions/vscode-colorize-perf-tests/test/**', ], }, ].flatMap((projectOrProjects, index) => diff --git a/test/package.mjs b/test/package.mjs index 1a52e00628..fae9280b41 100644 --- a/test/package.mjs +++ b/test/package.mjs @@ -168,6 +168,7 @@ function getCompactConfig(config) { // `Intl` was added to ESLint https://github.com/eslint/eslint/pull/18318 // But `@eslint/eslintrc` choose not to update `globals` https://github.com/eslint/eslintrc/pull/164 Intl: false, + Iterator: false, }; result[key] = languageOptions; } else if (key === 'plugins') {