tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 8fb412e83b8820be9283ba9f3381f03f8d32068c
parent 57267658e01c0de85bf7b4b1b001e544d621d151
Author: Mark Banner <standard8@mozilla.com>
Date:   Fri, 28 Nov 2025 09:08:57 +0000

Bug 2002657 - Stop using deprecated getFilename() functions in eslint-plugin-mozilla. r=frontend-codestyle-reviewers,Gijs

Differential Revision: https://phabricator.services.mozilla.com/D274210

Diffstat:
Mtools/lint/eslint/eslint-plugin-mozilla/lib/globals.mjs | 2+-
Mtools/lint/eslint/eslint-plugin-mozilla/lib/helpers.mjs | 18+++++++++---------
Mtools/lint/eslint/eslint-plugin-mozilla/lib/rules/no-newtab-refs-outside-newtab.mjs | 2+-
3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.mjs b/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.mjs @@ -708,7 +708,7 @@ let globalUtils = { * The ESLint parsing context. */ getESLintGlobalParser(context) { - let filename = context.getFilename(); + let filename = context.filename; return { Program: node => { diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.mjs b/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.mjs @@ -151,7 +151,7 @@ export default { switch (node.type) { case "MemberExpression": if (node.computed) { - let filename = context && context.getFilename(); + let filename = context?.filename; throw new Error( `getASTSource unsupported computed MemberExpression in ${filename}` ); @@ -453,7 +453,7 @@ export default { * True or false */ getIsHeadFile(scope) { - var pathAndFilename = this.cleanUpPath(scope.getFilename()); + var pathAndFilename = this.cleanUpPath(scope.filename); return /.*[\\/]head(_.+)?\.js$/.test(pathAndFilename); }, @@ -473,7 +473,7 @@ export default { return []; } - let filepath = this.cleanUpPath(scope.getFilename()); + let filepath = this.cleanUpPath(scope.filename); let dir = path.dirname(filepath); let names = fs @@ -560,7 +560,7 @@ export default { * The path to the test manifest file */ getTestManifest(scope) { - let filepath = this.cleanUpPath(scope.getFilename()); + let filepath = this.cleanUpPath(scope.filename); let dir = path.dirname(filepath); let filename = path.basename(filepath); @@ -598,7 +598,7 @@ export default { * Check if this is an .sjs file. */ getIsSjs(scope) { - let filepath = this.cleanUpPath(scope.getFilename()); + let filepath = this.cleanUpPath(scope.filename); return path.extname(filepath) == ".sjs"; }, @@ -623,7 +623,7 @@ export default { } } - let filepath = this.cleanUpPath(scope.getFilename()); + let filepath = this.cleanUpPath(scope.filename); let filename = path.basename(filepath); if (filename.startsWith("browser_")) { @@ -706,7 +706,7 @@ export default { * ESLint may be executed from various places: from mach, at the root of the * repository, or from a directory in the repository when, for instance, * executed by a text editor's plugin. - * The value returned by context.getFileName() varies because of this. + * The value returned by context.filename varies because of this. * This helper function makes sure to return an absolute file path for the * current context, by looking at process.cwd(). * @@ -714,7 +714,7 @@ export default { * @returns {string} The absolute path */ getAbsoluteFilePath(context) { - var fileName = this.cleanUpPath(context.getFilename()); + var fileName = this.cleanUpPath(context.filename); var cwd = process.cwd(); if (path.isAbsolute(fileName)) { @@ -736,7 +736,7 @@ export default { /** * When ESLint is run from SublimeText, paths retrieved from - * context.getFileName contain leading and trailing double-quote characters. + * context.fileName contain leading and trailing double-quote characters. * These characters need to be removed. * * @param {string} pathName diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/no-newtab-refs-outside-newtab.mjs b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/no-newtab-refs-outside-newtab.mjs @@ -42,7 +42,7 @@ export default { }, create(context) { - const filename = context.getFilename(); + const filename = context.filename; // Hard-code some directories and files that should always be exempt. if (