releases-comm-central/.eslintrc.js

106 строки
2.7 KiB
JavaScript
Исходник Обычный вид История

"use strict";
const path = require("path");
const xpcshellTestConfig = require("eslint-plugin-mozilla/lib/configs/xpcshell-test.js");
const browserTestConfig = require("eslint-plugin-mozilla/lib/configs/browser-test.js");
/**
* Some configurations have overrides, which can't be specified within overrides,
* so we need to remove them.
*/
function removeOverrides(config) {
config = { ...config };
delete config.overrides;
return config;
}
const xpcshellTestPaths = [
"**/test*/unit*/",
"**/test*/xpcshell/",
"chat/**/test*/",
];
const browserTestPaths = [
"**/test*/**/browser/",
"mail/base/test/performance/",
"mail/base/test/webextensions/",
"mail/test/static/",
];
module.exports = {
parser: "@babel/eslint-parser",
parserOptions: {
sourceType: "script",
babelOptions: {
configFile: path.join(__dirname, "..", ".babel-eslint.rc.js"),
},
},
root: true,
// We would like the same base rules as provided by
// mozilla/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
extends: ["plugin:mozilla/recommended"],
// When adding items to this file please check for effects on sub-directories.
plugins: ["mozilla"],
rules: {
complexity: ["error", 80],
"func-names": ["error", "never"],
"mozilla/prefer-boolean-length-check": "off",
},
// To avoid bad interactions of the html plugin with the xml preprocessor in
// eslint-plugin-mozilla, we turn off processing of the html plugin for .xml
// files.
settings: {
"html/xml-extensions": [".xhtml"],
},
overrides: [
{
files: "**/.eslintrc.js",
env: {
node: true,
},
},
{
...removeOverrides(xpcshellTestConfig),
files: xpcshellTestPaths.map(path => `${path}**`),
rules: {
...xpcshellTestConfig.rules,
"func-names": "off",
},
},
{
Bug 1594964 - Unify linting rules for test directories. r=pmorris --HG-- rename : mailnews/mime/jsmime/test/data/base64-1 => mailnews/mime/jsmime/test/unit/data/base64-1 rename : mailnews/mime/jsmime/test/data/base64-2 => mailnews/mime/jsmime/test/unit/data/base64-2 rename : mailnews/mime/jsmime/test/data/basic1 => mailnews/mime/jsmime/test/unit/data/basic1 rename : mailnews/mime/jsmime/test/data/bug505221 => mailnews/mime/jsmime/test/unit/data/bug505221 rename : mailnews/mime/jsmime/test/data/bugmail11 => mailnews/mime/jsmime/test/unit/data/bugmail11 rename : mailnews/mime/jsmime/test/data/charsets => mailnews/mime/jsmime/test/unit/data/charsets rename : mailnews/mime/jsmime/test/data/message-encoded => mailnews/mime/jsmime/test/unit/data/message-encoded rename : mailnews/mime/jsmime/test/data/mime-torture => mailnews/mime/jsmime/test/unit/data/mime-torture rename : mailnews/mime/jsmime/test/data/multipart-base64-1 => mailnews/mime/jsmime/test/unit/data/multipart-base64-1 rename : mailnews/mime/jsmime/test/data/multipart-base64-2 => mailnews/mime/jsmime/test/unit/data/multipart-base64-2 rename : mailnews/mime/jsmime/test/data/multipart-base64-3 => mailnews/mime/jsmime/test/unit/data/multipart-base64-3 rename : mailnews/mime/jsmime/test/data/multipart-complex1 => mailnews/mime/jsmime/test/unit/data/multipart-complex1 rename : mailnews/mime/jsmime/test/data/multipart-complex2 => mailnews/mime/jsmime/test/unit/data/multipart-complex2 rename : mailnews/mime/jsmime/test/data/multipart1 => mailnews/mime/jsmime/test/unit/data/multipart1 rename : mailnews/mime/jsmime/test/data/multipart2 => mailnews/mime/jsmime/test/unit/data/multipart2 rename : mailnews/mime/jsmime/test/data/multipart3 => mailnews/mime/jsmime/test/unit/data/multipart3 rename : mailnews/mime/jsmime/test/data/multipart4 => mailnews/mime/jsmime/test/unit/data/multipart4 rename : mailnews/mime/jsmime/test/data/multipartmalt-detach => mailnews/mime/jsmime/test/unit/data/multipartmalt-detach rename : mailnews/mime/jsmime/test/data/shift-jis-image => mailnews/mime/jsmime/test/unit/data/shift-jis-image rename : mailnews/mime/jsmime/test/head_xpcshell_glue.js => mailnews/mime/jsmime/test/unit/head_xpcshell_glue.js rename : mailnews/mime/jsmime/test/mock_date.js => mailnews/mime/jsmime/test/unit/mock_date.js rename : mailnews/mime/jsmime/test/test_custom_headers.js => mailnews/mime/jsmime/test/unit/test_custom_headers.js rename : mailnews/mime/jsmime/test/test_header.js => mailnews/mime/jsmime/test/unit/test_header.js rename : mailnews/mime/jsmime/test/test_header_emitter.js => mailnews/mime/jsmime/test/unit/test_header_emitter.js rename : mailnews/mime/jsmime/test/test_mime_tree.js => mailnews/mime/jsmime/test/unit/test_mime_tree.js rename : mailnews/mime/jsmime/test/test_structured_header_emitters.js => mailnews/mime/jsmime/test/unit/test_structured_header_emitters.js rename : mailnews/mime/jsmime/test/test_structured_headers.js => mailnews/mime/jsmime/test/unit/test_structured_headers.js rename : mailnews/mime/jsmime/test/xpcshell.ini => mailnews/mime/jsmime/test/unit/xpcshell.ini
2019-11-05 06:48:02 +03:00
// If it is a test head file, we turn off global unused variable checks, as it
// would require searching the other test files to know if they are used or not.
// This would be expensive and slow, and it isn't worth it for head files.
// We could get developers to declare as exported, but that doesn't seem worth it.
Bug 1594964 - Unify linting rules for test directories. r=pmorris --HG-- rename : mailnews/mime/jsmime/test/data/base64-1 => mailnews/mime/jsmime/test/unit/data/base64-1 rename : mailnews/mime/jsmime/test/data/base64-2 => mailnews/mime/jsmime/test/unit/data/base64-2 rename : mailnews/mime/jsmime/test/data/basic1 => mailnews/mime/jsmime/test/unit/data/basic1 rename : mailnews/mime/jsmime/test/data/bug505221 => mailnews/mime/jsmime/test/unit/data/bug505221 rename : mailnews/mime/jsmime/test/data/bugmail11 => mailnews/mime/jsmime/test/unit/data/bugmail11 rename : mailnews/mime/jsmime/test/data/charsets => mailnews/mime/jsmime/test/unit/data/charsets rename : mailnews/mime/jsmime/test/data/message-encoded => mailnews/mime/jsmime/test/unit/data/message-encoded rename : mailnews/mime/jsmime/test/data/mime-torture => mailnews/mime/jsmime/test/unit/data/mime-torture rename : mailnews/mime/jsmime/test/data/multipart-base64-1 => mailnews/mime/jsmime/test/unit/data/multipart-base64-1 rename : mailnews/mime/jsmime/test/data/multipart-base64-2 => mailnews/mime/jsmime/test/unit/data/multipart-base64-2 rename : mailnews/mime/jsmime/test/data/multipart-base64-3 => mailnews/mime/jsmime/test/unit/data/multipart-base64-3 rename : mailnews/mime/jsmime/test/data/multipart-complex1 => mailnews/mime/jsmime/test/unit/data/multipart-complex1 rename : mailnews/mime/jsmime/test/data/multipart-complex2 => mailnews/mime/jsmime/test/unit/data/multipart-complex2 rename : mailnews/mime/jsmime/test/data/multipart1 => mailnews/mime/jsmime/test/unit/data/multipart1 rename : mailnews/mime/jsmime/test/data/multipart2 => mailnews/mime/jsmime/test/unit/data/multipart2 rename : mailnews/mime/jsmime/test/data/multipart3 => mailnews/mime/jsmime/test/unit/data/multipart3 rename : mailnews/mime/jsmime/test/data/multipart4 => mailnews/mime/jsmime/test/unit/data/multipart4 rename : mailnews/mime/jsmime/test/data/multipartmalt-detach => mailnews/mime/jsmime/test/unit/data/multipartmalt-detach rename : mailnews/mime/jsmime/test/data/shift-jis-image => mailnews/mime/jsmime/test/unit/data/shift-jis-image rename : mailnews/mime/jsmime/test/head_xpcshell_glue.js => mailnews/mime/jsmime/test/unit/head_xpcshell_glue.js rename : mailnews/mime/jsmime/test/mock_date.js => mailnews/mime/jsmime/test/unit/mock_date.js rename : mailnews/mime/jsmime/test/test_custom_headers.js => mailnews/mime/jsmime/test/unit/test_custom_headers.js rename : mailnews/mime/jsmime/test/test_header.js => mailnews/mime/jsmime/test/unit/test_header.js rename : mailnews/mime/jsmime/test/test_header_emitter.js => mailnews/mime/jsmime/test/unit/test_header_emitter.js rename : mailnews/mime/jsmime/test/test_mime_tree.js => mailnews/mime/jsmime/test/unit/test_mime_tree.js rename : mailnews/mime/jsmime/test/test_structured_header_emitters.js => mailnews/mime/jsmime/test/unit/test_structured_header_emitters.js rename : mailnews/mime/jsmime/test/test_structured_headers.js => mailnews/mime/jsmime/test/unit/test_structured_headers.js rename : mailnews/mime/jsmime/test/xpcshell.ini => mailnews/mime/jsmime/test/unit/xpcshell.ini
2019-11-05 06:48:02 +03:00
files: [
...browserTestPaths.map(path => `${path}head*.js`),
...xpcshellTestPaths.map(path => `${path}head*.js`),
],
rules: {
"no-unused-vars": [
"error",
{
args: "none",
vars: "local",
},
],
},
},
{
...browserTestConfig,
files: browserTestPaths.map(path => `${path}**/*.js`),
Bug 1585162 - Convert calendar Mozmill tests to Mochitest; r=pmorris --HG-- rename : calendar/test/mozmill/testBasicFunctionality.js => calendar/test/browser/browser_basicFunctionality.js rename : calendar/test/mozmill/testLocalICS.js => calendar/test/browser/browser_localICS.js rename : calendar/test/mozmill/testTimezones.js => calendar/test/browser/browser_timezones.js rename : calendar/test/mozmill/testTodayPane.js => calendar/test/browser/browser_todayPane.js rename : calendar/test/browser/browser.ini => calendar/test/browser/eventDialog/browser.ini rename : calendar/test/mozmill/eventDialog/testAlarmDialog.js => calendar/test/browser/eventDialog/browser_alarmDialog.js rename : calendar/test/mozmill/eventDialog/testEventDialog.js => calendar/test/browser/eventDialog/browser_eventDialog.js rename : calendar/test/mozmill/eventDialog/testEventDialogModificationPrompt.js => calendar/test/browser/eventDialog/browser_eventDialogModificationPrompt.js rename : calendar/test/mozmill/eventDialog/testEventDialogSize.js => calendar/test/browser/eventDialog/browser_eventDialogSize.js rename : calendar/test/mozmill/eventDialog/testUTF8.js => calendar/test/browser/eventDialog/browser_utf8.js rename : calendar/test/browser/browser.ini => calendar/test/browser/invitations/browser.ini rename : calendar/test/mozmill/invitations/test-imip-bar-eml.js => calendar/test/browser/invitations/browser_imipBarEmail.js rename : calendar/test/mozmill/invitations/message-containing-event.eml => calendar/test/browser/invitations/message-containing-event.eml rename : calendar/test/browser/browser.ini => calendar/test/browser/preferences/browser.ini rename : calendar/test/mozmill/preferences/testAlarmDefaultValue.js => calendar/test/browser/preferences/browser_alarmDefaultValue.js rename : calendar/test/mozmill/preferences/testCategoryColors.js => calendar/test/browser/preferences/browser_categoryColors.js rename : calendar/test/browser/browser.ini => calendar/test/browser/recurrence/browser.ini rename : calendar/test/mozmill/cal-recurrence/testAnnualRecurrence.js => calendar/test/browser/recurrence/browser_annual.js rename : calendar/test/mozmill/cal-recurrence/testBiweeklyRecurrence.js => calendar/test/browser/recurrence/browser_biweekly.js rename : calendar/test/mozmill/cal-recurrence/testDailyRecurrence.js => calendar/test/browser/recurrence/browser_daily.js rename : calendar/test/mozmill/cal-recurrence/testLastDayOfMonthRecurrence.js => calendar/test/browser/recurrence/browser_lastDayOfMonth.js rename : calendar/test/mozmill/cal-recurrence/testWeeklyNRecurrence.js => calendar/test/browser/recurrence/browser_weeklyN.js rename : calendar/test/mozmill/cal-recurrence/testWeeklyUntilRecurrence.js => calendar/test/browser/recurrence/browser_weeklyUntil.js rename : calendar/test/mozmill/cal-recurrence/testWeeklyWithExceptionRecurrence.js => calendar/test/browser/recurrence/browser_weeklyWithException.js rename : calendar/test/browser/browser.ini => calendar/test/browser/recurrenceRotated/browser.ini rename : calendar/test/mozmill/recurrenceRotated/testAnnualRecurrence.js => calendar/test/browser/recurrenceRotated/browser_annual.js rename : calendar/test/mozmill/recurrenceRotated/testBiweeklyRecurrence.js => calendar/test/browser/recurrenceRotated/browser_biweekly.js rename : calendar/test/mozmill/recurrenceRotated/testDailyRecurrence.js => calendar/test/browser/recurrenceRotated/browser_daily.js rename : calendar/test/mozmill/recurrenceRotated/testLastDayOfMonthRecurrence.js => calendar/test/browser/recurrenceRotated/browser_lastDayOfMonth.js rename : calendar/test/mozmill/recurrenceRotated/testWeeklyNRecurrence.js => calendar/test/browser/recurrenceRotated/browser_weeklyN.js rename : calendar/test/mozmill/recurrenceRotated/testWeeklyUntilRecurrence.js => calendar/test/browser/recurrenceRotated/browser_weeklyUntil.js rename : calendar/test/mozmill/recurrenceRotated/testWeeklyWithExceptionRecurrence.js => calendar/test/browser/recurrenceRotated/browser_weeklyWithException.js rename : calendar/test/browser/browser.ini => calendar/test/browser/views/browser.ini rename : calendar/test/mozmill/views/testDayView.js => calendar/test/browser/views/browser_dayView.js rename : calendar/test/mozmill/views/testMonthView.js => calendar/test/browser/views/browser_monthView.js rename : calendar/test/mozmill/views/testMultiweekView.js => calendar/test/browser/views/browser_multiweekView.js rename : calendar/test/mozmill/views/testTaskView.js => calendar/test/browser/views/browser_taskView.js rename : calendar/test/mozmill/views/testWeekView.js => calendar/test/browser/views/browser_weekView.js rename : calendar/test/mozmill/shared-modules/CalendarUtils.jsm => calendar/test/modules/CalendarUtils.jsm rename : calendar/test/mozmill/shared-modules/ItemEditingHelpers.jsm => calendar/test/modules/ItemEditingHelpers.jsm extra : rebase_source : 8479fe06a943576ed7f78c82c7e617ff5e0c72d5 extra : amend_source : d9c6975c52320e351a85a759d39950045f56522c
2019-09-27 07:00:10 +03:00
rules: {
...browserTestConfig.rules,
Bug 1585162 - Convert calendar Mozmill tests to Mochitest; r=pmorris --HG-- rename : calendar/test/mozmill/testBasicFunctionality.js => calendar/test/browser/browser_basicFunctionality.js rename : calendar/test/mozmill/testLocalICS.js => calendar/test/browser/browser_localICS.js rename : calendar/test/mozmill/testTimezones.js => calendar/test/browser/browser_timezones.js rename : calendar/test/mozmill/testTodayPane.js => calendar/test/browser/browser_todayPane.js rename : calendar/test/browser/browser.ini => calendar/test/browser/eventDialog/browser.ini rename : calendar/test/mozmill/eventDialog/testAlarmDialog.js => calendar/test/browser/eventDialog/browser_alarmDialog.js rename : calendar/test/mozmill/eventDialog/testEventDialog.js => calendar/test/browser/eventDialog/browser_eventDialog.js rename : calendar/test/mozmill/eventDialog/testEventDialogModificationPrompt.js => calendar/test/browser/eventDialog/browser_eventDialogModificationPrompt.js rename : calendar/test/mozmill/eventDialog/testEventDialogSize.js => calendar/test/browser/eventDialog/browser_eventDialogSize.js rename : calendar/test/mozmill/eventDialog/testUTF8.js => calendar/test/browser/eventDialog/browser_utf8.js rename : calendar/test/browser/browser.ini => calendar/test/browser/invitations/browser.ini rename : calendar/test/mozmill/invitations/test-imip-bar-eml.js => calendar/test/browser/invitations/browser_imipBarEmail.js rename : calendar/test/mozmill/invitations/message-containing-event.eml => calendar/test/browser/invitations/message-containing-event.eml rename : calendar/test/browser/browser.ini => calendar/test/browser/preferences/browser.ini rename : calendar/test/mozmill/preferences/testAlarmDefaultValue.js => calendar/test/browser/preferences/browser_alarmDefaultValue.js rename : calendar/test/mozmill/preferences/testCategoryColors.js => calendar/test/browser/preferences/browser_categoryColors.js rename : calendar/test/browser/browser.ini => calendar/test/browser/recurrence/browser.ini rename : calendar/test/mozmill/cal-recurrence/testAnnualRecurrence.js => calendar/test/browser/recurrence/browser_annual.js rename : calendar/test/mozmill/cal-recurrence/testBiweeklyRecurrence.js => calendar/test/browser/recurrence/browser_biweekly.js rename : calendar/test/mozmill/cal-recurrence/testDailyRecurrence.js => calendar/test/browser/recurrence/browser_daily.js rename : calendar/test/mozmill/cal-recurrence/testLastDayOfMonthRecurrence.js => calendar/test/browser/recurrence/browser_lastDayOfMonth.js rename : calendar/test/mozmill/cal-recurrence/testWeeklyNRecurrence.js => calendar/test/browser/recurrence/browser_weeklyN.js rename : calendar/test/mozmill/cal-recurrence/testWeeklyUntilRecurrence.js => calendar/test/browser/recurrence/browser_weeklyUntil.js rename : calendar/test/mozmill/cal-recurrence/testWeeklyWithExceptionRecurrence.js => calendar/test/browser/recurrence/browser_weeklyWithException.js rename : calendar/test/browser/browser.ini => calendar/test/browser/recurrenceRotated/browser.ini rename : calendar/test/mozmill/recurrenceRotated/testAnnualRecurrence.js => calendar/test/browser/recurrenceRotated/browser_annual.js rename : calendar/test/mozmill/recurrenceRotated/testBiweeklyRecurrence.js => calendar/test/browser/recurrenceRotated/browser_biweekly.js rename : calendar/test/mozmill/recurrenceRotated/testDailyRecurrence.js => calendar/test/browser/recurrenceRotated/browser_daily.js rename : calendar/test/mozmill/recurrenceRotated/testLastDayOfMonthRecurrence.js => calendar/test/browser/recurrenceRotated/browser_lastDayOfMonth.js rename : calendar/test/mozmill/recurrenceRotated/testWeeklyNRecurrence.js => calendar/test/browser/recurrenceRotated/browser_weeklyN.js rename : calendar/test/mozmill/recurrenceRotated/testWeeklyUntilRecurrence.js => calendar/test/browser/recurrenceRotated/browser_weeklyUntil.js rename : calendar/test/mozmill/recurrenceRotated/testWeeklyWithExceptionRecurrence.js => calendar/test/browser/recurrenceRotated/browser_weeklyWithException.js rename : calendar/test/browser/browser.ini => calendar/test/browser/views/browser.ini rename : calendar/test/mozmill/views/testDayView.js => calendar/test/browser/views/browser_dayView.js rename : calendar/test/mozmill/views/testMonthView.js => calendar/test/browser/views/browser_monthView.js rename : calendar/test/mozmill/views/testMultiweekView.js => calendar/test/browser/views/browser_multiweekView.js rename : calendar/test/mozmill/views/testTaskView.js => calendar/test/browser/views/browser_taskView.js rename : calendar/test/mozmill/views/testWeekView.js => calendar/test/browser/views/browser_weekView.js rename : calendar/test/mozmill/shared-modules/CalendarUtils.jsm => calendar/test/modules/CalendarUtils.jsm rename : calendar/test/mozmill/shared-modules/ItemEditingHelpers.jsm => calendar/test/modules/ItemEditingHelpers.jsm extra : rebase_source : 8479fe06a943576ed7f78c82c7e617ff5e0c72d5 extra : amend_source : d9c6975c52320e351a85a759d39950045f56522c
2019-09-27 07:00:10 +03:00
"func-names": "off",
},
},
],
};