forked from PrairieLearn/PrairieLearn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
67 lines (65 loc) · 1.72 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
module.exports = {
env: {
node: true,
es2021: true,
},
extends: ['eslint:recommended', 'plugin:import/recommended', 'prettier'],
parserOptions: {
ecmaVersion: 13,
},
plugins: ['no-floating-promise', 'mocha'],
rules: {
curly: ['error', 'multi-line', 'consistent'],
eqeqeq: ['error', 'smart'],
'no-floating-promise/no-floating-promise': 'error',
'handle-callback-err': 'error',
'no-template-curly-in-string': 'error',
'no-restricted-syntax': [
'error',
{
selector:
'CallExpression[callee.type="MemberExpression"][callee.object.name="MathJax"][callee.property.name=/^(typeset|tex2chtml|tex2svg)$/]',
message:
"Don't use the synchronous MathJax API; use a function like typesetPromise() instead.",
},
{
selector: 'MemberExpression[object.name="MathJax"][property.name="Hub"]',
message: 'Use MathJax.typesetPromise() instead of MathJax.Hub',
},
],
'no-unused-vars': [
'error',
{
args: 'after-used',
argsIgnorePattern: '^_',
},
],
// By default, eslint-plugin-import only validates ESM syntax. We're still
// using CommonJS, so we need to explicitly enable support for that.
'import/no-unresolved': [
2,
{
commonjs: true,
},
],
// The recommended Mocha rules are too strict for us; we'll only enable
// these two rules.
'mocha/no-exclusive-tests': 'error',
'mocha/no-skipped-tests': 'error',
},
overrides: [
{
files: ['*.test.{js,ts,mjs}'],
env: {
mocha: true,
},
},
{
files: ['assets/scripts/*.js'],
env: {
browser: true,
jquery: true,
},
},
],
};