-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
66 lines (66 loc) · 2.28 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
// Copyright 2019 Stanford University see Apache2.txt for license
module.exports = {
plugins: ["import", "jest", "security"],
extends: [
"eslint:recommended",
"plugin:node/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:security/recommended",
"plugin:jest/recommended",
"prettier",
],
env: {
es6: true,
jest: true,
node: true,
},
parserOptions: {
ecmaVersion: 2019,
sourceType: "module",
},
overrides: [
{
files: ["src/**/*.js", "__mocks__/**/*.js", "__tests__/**/*.js"],
rules: {
indent: "off", // Off for prettier
"import/namespace": "off",
// See https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-unsupported-features/es-syntax.md
// rule supposedly matches ECMA version with node
// we get: "Import and export declarations are not supported yet"
"node/no-unsupported-features/es-syntax": "off",
// Avoiding: "warning Found fs.readFileSync with non literal argument ..."
"security/detect-non-literal-fs-filename": "off",
// Avoiding: "warning Found non-literal argument to RegExp Constructor"
"security/detect-non-literal-regexp": "off",
// this is a CLI tool; we DO want to send output to console
"no-console": "off",
// allow unused variables that begin with underscore
"no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
},
],
},
},
{
// We aren't concerned about this in our tests, see:
// https://github.com/nodesecurity/eslint-plugin-security#detect-object-injection
// https://github.com/nodesecurity/eslint-plugin-security/blob/master/docs/the-dangers-of-square-bracket-notation.md
// https://security.stackexchange.com/questions/170648/variable-assigned-to-object-injection-sink-security-detect-object-injection
// specifically, the variables in square brackets do not come from user input
files: ["__tests__/**/*.js"],
rules: {
"security/detect-object-injection": "off",
},
},
{
// Allow skipped tests in test suite
files: ["__tests__/**/*.js"],
rules: {
"jest/no-disabled-tests": "off",
},
},
],
};