forked from mozilla/addons-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc
111 lines (111 loc) · 4.18 KB
/
.eslintrc
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
105
106
107
108
109
110
111
{
"env": {
"mocha": true,
},
"extends": "airbnb",
"globals": {
"dedent",
"CLIENT_CONFIG": true,
"assert": true,
"sinon": true,
"webpackIsomorphicTools": true
},
"parser": "babel-eslint",
"rules": {
"arrow-parens": ["error", "always"],
// Beware about turning this rule back on. The rule encourages you to create
// static class methods on React components when they don't use `this`.
// However, it will not warn you if you access `this` in a static method
// accidentally (which would most likely be a mistake).
"class-methods-use-this": "off",
"comma-dangle": ['error', {
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'ignore',
}],
// This makes sure imported modules exist.
"import/no-unresolved": ["error"],
// This makes sure imported names exist.
"import/named": ["error"],
// This will catch accidental default imports when no default is defined.
"import/default": ["error"],
// This makes sure `*' imports are dereferenced to real exports.
"import/namespace": ["error"],
// This catches any export mistakes.
"import/export": ["error"],
// This catches default names that conflict with actual exported names.
// For example, this was probably a typo:
// import foo from 'bar';
// that should be corrected as:
// import { foo } from 'bar';
"import/no-named-as-default": ["error"],
// This catches possible typos like trying to access a real export on a
// default import.
"import/no-named-as-default-member": ["error"],
// This prevents exporting a mutable variable.
"import/no-mutable-exports": ["error"],
// This makes sure package.json defines dev vs. prod dependencies correctly.
"import/no-extraneous-dependencies": ["error", {
// The following are not allowed to be imported. See .eslintrc in other
// directories (like ./test) for where this gets overidden.
"devDependencies": false, "optionalDependencies": false, "peerDependencies": false
}],
// This ensures imports are at the top of the file.
"import/imports-first": ["error"],
// This catches duplicate exports.
"import/no-duplicates": ["error"],
// This ensures import statements never provide a file extension in the path.
"import/extensions": ["error", "never"],
// This ensures imports are organized by type and that groups are separated
// by a new line.
"import/order": ["error", {
"groups": [
"builtin", "external", "internal", ["parent", "sibling"], "index"
],
"newlines-between": "always"
}],
"import/prefer-default-export": ["off"],
// This ensures a new line after all import statements.
"import/newline-after-import": ["error"],
"jsx-a11y/no-static-element-interactions": "off",
"no-plusplus": "off",
"no-underscore-dangle": "off",
"space-before-function-paren": ["error", "never"],
// The airbnb default of this rule mainly encourages `shape` over `object`
// but there are too many bugs in the linter to use `shape` accurately.
'react/forbid-prop-types': "off",
"react/prefer-stateless-function": "off",
"react/jsx-indent-props": "off",
"react/jsx-closing-bracket-location": "off",
"react/jsx-first-prop-new-line": "off",
"react/no-string-refs": "error",
// FIXME: Deprecate use of findDOMNode https://github.com/mozilla/addons-frontend/issues/968
"react/no-find-dom-node": "off",
// FIXME: Switch using .jsx for jsx files https://github.com/mozilla/addons-frontend/issues/969.
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }]
},
"settings": {
"import/ignore": [
// Because of CommonJS incompatibility, we can't
// check for bad imports in node_modules.
"node_modules",
// Ignore non-JS imports.
"\\.gif$",
"\\.jpeg$",
"\\.jpg$",
"\\.mp4$",
"\\.png$",
"\\.scss$",
"\\.svg$",
"\\.webm$"
],
"import/resolver": {
"node": {
// This adds ./src for relative imports.
"moduleDirectory": ["node_modules", "src"]
}
}
}
}