You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39-32Lines changed: 39 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,7 +73,17 @@ module.exports = {
73
73
74
74
This plugin provides the following core configurations:
75
75
76
-
-[script](lib/config/script.js): preset for [CommonJS modules](https://nodejs.org/docs/latest/api/modules.html) (`require`/`module.exports`/etc).
76
+
-[script](lib/config/script.js): preset for environment without `require`/`import` (old browsers or custom env).
77
+
78
+
Example of configuration:
79
+
80
+
```json
81
+
{
82
+
"extends": ["plugin:itgalaxy/script"]
83
+
}
84
+
```
85
+
86
+
-[commonjs](lib/config/commonjs.js): preset for [CommonJS modules](https://nodejs.org/docs/latest/api/modules.html) (`require`/`module.exports`/etc).
77
87
78
88
Example of configuration:
79
89
@@ -129,7 +139,7 @@ console.log(import.meta.url);
129
139
loadConfig("example");
130
140
```
131
141
132
-
- [node](lib/config/node.js): use this for `Node.js` projects.
142
+
- [node](lib/config/node.js): use this for `Node.js` projects (preset contains only environments rules, i.e. no rules for `require`/`import`, see above presets).
133
143
134
144
Preset contains environment and rules for `Node.js` code.
135
145
@@ -138,9 +148,9 @@ Example of configuration:
138
148
```js
139
149
module.exports= {
140
150
extends: [
141
-
// You can use "plugin:itgalaxy/script" or "plugin:itgalaxy/dirty"
142
-
"plugin:itgalaxy/module",
143
151
"plugin:itgalaxy/esnext",
152
+
// You can use "plugin:itgalaxy/commonjs" or "plugin:itgalaxy/dirty"
153
+
"plugin:itgalaxy/module",
144
154
"plugin:itgalaxy/node",
145
155
],
146
156
};
@@ -155,9 +165,9 @@ Example of configuration:
155
165
```js
156
166
module.exports= {
157
167
extends: [
158
-
// You can use "plugin:itgalaxy/script" or "plugin:itgalaxy/dirty"
159
-
"plugin:itgalaxy/module",
160
168
"plugin:itgalaxy/esnext",
169
+
// You can use "plugin:itgalaxy/script" for old browsers or custom enviroment, "plugin:itgalaxy/commonjs" or "plugin:itgalaxy/dirty" (useful for bundlers)
170
+
"plugin:itgalaxy/module",
161
171
"plugin:itgalaxy/browser",
162
172
],
163
173
};
@@ -174,9 +184,9 @@ Example of configuration:
174
184
```js
175
185
module.exports= {
176
186
extends: [
177
-
// You can use "plugin:itgalaxy/script" or "plugin:itgalaxy/dirty"
178
-
"plugin:itgalaxy/module",
179
187
"plugin:itgalaxy/esnext",
188
+
// You can use "plugin:itgalaxy/script" for old browsers or custom enviroment, "plugin:itgalaxy/commonjs" or "plugin:itgalaxy/dirty" (useful for bundlers)
189
+
"plugin:itgalaxy/module",
180
190
],
181
191
};
182
192
```
@@ -188,10 +198,10 @@ Example of configuration:
188
198
```js
189
199
module.exports= {
190
200
extends: [
191
-
// You can use "plugin:itgalaxy/script" or "plugin:itgalaxy/dirty"
201
+
"plugin:itgalaxy/esnext",
202
+
// You can use "plugin:itgalaxy/commonjs" or "plugin:itgalaxy/dirty" (useful for bundlers)
192
203
"plugin:itgalaxy/module",
193
204
"plugin:itgalaxy/browser",
194
-
"plugin:itgalaxy/esnext",
195
205
"plugin:itgalaxy/react",
196
206
],
197
207
};
@@ -204,10 +214,10 @@ Example of configuration:
204
214
```js
205
215
module.exports= {
206
216
extends: [
207
-
// You can use "plugin:itgalaxy/script" or "plugin:itgalaxy/dirty"
217
+
"plugin:itgalaxy/esnext",
218
+
// You can use "plugin:itgalaxy/commonjs" or "plugin:itgalaxy/dirty" (useful for bundlers)
208
219
"plugin:itgalaxy/module",
209
220
"plugin:itgalaxy/browser",
210
-
"plugin:itgalaxy/esnext",
211
221
"plugin:itgalaxy/html",
212
222
],
213
223
};
@@ -223,11 +233,10 @@ Example of configuration:
223
233
```js
224
234
module.exports= {
225
235
extends: [
226
-
// You can use "plugin:itgalaxy/script" or "plugin:itgalaxy/dirty"
236
+
"plugin:itgalaxy/esnext",
237
+
// You can use "plugin:itgalaxy/commonjs" or "plugin:itgalaxy/dirty" (useful for bundlers)
227
238
"plugin:itgalaxy/module",
228
-
// You can use "plugin:itgalaxy/node" or use them both
229
239
"plugin:itgalaxy/browser",
230
-
"plugin:itgalaxy/esnext",
231
240
"plugin:itgalaxy/markdown",
232
241
],
233
242
};
@@ -240,10 +249,10 @@ Example of configuration:
240
249
```js
241
250
module.exports= {
242
251
extends: [
252
+
"plugin:itgalaxy/esnext",
253
+
// You can use "plugin:itgalaxy/commonjs" or "plugin:itgalaxy/dirty" (useful for bundlers)
243
254
"plugin:itgalaxy/module",
244
-
// You can use "plugin:itgalaxy/node" or use them both
245
255
"plugin:itgalaxy/browser",
246
-
"plugin:itgalaxy/esnext",
247
256
"plugin:itgalaxy/ava",
248
257
],
249
258
};
@@ -258,10 +267,10 @@ Example of configuration:
258
267
```js
259
268
module.exports= {
260
269
extends: [
270
+
"plugin:itgalaxy/esnext",
271
+
// You can use "plugin:itgalaxy/commonjs" or "plugin:itgalaxy/dirty" (useful for bundlers)
261
272
"plugin:itgalaxy/module",
262
-
// You can use "plugin:itgalaxy/node" or use them both
263
273
"plugin:itgalaxy/browser",
264
-
"plugin:itgalaxy/esnext",
265
274
"plugin:itgalaxy/jest",
266
275
],
267
276
};
@@ -274,9 +283,10 @@ Example of configuration:
274
283
```js
275
284
module.exports= {
276
285
extends: [
286
+
"plugin:itgalaxy/esnext",
287
+
// You can use "plugin:itgalaxy/commonjs" or "plugin:itgalaxy/dirty" (useful for bundlers)
277
288
"plugin:itgalaxy/module",
278
289
"plugin:itgalaxy/node",
279
-
"plugin:itgalaxy/esnext",
280
290
"plugin:itgalaxy/jsdoc-typescript",
281
291
],
282
292
};
@@ -293,10 +303,10 @@ module.exports = {
293
303
294
304
module.exports= {
295
305
extends: [
296
-
"plugin:itgalaxy/script",
297
-
// Use "plugin:itgalaxy/browser" if you write code for browser or use them both if you write for both environments
298
-
"plugin:itgalaxy/node",
299
306
"plugin:itgalaxy/esnext",
307
+
"plugin:itgalaxy/commonjs",
308
+
// Use "plugin:itgalaxy/browser" if you write code for browser or use them both if you write for both environments (you need bundler)
309
+
"plugin:itgalaxy/node",
300
310
"plugin:itgalaxy/jest",
301
311
// Lint documentation
302
312
"plugin:itgalaxy/markdown",
@@ -314,11 +324,11 @@ module.exports = {
314
324
```js
315
325
exportdefault {
316
326
extends: [
317
-
// You can change this on "plugin:itgalaxy/dirty" if you use `node-babel` and have mixed code with `import` and `require`
327
+
"plugin:itgalaxy/esnext",
328
+
// You can change this on "plugin:itgalaxy/dirty" if you use `node-babel`, bundler and have mixed code with `import` and `require`
318
329
"plugin:itgalaxy/module",
319
-
// Use "plugin:itgalaxy/browser" if you write code for browser or use them both if you write for both environments
330
+
// Use "plugin:itgalaxy/browser" if you write code for browser or use them both if you write for both environments (you need bundler)
320
331
"plugin:itgalaxy/node",
321
-
"plugin:itgalaxy/esnext",
322
332
"plugin:itgalaxy/jest",
323
333
// Lint documentation
324
334
"plugin:itgalaxy/markdown",
@@ -339,9 +349,9 @@ module.exports = {
339
349
// if you use ECMA modules everywhere (preferable)
0 commit comments