This repository has been archived by the owner on Aug 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1331006 - [eslint] Define more globals, and add a rule to import …
…test globals from SimpleTest/EventUtils. r=mossop MozReview-Commit-ID: 5ifWLAa8wG2
- Loading branch information
Showing
12 changed files
with
92 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"use strict"; | ||
|
||
module.exports = { // eslint-disable-line no-undef | ||
"extends": [ | ||
"../../../../testing/mochitest/mochitest.eslintrc.js", | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"use strict"; | ||
|
||
module.exports = { // eslint-disable-line no-undef | ||
"extends": [ | ||
"../../../../../testing/xpcshell/xpcshell.eslintrc.js", | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"use strict"; | ||
|
||
module.exports = { // eslint-disable-line no-undef | ||
"extends": [ | ||
"../../../../testing/mochitest/browser.eslintrc.js", | ||
"../../../../testing/mochitest/chrome.eslintrc.js", | ||
"../../../../testing/mochitest/mochitest.eslintrc.js", | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-test-globals.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @fileoverview Import globals from common mochitest files, so that we | ||
* don't need to specify them individually. | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
"use strict"; | ||
|
||
// ----------------------------------------------------------------------------- | ||
// Rule Definition | ||
// ----------------------------------------------------------------------------- | ||
|
||
var fs = require("fs"); | ||
var path = require("path"); | ||
var helpers = require("../helpers"); | ||
var globals = require("../globals"); | ||
|
||
const simpleTestFiles = [ | ||
"EventUtils.js", | ||
"SimpleTest.js" | ||
]; | ||
const simpleTestPath = "testing/mochitest/tests/SimpleTest"; | ||
|
||
module.exports = function(context) { | ||
// --------------------------------------------------------------------------- | ||
// Public | ||
// --------------------------------------------------------------------------- | ||
|
||
return { | ||
Program: function(node) { | ||
for (let file of simpleTestFiles) { | ||
let newGlobals = | ||
globals.getGlobalsForFile(path.join(simpleTestPath, file)); | ||
helpers.addGlobals(newGlobals, context.getScope()); | ||
} | ||
} | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters