-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
63 lines (60 loc) · 1.64 KB
/
index.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
const urls = {
refDocs: 'https://beta.sanity.io/docs/reference',
migrationGuideStudio: 'https://beta.sanity.io/docs/platform/v2-to-v3',
}
const removedImportSuffix =
'imports where removed in Sanity v3. ' +
`Please refer to the migration guide: ${urls.migrationGuideStudio}, ` +
`or new API-reference docs: ${urls.refDocs}`
const mergedPackages = [
'@sanity/base',
'@sanity/core',
'@sanity/types',
'@sanity/data-aspects',
'@sanity/default-layout',
'@sanity/default-login',
'@sanity/desk-tool',
'@sanity/field',
'@sanity/form-builder',
'@sanity/initial-value-templates',
'@sanity/language-filter',
'@sanity/production-preview',
'@sanity/react-hooks',
'@sanity/resolver',
'@sanity/state-router',
'@sanity/structure',
'@sanity/studio-hints',
].sort()
module.exports = {
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
...mergedPackages.map((packageName) => ({
group: [`${packageName}/*`],
message: `Use sanity instead of ${packageName}.`,
})),
{
group: ['config:*'],
message:
'config: imports are no longer supported. ' +
`Please see the new plugin API for alternatives: ${urls.migrationGuideStudio}`,
},
{
group: ['part:*'],
message: `part: ${removedImportSuffix}`,
},
{
group: ['all:part:*'],
message: `all:part: ${removedImportSuffix}`,
},
{
group: ['sanity:*'],
message: `sanity: ${removedImportSuffix}`,
},
],
},
],
},
}