-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrules.js
More file actions
65 lines (57 loc) · 1.9 KB
/
rules.js
File metadata and controls
65 lines (57 loc) · 1.9 KB
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
module.exports = {
// base rules
rules: {
// class member, allow single line member don't have empty line between each other
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
// import ignore resolving asset files
'import/no-unresolved': [
'error',
{
caseSensitive: true,
ignore: ['.png$', '.jpe?g$', '.gif$', '.webp$', '.md$'],
},
],
// import js(x), ts(x) files without extension
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
mjs: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
// prefer named export
// why?:
// named export is more friendly when you want to search for
// all usages of a class or a function, it works better when
// we want to refactor code with a large project
'import/prefer-default-export': 'off',
'import/no-default-export': 'error',
// unused exports
'import/no-unused-modules': [
'error',
{
unusedExports: true,
},
],
// sort imports in alphabetize
'import/order': [
'error',
{
alphabetize: {
order: 'asc',
},
},
],
// max lines allowed
'max-lines': ['warn', { max: 500, skipBlankLines: true, skipComments: true }],
'max-lines-per-function': ['warn', { max: 80, skipBlankLines: true, skipComments: true }],
// ignore use this check for class methods
'class-methods-use-this': 'off',
// allow param-reassign for props
'no-param-reassign': ['error', { props: false }],
},
};