@lvce-editor/eslint-plugin-devcontainer 18.9.0 → 18.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +60 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29,8 +29,8 @@ const findMember = (node, name) => {
|
|
|
29
29
|
return undefined;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
const defaultAllowedImages = ['mcr.microsoft.com/devcontainers/javascript-node:24'];
|
|
33
|
-
const meta$
|
|
32
|
+
const defaultAllowedImages = ['mcr.microsoft.com/devcontainers/javascript-node:24', 'mcr.microsoft.com/devcontainers/javascript-node:26'];
|
|
33
|
+
const meta$3 = {
|
|
34
34
|
docs: {
|
|
35
35
|
description: 'Ensure that the devcontainer image is allowed'
|
|
36
36
|
},
|
|
@@ -61,7 +61,7 @@ const getAllowedImages = context => {
|
|
|
61
61
|
}
|
|
62
62
|
return defaultAllowedImages;
|
|
63
63
|
};
|
|
64
|
-
const create$
|
|
64
|
+
const create$3 = context => {
|
|
65
65
|
const allowedImages = new Set(getAllowedImages(context));
|
|
66
66
|
return {
|
|
67
67
|
Document(node) {
|
|
@@ -102,8 +102,62 @@ const create$2 = context => {
|
|
|
102
102
|
|
|
103
103
|
const allowedImage = {
|
|
104
104
|
__proto__: null,
|
|
105
|
-
create: create$
|
|
105
|
+
create: create$3,
|
|
106
106
|
defaultAllowedImages,
|
|
107
|
+
meta: meta$3
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// cspell:ignore moby
|
|
111
|
+
|
|
112
|
+
const dockerInDockerFeature = 'ghcr.io/devcontainers/features/docker-in-docker';
|
|
113
|
+
const expectedFeature = `${dockerInDockerFeature}:4`;
|
|
114
|
+
const meta$2 = {
|
|
115
|
+
docs: {
|
|
116
|
+
description: 'Require docker-in-docker version 4 with moby disabled'
|
|
117
|
+
},
|
|
118
|
+
messages: {
|
|
119
|
+
invalidVersion: 'docker-in-docker devcontainer feature must use version 4',
|
|
120
|
+
mobyMustBeFalse: 'docker-in-docker devcontainer feature must configure "moby": false'
|
|
121
|
+
},
|
|
122
|
+
schema: [],
|
|
123
|
+
type: 'problem'
|
|
124
|
+
};
|
|
125
|
+
const create$2 = context => {
|
|
126
|
+
return {
|
|
127
|
+
Document(node) {
|
|
128
|
+
const features = findMember(node.body, 'features');
|
|
129
|
+
if (!features || !isObjectNode(features.value)) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
for (const feature of features.value.members) {
|
|
133
|
+
if (!isStringNode(feature.name)) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
const name = feature.name.value;
|
|
137
|
+
if (name !== dockerInDockerFeature && !name.startsWith(`${dockerInDockerFeature}:`) && !name.startsWith(`${dockerInDockerFeature}@`)) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (name !== expectedFeature) {
|
|
141
|
+
context.report({
|
|
142
|
+
loc: feature.name.loc,
|
|
143
|
+
messageId: 'invalidVersion'
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
const moby = findMember(feature.value, 'moby');
|
|
147
|
+
if (!moby || moby.value.type !== 'Boolean' || moby.value.value !== false) {
|
|
148
|
+
context.report({
|
|
149
|
+
loc: (moby || feature).value.loc,
|
|
150
|
+
messageId: 'mobyMustBeFalse'
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const dockerInDocker = {
|
|
159
|
+
__proto__: null,
|
|
160
|
+
create: create$2,
|
|
107
161
|
meta: meta$2
|
|
108
162
|
};
|
|
109
163
|
|
|
@@ -265,6 +319,7 @@ const plugin = {
|
|
|
265
319
|
},
|
|
266
320
|
rules: {
|
|
267
321
|
'allowed-image': allowedImage,
|
|
322
|
+
'docker-in-docker': dockerInDocker,
|
|
268
323
|
'post-create-command': postCreateCommand,
|
|
269
324
|
'require-desktop-lite-feature': requireDesktopLiteFeature
|
|
270
325
|
}
|
|
@@ -282,6 +337,7 @@ const recommended = [{
|
|
|
282
337
|
},
|
|
283
338
|
rules: {
|
|
284
339
|
'devcontainer/allowed-image': 'error',
|
|
340
|
+
'devcontainer/docker-in-docker': 'error',
|
|
285
341
|
'devcontainer/post-create-command': 'off',
|
|
286
342
|
'devcontainer/require-desktop-lite-feature': 'error'
|
|
287
343
|
}
|