2021-10-22 15:09:44 +03:00
|
|
|
/*
|
|
|
|
* 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 https://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
2016-03-02 17:39:10 +03:00
|
|
|
module.exports = {
|
2019-05-07 18:33:13 +03:00
|
|
|
env: {
|
2021-10-06 15:18:46 +03:00
|
|
|
browser: true,
|
|
|
|
commonjs: true,
|
|
|
|
jasmine: true
|
2016-03-02 17:39:10 +03:00
|
|
|
},
|
2021-10-06 15:18:46 +03:00
|
|
|
extends: ['eslint:recommended', 'plugin:json/recommended', 'prettier'],
|
2021-09-29 12:24:56 +03:00
|
|
|
rules: {
|
|
|
|
// Require strict mode directive in top level functions
|
|
|
|
// https://eslint.org/docs/rules/strict
|
2021-10-06 15:18:46 +03:00
|
|
|
strict: ['error', 'function'],
|
2021-09-29 12:24:56 +03:00
|
|
|
|
|
|
|
// Use type-safe equality operators
|
|
|
|
// https://eslint.org/docs/rules/eqeqeq
|
2021-10-06 15:18:46 +03:00
|
|
|
eqeqeq: ['error', 'always'],
|
2021-09-29 12:24:56 +03:00
|
|
|
|
|
|
|
// Treat var statements as if they were block scoped
|
|
|
|
// https://eslint.org/docs/rules/block-scoped-var
|
|
|
|
'block-scoped-var': 'error',
|
|
|
|
|
|
|
|
// Disallow Use of alert, confirm, prompt
|
|
|
|
// https://eslint.org/docs/rules/no-alert
|
|
|
|
'no-alert': 'error',
|
|
|
|
|
|
|
|
// Disallow eval()
|
|
|
|
// https://eslint.org/docs/rules/no-eval
|
|
|
|
'no-eval': 'error',
|
|
|
|
|
|
|
|
// Disallow empty functions
|
|
|
|
// https://eslint.org/docs/rules/no-empty-function
|
|
|
|
'no-empty-function': 'error',
|
|
|
|
|
|
|
|
// Require radix parameter
|
|
|
|
// https://eslint.org/docs/rules/radix
|
2021-10-06 15:18:46 +03:00
|
|
|
radix: 'error',
|
2021-09-29 12:24:56 +03:00
|
|
|
|
|
|
|
// Disallow the use of `console`
|
|
|
|
// https://eslint.org/docs/rules/no-console
|
|
|
|
'no-console': 'error'
|
|
|
|
},
|
2019-05-07 18:33:13 +03:00
|
|
|
/**
|
2020-06-01 15:56:19 +03:00
|
|
|
* A set of overrides for JavaScript assets where we support ES2015+.
|
2019-05-07 18:33:13 +03:00
|
|
|
* */
|
|
|
|
overrides: [
|
|
|
|
{
|
2021-09-17 16:03:25 +03:00
|
|
|
// JS files transpiled by Babel
|
2021-10-06 15:18:46 +03:00
|
|
|
files: ['media/js/**/*.es6.js'],
|
2021-09-17 16:03:25 +03:00
|
|
|
env: {
|
2021-10-06 15:18:46 +03:00
|
|
|
es2017: true
|
2021-09-28 12:12:21 +03:00
|
|
|
},
|
|
|
|
parserOptions: {
|
2021-10-06 15:18:46 +03:00
|
|
|
sourceType: 'module'
|
2021-09-29 12:24:56 +03:00
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
// Require `let` or `const` instead of `var`
|
|
|
|
// https://eslint.org/docs/rules/no-var
|
|
|
|
'no-var': 'error',
|
|
|
|
|
|
|
|
// Require `const` declarations for variables that are never reassigned after declared
|
|
|
|
// https://eslint.org/docs/rules/prefer-const
|
|
|
|
'prefer-const': 'error'
|
2021-09-17 16:03:25 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2021-09-23 13:11:33 +03:00
|
|
|
// JS files where we support native modern JS.
|
2020-06-01 15:56:19 +03:00
|
|
|
files: [
|
|
|
|
'media/js/firefox/welcome/**/*.js',
|
2021-09-17 16:03:25 +03:00
|
|
|
'media/js/firefox/whatsnew/**/*.js',
|
|
|
|
'media/js/firefox/firstrun/**/*.js',
|
2021-09-23 13:11:33 +03:00
|
|
|
'tests/unit/**/*.js'
|
2020-06-01 15:56:19 +03:00
|
|
|
],
|
|
|
|
env: {
|
2021-10-06 15:18:46 +03:00
|
|
|
es2017: true
|
2020-06-01 15:56:19 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2021-09-17 16:03:25 +03:00
|
|
|
// JS build files for local dev.
|
2020-06-01 15:56:19 +03:00
|
|
|
files: [
|
|
|
|
'webpack.config.js',
|
|
|
|
'webpack.static.config.js',
|
|
|
|
'tests/unit/karma.conf.js'
|
|
|
|
],
|
2019-05-07 18:33:13 +03:00
|
|
|
env: {
|
2021-10-06 15:18:46 +03:00
|
|
|
node: true,
|
|
|
|
es2017: true
|
2019-05-07 18:33:13 +03:00
|
|
|
},
|
|
|
|
rules: {
|
2021-10-06 15:18:46 +03:00
|
|
|
strict: ['error', 'global']
|
2019-05-07 18:33:13 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
globals: {
|
2021-10-06 15:18:46 +03:00
|
|
|
Mozilla: 'writable',
|
|
|
|
Mzp: 'writable',
|
|
|
|
site: 'writable'
|
2016-03-02 17:39:10 +03:00
|
|
|
}
|
|
|
|
};
|