Skip to content

Commit

Permalink
expiring-todo-comments: Fix compatibility with ESLint 9.15 (#2497)
Browse files Browse the repository at this point in the history
Co-authored-by: fisker <[email protected]>
  • Loading branch information
marcalexiei and fisker authored Nov 19, 2024
1 parent 4d47285 commit 16b09d3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
]
Expand Down
15 changes: 10 additions & 5 deletions rules/expiring-todo-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
};
Expand Down Expand Up @@ -564,7 +568,7 @@ const schema = [
},
allowWarningComments: {
type: 'boolean',
default: false,
default: true,
},
date: {
type: 'string',
Expand All @@ -584,6 +588,7 @@ module.exports = {
recommended: true,
},
schema,
defaultOptions: [{...DEFAULT_OPTIONS}],
messages,
},
};
1 change: 1 addition & 0 deletions test/integration/projects.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down
1 change: 1 addition & 0 deletions test/package.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit 16b09d3

Please sign in to comment.