-
Notifications
You must be signed in to change notification settings - Fork 71
/
.eslintrc.js
118 lines (116 loc) · 3.45 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
const resolveConfig = require('./webpack/config.js').RESOLVE;
// http://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
env: {
browser: true
},
globals: {
_: false,
ajaxUrl: false,
Backbone: false,
Cesium: false,
Channel: false,
ClipperLib: false,
d3: false,
define: false,
jQuery: false,
jsts: false,
MobileDetect: false,
moment: false,
Oskari: false,
Proj4js: false,
turf: false,
__webpack_public_path__: false,
CESIUM_BASE_URL: false,
// ---- jest tests
describe: false,
it: false,
afterAll: false,
expect: false,
test: false,
jest: false
// ----
},
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module'
},
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: [
'standard',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:react/recommended'
],
// add your custom rules here
rules: {
'no-restricted-properties': ['error',
{
property: 'getRequestBuilder', message: 'Please use Oskari.requestBuilder() instead.'
},
{
property: 'getEventBuilder', message: 'Please use Oskari.eventBuilder() instead.'
}
],
'indent': ['error', 4],
// semicolons
'semi': ['error', 'always'],
// allow templates to have placeholders as we use lodash templates
'no-template-curly-in-string': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
// enforce single quote
'quotes': ['error', 'single', {
allowTemplateLiterals: true,
avoidEscape: true
}],
'no-unused-vars': ['error', {
vars: 'all',
args: 'none',
ignoreRestSiblings: false
}],
'no-fallthrough': 'off',
'standard/no-callback-literal': 'off',
'import/no-default-export': 'error',
'quote-props': ['warn', 'consistent-as-needed'],
'lines-between-class-members': ['warn', 'always'],
'prefer-const': ['warn', {
destructuring: 'any',
ignoreReadBeforeAssign: false
}],
'no-prototype-builtins': 'warn',
'object-curly-newline': ['error', { consistent: true }],
'dot-notation': 'warn',
// Temporary warn level for Travis-CI
'brace-style': ['warn', '1tbs', { allowSingleLine: true }],
'camelcase': ['warn', {
properties: 'never'
}],
'eqeqeq': ['warn', 'always', {
null: 'ignore'
}],
'handle-callback-err': ['warn', '^(err|error)$'],
'new-cap': ['warn', {
newIsCap: true,
capIsNew: false
}],
'no-unmodified-loop-condition': 'warn',
'no-unneeded-ternary': ['warn', { defaultAssignment: false }],
'one-var': ['warn', { initialized: 'never' }],
'no-labels': ['warn', {
allowLoop: false,
allowSwitch: false
}]
},
settings: {
'import/resolver': {
webpack: {
config: {
resolve: resolveConfig
}
}
},
'react': { version: 'detect' }
}
};