Skip to content

Commit b8a70e1

Browse files
committed
Minor lint fixes
1 parent 3590423 commit b8a70e1

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,17 @@ precinct.paperwork = (filename, options = {}) => {
161161
const dependencies = precinct(content, options);
162162

163163
if (!options.includeCore) {
164-
return dependencies.filter((dependency) => {
164+
return dependencies.filter(dependency => {
165165
if (dependency.startsWith('node:')) {
166-
return false
166+
return false;
167167
}
168168

169-
// In nodejs 18, node:test is a builtin but shows up under natives["test"], but
169+
// In Node.js 18, node:test is a builtin but shows up under natives["test"], but
170170
// can only be imported by "node:test." We're correcting this so "test" isn't
171171
// unnecessarily stripped from the imports
172172
if (dependency === 'test') {
173173
debug('paperwork: allowing test import to avoid builtin/natives consideration\n');
174-
return true
174+
return true;
175175
}
176176

177177
return !natives[dependency];

test/index.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const fs = require('fs');
77
const path = require('path');
88
const rewire = require('rewire');
99
const sinon = require('sinon');
10-
const ast = require('./fixtures/exampleAST');
10+
const ast = require('./fixtures/exampleAST.js');
11+
1112
const precinct = rewire('../index.js');
1213

1314
function read(filename) {
@@ -163,7 +164,7 @@ describe('node-precinct', () => {
163164

164165
describe('paperwork', () => {
165166
it('grabs dependencies of jsx files', () => {
166-
const result = precinct.paperwork(`${__dirname}/fixtures/module.jsx`);
167+
const result = precinct.paperwork(path.join(__dirname, '/fixtures/module.jsx'));
167168
const expected = ['./es6NoImport'];
168169

169170
assert.deepEqual(result, expected);
@@ -186,10 +187,10 @@ describe('node-precinct', () => {
186187
});
187188

188189
it('returns the dependencies for the given filepath', () => {
189-
assert.notEqual(precinct.paperwork(`${__dirname}/fixtures/es6.js`).length, 0);
190-
assert.notEqual(precinct.paperwork(`${__dirname}/fixtures/styles.scss`).length, 0);
191-
assert.notEqual(precinct.paperwork(`${__dirname}/fixtures/typescript.ts`).length, 0);
192-
assert.notEqual(precinct.paperwork(`${__dirname}/fixtures/styles.css`).length, 0);
190+
assert.notEqual(precinct.paperwork(path.join(__dirname, '/fixtures/es6.js')).length, 0);
191+
assert.notEqual(precinct.paperwork(path.join(__dirname, '/fixtures/styles.scss')).length, 0);
192+
assert.notEqual(precinct.paperwork(path.join(__dirname, '/fixtures/typescript.ts')).length, 0);
193+
assert.notEqual(precinct.paperwork(path.join(__dirname, '/fixtures/styles.css')).length, 0);
193194
});
194195

195196
it('throws if the file cannot be found', () => {
@@ -199,21 +200,21 @@ describe('node-precinct', () => {
199200
});
200201

201202
it('filters out core modules if options.includeCore is false', () => {
202-
const deps = precinct.paperwork(`${__dirname}/fixtures/coreModules.js`, {
203+
const deps = precinct.paperwork(path.join(__dirname, '/fixtures/coreModules.js'), {
203204
includeCore: false
204205
});
205206

206207
assert.equal(deps.length, 0);
207208
});
208209

209210
it('handles cjs files as commonjs', () => {
210-
const deps = precinct.paperwork(`${__dirname}/fixtures/commonjs.cjs`);
211+
const deps = precinct.paperwork(path.join(__dirname, '/fixtures/commonjs.cjs'));
211212
assert.equal(deps.includes('./a'), true);
212213
assert.equal(deps.includes('./b'), true);
213214
});
214215

215216
it('does not filter out core modules by default', () => {
216-
const deps = precinct.paperwork(`${__dirname}/fixtures/coreModules.js`);
217+
const deps = precinct.paperwork(path.join(__dirname, '/fixtures/coreModules.js'));
217218
assert.notEqual(deps.length, 0);
218219
});
219220

@@ -226,7 +227,7 @@ describe('node-precinct', () => {
226227
}
227228
};
228229

229-
precinct.paperwork(`${__dirname}/fixtures/amd.js`, {
230+
precinct.paperwork(path.join(__dirname, '/fixtures/amd.js'), {
230231
includeCore: false,
231232
amd: config.amd
232233
});
@@ -240,7 +241,7 @@ describe('node-precinct', () => {
240241
const stub = sinon.stub().returns([]);
241242
const revert = precinct.__set__('precinct', stub);
242243

243-
precinct.paperwork(`${__dirname}/fixtures/amd.js`, {
244+
precinct.paperwork(path.join(__dirname, '/fixtures/amd.js'), {
244245
amd: {
245246
skipLazyLoaded: true
246247
}
@@ -349,12 +350,12 @@ describe('node-precinct', () => {
349350
assert.deepEqual(deps, ['streams']);
350351
});
351352

352-
it("understands quirks around some modules only being addressable via node: prefix", () => {
353+
it('understands quirks around some modules only being addressable via node: prefix', () => {
353354
const deps = precinct.paperwork(path.join(__dirname, 'fixtures', 'requiretest.js'), {
354355
includeCore: false
355356
});
356357
assert.deepEqual(deps, ['test']);
357-
})
358+
});
358359
});
359360

360361
describe('that uses dynamic imports', () => {

0 commit comments

Comments
 (0)