Skip to content

Commit 7f241b2

Browse files
authored
chore(repo): run lint for the entire repo, clean some things up (#666)
1 parent 537001f commit 7f241b2

File tree

4 files changed

+47
-56
lines changed

4 files changed

+47
-56
lines changed

packages/babel/README.md

+21-24
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ const config = {
4545
input: 'src/index.js',
4646
output: {
4747
dir: 'output',
48-
format: 'esm'
48+
format: 'esm',
4949
},
50-
plugins: [babel({ babelHelpers: 'bundled' })]
50+
plugins: [babel({ babelHelpers: 'bundled' })],
5151
};
5252

5353
export default config;
@@ -137,13 +137,13 @@ export default {
137137
input: 'main.js',
138138
plugins: [
139139
getBabelOutputPlugin({
140-
presets: ['@babel/preset-env']
141-
})
140+
presets: ['@babel/preset-env'],
141+
}),
142142
],
143143
output: [
144144
{ file: 'bundle.cjs.js', format: 'cjs' },
145-
{ file: 'bundle.esm.js', format: 'esm' }
146-
]
145+
{ file: 'bundle.esm.js', format: 'esm' },
146+
],
147147
};
148148
```
149149

@@ -160,9 +160,9 @@ export default {
160160
{
161161
file: 'bundle.es5.js',
162162
format: 'esm',
163-
plugins: [getBabelOutputPlugin({ presets: ['@babel/preset-env'] })]
164-
}
165-
]
163+
plugins: [getBabelOutputPlugin({ presets: ['@babel/preset-env'] })],
164+
},
165+
],
166166
};
167167
```
168168

@@ -181,9 +181,9 @@ export default {
181181
{
182182
file: 'bundle.js',
183183
format: 'esm',
184-
plugins: [getBabelOutputPlugin({ presets: ['@babel/preset-env'] })]
185-
}
186-
]
184+
plugins: [getBabelOutputPlugin({ presets: ['@babel/preset-env'] })],
185+
},
186+
],
187187
};
188188
```
189189

@@ -193,7 +193,7 @@ Unlike the regular `babel` plugin, `getBabelOutputPlugin(...)` will **not** auto
193193

194194
```js
195195
getBabelOutputPlugin({
196-
configFile: path.resolve(__dirname, 'babel.config.js')
196+
configFile: path.resolve(__dirname, 'babel.config.js'),
197197
});
198198
```
199199

@@ -295,10 +295,10 @@ It's main purpose is to allow other tools for configuration of transpilation wit
295295
```js
296296
import { createBabelInputPluginFactory } from '@rollup/plugin-babel';
297297

298-
export default createBabelInputPluginFactory(babelCore => {
298+
export default createBabelInputPluginFactory((babelCore) => {
299299
function myPlugin() {
300300
return {
301-
visitor: {}
301+
visitor: {},
302302
};
303303
}
304304

@@ -310,14 +310,11 @@ export default createBabelInputPluginFactory(babelCore => {
310310
customOptions: { opt1, opt2 },
311311

312312
// Pass the options back with the two custom options removed.
313-
pluginOptions
313+
pluginOptions,
314314
};
315315
},
316316

317-
config(
318-
cfg /* Passed Babel's 'PartialConfig' object. */,
319-
{ code, customOptions }
320-
) {
317+
config(cfg /* Passed Babel's 'PartialConfig' object. */, { code, customOptions }) {
321318
if (cfg.hasFilesystemConfig()) {
322319
// Use the normal config
323320
return cfg.options;
@@ -329,17 +326,17 @@ export default createBabelInputPluginFactory(babelCore => {
329326
...(cfg.options.plugins || []),
330327

331328
// Include a custom plugin in the options.
332-
myPlugin
333-
]
329+
myPlugin,
330+
],
334331
};
335332
},
336333

337334
result(result, { code, customOptions, config, transformOptions }) {
338335
return {
339336
...result,
340-
code: result.code + '\n// Generated by some custom plugin'
337+
code: result.code + '\n// Generated by some custom plugin',
341338
};
342-
}
339+
},
343340
};
344341
});
345342
```

packages/commonjs/README.md

+14-20
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ export default {
3434
input: 'src/index.js',
3535
output: {
3636
dir: 'output',
37-
format: 'cjs'
37+
format: 'cjs',
3838
},
39-
plugins: [commonjs()]
39+
plugins: [commonjs()],
4040
};
4141
```
4242

@@ -66,8 +66,8 @@ commonjs({
6666
'!node_modules/logform/index.js',
6767
'!node_modules/logform/format.js',
6868
'!node_modules/logform/levels.js',
69-
'!node_modules/logform/browser.js'
70-
]
69+
'!node_modules/logform/browser.js',
70+
],
7171
});
7272
```
7373

@@ -174,7 +174,7 @@ This is in line with how other bundlers handle this situation and is also the mo
174174

175175
var dep$1 = /*#__PURE__*/ Object.freeze({
176176
__proto__: null,
177-
default: dep
177+
default: dep,
178178
});
179179

180180
console.log(dep$1.default);
@@ -205,7 +205,7 @@ For these situations, you can change Rollup's behaviour either globally or per m
205205
enumerable: true,
206206
get: function () {
207207
return n[k];
208-
}
208+
},
209209
}
210210
);
211211
});
@@ -233,11 +233,7 @@ For these situations, you can change Rollup's behaviour either globally or per m
233233
import * as dep$1 from 'dep';
234234

235235
function getDefaultExportFromNamespaceIfNotNamed(n) {
236-
return n &&
237-
Object.prototype.hasOwnProperty.call(n, 'default') &&
238-
Object.keys(n).length === 1
239-
? n['default']
240-
: n;
236+
return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
241237
}
242238

243239
var dep = getDefaultExportFromNamespaceIfNotNamed(dep$1);
@@ -252,9 +248,7 @@ For these situations, you can change Rollup's behaviour either globally or per m
252248
import * as dep$1 from 'dep';
253249

254250
function getDefaultExportFromNamespaceIfPresent(n) {
255-
return n && Object.prototype.hasOwnProperty.call(n, 'default')
256-
? n['default']
257-
: n;
251+
return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
258252
}
259253

260254
var dep = getDefaultExportFromNamespaceIfPresent(dep$1);
@@ -287,9 +281,9 @@ export default {
287281
output: {
288282
file: 'bundle.js',
289283
format: 'iife',
290-
name: 'MyModule'
284+
name: 'MyModule',
291285
},
292-
plugins: [resolve(), commonjs()]
286+
plugins: [resolve(), commonjs()],
293287
};
294288
```
295289

@@ -299,7 +293,7 @@ Symlinks are common in monorepos and are also created by the `npm link` command.
299293

300294
```js
301295
commonjs({
302-
include: /node_modules/
296+
include: /node_modules/,
303297
});
304298
```
305299

@@ -322,11 +316,11 @@ function cjsDetectionPlugin() {
322316
moduleParsed({
323317
id,
324318
meta: {
325-
commonjs: { isCommonJS }
326-
}
319+
commonjs: { isCommonJS },
320+
},
327321
}) {
328322
console.log(`File ${id} is CommonJS: ${isCommonJS}`);
329-
}
323+
},
330324
};
331325
}
332326
```

packages/typescript/README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -154,21 +154,21 @@ typescript({
154154
{
155155
// Allow the transformer to get a Program reference in it's factory
156156
type: 'program',
157-
factory: program => {
157+
factory: (program) => {
158158
return ProgramRequiringTransformerFactory(program);
159-
}
159+
},
160160
},
161161
{
162162
type: 'typeChecker',
163-
factory: typeChecker => {
163+
factory: (typeChecker) => {
164164
// Allow the transformer to get a Program reference in it's factory
165165
return TypeCheckerRequiringTransformerFactory(program);
166-
}
167-
}
166+
},
167+
},
168168
],
169169
after: [
170170
// You can use normal transformers directly
171-
require('custom-transformer-based-on-Context')
171+
require('custom-transformer-based-on-Context'),
172172
],
173173
afterDeclarations: [
174174
// Or even define in place
@@ -182,9 +182,9 @@ typescript({
182182

183183
return ts.visitEachChild(source, visitor, context);
184184
};
185-
}
186-
]
187-
}
185+
},
186+
],
187+
},
188188
});
189189
```
190190

@@ -199,7 +199,7 @@ compilation.
199199

200200
```js
201201
typescript({
202-
cacheDir: '.rollup.tscache'
202+
cacheDir: '.rollup.tscache',
203203
});
204204
```
205205

Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
33
"allowJs": true,
4-
"checkJs": true,
4+
"checkJs": true
55
},
66
"include": ["*.js", "**/*.js"]
7-
}
7+
}

0 commit comments

Comments
 (0)