forked from netlify/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
108 lines (107 loc) · 2.74 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
const { overrides } = require('@netlify/eslint-config-node')
module.exports = {
extends: '@netlify/eslint-config-node',
plugins: ['sort-destructure-keys'],
parserOptions: {
babelOptions: {
parserOpts: {
sourceType: 'unambiguous',
},
},
},
rules: {
// Those rules from @netlify/eslint-config-node are currently disabled
// TODO: remove, so those rules are enabled
complexity: 0,
'max-depth': 0,
'max-lines': 0,
'max-lines-per-function': 0,
'max-nested-callbacks': 0,
'max-statements': 0,
'no-param-reassign': 0,
'no-process-exit': 0,
'fp/no-loops': 'error',
'import/max-dependencies': 0,
'import/extensions': [2, 'ignorePackages'],
'n/no-process-exit': 0,
'n/no-sync': 0,
'no-magic-numbers': 'off',
'sort-destructure-keys/sort-destructure-keys': 2,
'unicorn/consistent-destructuring': 0,
// TODO: harmonize with filename snake_case in other Netlify Dev projects
'unicorn/filename-case': [2, { case: 'kebabCase' }],
},
overrides: [
...overrides,
// Documentation site's browser JavaScript
{
files: ['site/src/**/*.js'],
parserOptions: {
sourceType: 'module',
babelOptions: {
presets: ['@babel/preset-react'],
parserOpts: {
sourceType: 'module',
},
},
},
rules: {
complexity: 0,
'fp/no-this': 0,
'import/extensions': [2, 'always'],
'unicorn/consistent-destructuring': 0,
'max-lines': 0,
},
},
// Example functions
{
files: ['src/functions-templates/**/*.js'],
rules: {
'require-await': 0,
'import/no-unresolved': 0,
'n/no-missing-require': 0,
'n/no-unsupported-features/es-syntax': 0,
'import/no-anonymous-default-export': 0,
'no-undef': 0,
'no-unused-vars': 0,
'arrow-body-style': 0,
},
parserOptions: {
sourceType: 'module',
babelOptions: {
parserOpts: {
sourceType: 'module',
},
},
},
},
{
files: ['src/**/*.mjs', 'bin/**/*.mjs'],
parserOptions: {
sourceType: 'module',
babelOptions: {
parserOpts: {
sourceType: 'module',
},
},
},
rules: {
'import/extensions': [2, 'always'],
'no-restricted-imports': [
'error',
{
name: 'chalk',
message:
'Please use the safe chalk import that handles colors for json output. `import { chalk } from "src/utils/command-helpers.mjs"`',
},
],
},
},
{
files: ['tests/**/*'],
rules: {
'require-await': 'off',
},
},
],
}