forked from mozilla-extensions/firefox-translations
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
104 lines (101 loc) · 2.55 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/* eslint-env node */
// All Mozilla specific rules and environments at:
// http://firefox-source-docs.mozilla.org/tools/lint/linters/eslint-plugin-mozilla.html
const typescriptBaseConfig = {
parser: "@typescript-eslint/parser",
extends: [
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
],
};
module.exports = {
env: {
es6: true,
},
extends: [
"eslint:recommended",
// list of rules at: https://dxr.mozilla.org/mozilla-central/source/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
"plugin:mozilla/recommended",
"plugin:prettier/recommended",
],
overrides: [
{
files: "src/**/.js",
env: {
browser: true,
webextensions: true,
},
},
{
...typescriptBaseConfig,
files: ["src/**/*.ts", "src/**/*.tsx", "test/in-browser/**/*.ts"],
extends: ["plugin:mocha/recommended"],
globals: {
// the dotenv-webpack plugin exposes process.env.* based on the contents in .env.development or .env.production
process: "readonly",
// require is available
require: "readonly",
},
parserOptions: {
project: "./tsconfig.json",
},
plugins: ["mocha"],
env: {
browser: true,
mocha: true,
webextensions: true,
},
},
{
...typescriptBaseConfig,
files: "test/e2e/**/*.ts",
extends: ["plugin:mocha/recommended"],
parserOptions: {
project: "./test/e2e/tsconfig.json",
},
plugins: ["mocha"],
env: {
browser: true,
mocha: true,
node: true,
},
},
],
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
ecmaFeatures: {
jsx: false,
experimentalObjectRestSpread: true,
},
},
plugins: ["json", "mozilla"],
root: true,
rules: {
"mozilla/no-aArgs": "error",
"mozilla/balanced-listeners": "error",
"comma-dangle": ["error", "always-multiline"],
eqeqeq: "error",
indent: "off",
"max-len": [
"warn",
{
code: 100,
ignoreComments: true,
ignoreTrailingComments: true,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
},
],
"consistent-return": ["error", { treatUndefinedAsUnspecified: true }],
"no-console": "warn",
"no-shadow": "error",
"no-unused-vars": "error",
"no-var": "error",
"prefer-const": "error",
"prefer-spread": "error",
semi: ["error", "always"],
"valid-jsdoc": "off",
},
};