forked from salesforce/eslint-config-lwc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.js
148 lines (141 loc) · 3.46 KB
/
base.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
* Copyright (c) 2018, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
'use strict';
const KNOWN_WIRE_ADAPTERS = [
{
module: 'lightning/**',
identifier: '*',
},
// All apex, apexContinuation methods
{
module: '@salesforce/**',
identifier: '*',
},
];
const WIRE_ADAPTERS_WITH_RESTRICTED_USE = [
{
module: 'lightning/analyticsWaveApi',
identifier: 'executeQuery',
},
{
module: 'lightning/analyticsWaveApi',
identifier: 'getAnalyticsLimits',
},
{
module: 'lightning/analyticsWaveApi',
identifier: 'getDataflowJob',
},
{
module: 'lightning/analyticsWaveApi',
identifier: 'getDataflowJobNode',
},
{
module: 'lightning/analyticsWaveApi',
identifier: 'getDataflowJobNodes',
},
{
module: 'lightning/analyticsWaveApi',
identifier: 'getDataflowJobs',
},
{
module: 'lightning/analyticsWaveApi',
identifier: 'getDataset',
},
{
module: 'lightning/analyticsWaveApi',
identifier: 'getDatasets',
},
{
module: 'lightning/analyticsWaveApi',
identifier: 'getRecipe',
},
{
module: 'lightning/analyticsWaveApi',
identifier: 'getRecipes',
},
{
module: 'lightning/analyticsWaveApi',
identifier: 'getReplicatedDatasets',
},
{
module: 'lightning/analyticsWaveApi',
identifier: 'getSchedule',
},
{
module: 'lightning/analyticsWaveApi',
identifier: 'getWaveFolders',
},
{
module: 'lightning/analyticsWaveApi',
identifier: 'getXmd',
},
{
module: 'lightning/messageService',
identifier: 'MessageContext',
},
{
module: 'lightning/navigation',
identifier: 'CurrentPageReference',
},
{
module: 'lightning/uiListApi',
identifier: 'getListUi',
},
{
module: 'lightning/uiObjectInfoApi',
identifier: 'getObjectInfo',
},
{
module: 'lightning/uiObjectInfoApi',
identifier: 'getObjectInfos',
},
{
module: 'lightning/uiObjectInfoApi',
identifier: 'getPicklistValues',
},
{
module: 'lightning/uiObjectInfoApi',
identifier: 'getPicklistValuesByRecordType',
},
{
module: 'lightning/uiRecordApi',
identifier: 'getRecord',
},
{
module: 'lightning/uiRecordApi',
identifier: 'getRecordCreateDefaults',
},
{
module: 'lightning/uiRecordApi',
identifier: 'getRecordUi',
},
];
module.exports = {
extends: [require.resolve('./lib/defaults')],
plugins: ['@lwc/eslint-plugin-lwc'],
rules: {
// LWC lifecycle hooks validation
'@lwc/lwc/no-deprecated': 'error',
// LWC decorator validation
'@lwc/lwc/valid-api': 'error',
'@lwc/lwc/valid-track': 'error',
'@lwc/lwc/valid-wire': 'error',
// LWC wire adapters validation
'@lwc/lwc/no-unknown-wire-adapters': [
'error',
{
adapters: KNOWN_WIRE_ADAPTERS,
},
],
'@lwc/lwc/no-unexpected-wire-adapter-usages': [
'error',
{
adapters: WIRE_ADAPTERS_WITH_RESTRICTED_USE,
},
],
},
};