-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
128 lines (109 loc) · 3.05 KB
/
.eslintrc.cjs
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
119
120
121
122
123
124
125
126
127
128
module.exports = {
root: true,
ignorePatterns: [
'**/*.*',
'!**/*.js',
'!**/*.cjs',
'node_modules',
'dist',
'coverage',
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
env: {
node: true,
},
extends: [
'eslint:recommended',
'plugin:jsdoc/recommended',
'plugin:unicorn/recommended',
'plugin:n/recommended',
'prettier-standard/prettier-file',
],
settings: {
jsdoc: {
mode: 'typescript',
},
},
// Keep rules grouped by plugin and sorted alphabetically
rules: {
'padding-line-between-statements': [
'error',
/* Empty line after import */
{ blankLine: 'always', prev: 'import', next: '*' },
{ blankLine: 'any', prev: 'import', next: 'import' },
/* Empty line before return */
{ blankLine: 'always', prev: '*', next: 'return' },
/* Empty line after const, let */
{ blankLine: 'always', prev: ['const', 'let'], next: '*' },
{ blankLine: 'any', prev: ['const', 'let'], next: ['const', 'let'] },
/* Empty line between case and default inside switch */
{ blankLine: 'always', prev: 'case', next: ['case', 'default'] },
],
/* eslint-plugin-jsdoc */
// Descriptions should be sentence-like not comment-like
'jsdoc/require-description-complete-sentence': 'warn',
'jsdoc/require-hyphen-before-param-description': [
'error',
'never',
{ tags: { property: 'never' } },
],
// Adding JSDoc is preferable but not required
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-param-description': 'off',
'jsdoc/require-property-description': 'off',
'jsdoc/require-returns-description': 'off',
'jsdoc/require-returns': 'off',
/* eslint-plugin-unicorn */
// I like reduce
'unicorn/no-array-reduce': 'off',
/* eslint-plugin-import */
// Require extension for imports. This is needed for Node.js because it fails to import ECMAScript module w/o extension
'import/extensions': ['error', 'always', { ignorePackages: true }],
// Force using only named exports
'import/no-default-export': 'error',
// Sort imports
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'type',
],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: false,
},
},
],
/* eslint-plugin-prettier */
'prettier/prettier': 'warn',
/* eslint-plugin-node */
// FIXME: Disabled until https://github.com/avajs/ava/discussions/2866 is resolved
'node/no-missing-import': 'off',
/* eslint-plugin-n (node) */
'n/no-unsupported-features/es-syntax': ['error'],
},
overrides: [
// Test files
{
files: 'tests/**/*',
extends: ['plugin:ava/recommended'],
},
// Config CommonJS files
{
files: '*.cjs',
rules: {
/* eslint-plugin-unicorn */
'unicorn/prefer-module': 'off',
},
},
],
}