Skip to content

Commit c2ef08e

Browse files
committed
chore: lint
1 parent 368afc8 commit c2ef08e

File tree

13 files changed

+32
-31
lines changed

13 files changed

+32
-31
lines changed

.github/workflows/nodejs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
strategy:
1111
matrix:
1212
node-version:
13-
- 18.x
1413
- 20.x
15-
- 21.x
14+
- 22.x
15+
- 23.x
1616
steps:
1717
- uses: actions/checkout@v4
1818
- uses: oven-sh/setup-bun@v1

.nycrc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"**/version.js",
1616
"**/example",
1717
"**/bundler.js",
18-
"**/bundle.js"
18+
"**/bundle.js",
19+
"**/*.config.*"
1920
],
2021
"branches": 100,
2122
"lines": 100,

lib/bundle-files/fixture/bundle-files-fix.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
const module = {
1414
exports,
1515
};
16+
1617
if (__modules[name])
1718
return __modules[name];
1819

lib/bundle-files/index.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ const {
1111
} = operator;
1212

1313
const {
14-
Identifier,
15-
VariableDeclarator,
16-
VariableDeclaration,
17-
StringLiteral,
18-
ObjectProperty,
19-
ObjectExpression,
14+
objectExpression,
15+
objectProperty,
16+
stringLiteral,
17+
variableDeclaration,
18+
variableDeclarator,
19+
identifier,
2020
} = types;
2121

2222
const createFunction = template('(exports, require, module) => {BODY}');
@@ -33,19 +33,19 @@ const createIIFEE = template(`
3333
export const report = () => '';
3434

3535
export const fix = (root, {entry, filenames, trackFile}) => {
36-
const object = ObjectExpression([]);
36+
const object = objectExpression([]);
3737

3838
for (const file of trackFile(root, filenames)) {
3939
const content = readFileContent(file);
4040
const filename = getFilename(file);
41-
const property = ObjectProperty(StringLiteral(filename), createFunction({
41+
const property = objectProperty(stringLiteral(filename), createFunction({
4242
BODY: template.ast(content),
4343
}));
4444

4545
object.properties.push(property);
4646
}
4747

48-
const filesystem = VariableDeclaration('const', [VariableDeclarator(Identifier('__filesystem'), object)]);
48+
const filesystem = variableDeclaration('const', [variableDeclarator(identifier('__filesystem'), object)]);
4949

5050
replaceWith(root.parentPath, createIIFEE({
5151
FILESYSTEM: filesystem,

lib/bundle-files/index.spec.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {createTest} from '@putout/test';
22
import * as plugin from './index.js';
33

44
const test = createTest(import.meta.url, {
5-
printer: 'putout',
65
plugins: [
76
['bundle-files', plugin],
87
],
@@ -19,7 +18,7 @@ test('lib: bundle-files: report', (t) => {
1918
t.end();
2019
});
2120

22-
test('lib: bundle-files: no report: no options', (t) => {
21+
test('lib: bundle-files: no report: no-options', (t) => {
2322
t.noReport('no-options');
2423
t.end();
2524
});

lib/bundler.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,25 @@ import {
66
print,
77
findPlaces,
88
} from 'putout';
9-
import * as pluginParseFilenames from './parse-filenames/index.js';
10-
import * as pluginResolveFilenames from './resolve-filenames/index.js';
11-
import * as pluginBundleFiles from './bundle-files/index.js';
129
import {
1310
branch as originalBranch,
1411
merge as originalMerge,
1512
} from '@putout/processor-filesystem';
13+
import * as pluginParseFilenames from './parse-filenames/index.js';
14+
import * as pluginResolveFilenames from './resolve-filenames/index.js';
15+
import * as pluginBundleFiles from './bundle-files/index.js';
1616

1717
const [, replaceCwd] = pluginFilesystem.rules['replace-cwd'];
1818
const [, readAllFiles] = pluginFilesystem.rules['read-all-files'];
1919

2020
const getMessage = (a) => a.message;
2121

22-
export const bundle = (from, entry, filesystem, {
23-
progress = createProgress(),
24-
branch = originalBranch,
25-
merge = originalMerge,
26-
} = {}) => {
22+
export const bundle = (from, entry, filesystem, overrides = {}) => {
23+
const {
24+
progress = createProgress(),
25+
branch = originalBranch,
26+
merge = originalMerge,
27+
} = overrides;
2728
const [{source}] = branch(filesystem);
2829
const ast = parse(source);
2930

lib/parse-filenames/index.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import putout from 'putout';
21
import {dirname} from 'node:path';
2+
import putout from 'putout';
33
import * as convertEsmToCommonjs from '@putout/plugin-nodejs/convert-esm-to-commonjs';
44
import * as parseRequire from './parse-require/index.js';
55

@@ -18,7 +18,10 @@ const readExternalStub = returns('');
1818
export const report = (root, {file}) => file;
1919
export const fix = () => {};
2020
export const scan = (root, {push, options}) => {
21-
const {entry = '/index.js', readExternal = readExternalStub} = options;
21+
const {
22+
entry = '/index.js',
23+
readExternal = readExternalStub,
24+
} = options;
2225
const files = new Set();
2326
const processingNames = new Set([entry]);
2427

lib/parse-filenames/index.spec.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import tryCatch from 'try-catch';
33
import * as plugin from './index.js';
44

55
const test = createTest(import.meta.url, {
6-
printer: 'putout',
76
plugins: [
87
['parse-filenames', plugin],
98
],

lib/parse-filenames/parse-require/index.spec.js

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {createTest} from '@putout/test';
22
import * as plugin from './index.js';
33

44
const test = createTest(import.meta.url, {
5-
printer: 'putout',
65
plugins: [
76
['parse-require', plugin],
87
],

lib/resolve-filenames/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import putout, {operator} from 'putout';
21
import {dirname} from 'node:path';
3-
import * as resolveRequire from './resolve-require/index.js';
2+
import putout, {operator} from 'putout';
43
import * as convertEsmToCommonjs from '@putout/plugin-nodejs/convert-esm-to-commonjs';
4+
import * as resolveRequire from './resolve-require/index.js';
55

66
const {
77
writeFileContent,

lib/resolve-filenames/index.spec.js

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {createTest} from '@putout/test';
22
import * as plugin from './index.js';
33

44
const test = createTest(import.meta.url, {
5-
printer: 'putout',
65
plugins: [
76
['resolve-filenames', plugin],
87
],

lib/resolve-filenames/resolve-require/index.spec.js

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {createTest} from '@putout/test';
22
import * as plugin from './index.js';
33

44
const {test} = createTest(import.meta.url, {
5-
printer: 'putout',
65
plugins: [
76
['resolve-require', plugin],
87
],

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"repository": {
1313
"type": "git",
14-
"url": "git://github.com/putoutjs/bundler.git"
14+
"url": "git+https://github.com/putoutjs/bundler.git"
1515
},
1616
"scripts": {
1717
"wisdom": "madrun wisdom",

0 commit comments

Comments
 (0)