Skip to content

Commit 176ded9

Browse files
ESLint auto-fixes (changed single quotes to double quotes)
1 parent 6911234 commit 176ded9

8 files changed

+195
-194
lines changed

.editorconfig

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ root = true
1111
charset = utf-8
1212
trim_trailing_whitespace = true
1313
insert_final_newline = true
14+
end_of_line = lf
1415

1516
# 2 space indentation
1617
indent_style = space
1718
indent_size = 2
1819

1920
# JavaScript-specific settings
2021
[*.js]
21-
quote_type = single
22+
quote_type = double
2223
continuation_indent_size = 2
2324
curly_bracket_next_line = false
2425
indent_brace_style = BSD

lib/index.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
'use strict';
1+
"use strict";
22

3-
const path = require('path');
4-
const Through = require('through');
3+
const path = require("path");
4+
const Through = require("through");
55

66
module.exports = sourcemapify;
77

@@ -35,10 +35,10 @@ function sourcemapify (browserify, options) {
3535
// Add our transform stream to Browserify's "debug" pipeline
3636
// https://github.com/substack/node-browserify#bpipeline
3737
configurePipeline();
38-
browserify.on('reset', configurePipeline);
38+
browserify.on("reset", configurePipeline);
3939

4040
function configurePipeline () {
41-
browserify.pipeline.get('debug').push(new Through(write));
41+
browserify.pipeline.get("debug").push(new Through(write));
4242
}
4343

4444
return this;
@@ -52,17 +52,17 @@ function sourcemapify (browserify, options) {
5252
* @returns {string}
5353
*/
5454
function joinURL (urlA, urlB) {
55-
urlA = urlA || '';
56-
urlB = urlB || '';
55+
urlA = urlA || "";
56+
urlB = urlB || "";
5757

58-
let endsWithASlash = urlA.substr(-1) === '/' || urlA.substr(-1) === '\\';
59-
let startsWithASlash = urlB[0] === '/' || urlB[0] === '\\';
58+
let endsWithASlash = urlA.substr(-1) === "/" || urlA.substr(-1) === "\\";
59+
let startsWithASlash = urlB[0] === "/" || urlB[0] === "\\";
6060

6161
if (endsWithASlash || startsWithASlash) {
6262
return urlA + urlB;
6363
}
6464
else {
65-
return urlA + '/' + urlB;
65+
return urlA + "/" + urlB;
6666
}
6767
}
6868

@@ -73,11 +73,11 @@ function joinURL (urlA, urlB) {
7373
* @returns {string}
7474
*/
7575
function normalizeSeparators (p) {
76-
p = p || '';
76+
p = p || "";
7777

78-
if (path.sep === '\\') {
78+
if (path.sep === "\\") {
7979
// Replace backslashes with forward slashes
80-
return p.replace(/\\/g, '/');
80+
return p.replace(/\\/g, "/");
8181
}
8282
else {
8383
// Return the path as-is, since it should already have proper URL separators.

test/fixtures/clean-dist-dir.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
'use strict';
1+
"use strict";
22

3-
const fs = require('fs');
4-
const paths = require('./paths');
5-
const del = require('del');
3+
const fs = require("fs");
4+
const paths = require("./paths");
5+
const del = require("del");
66

77
/**
88
* Resets the contents of the "test-app/dist" directory before each test.
99
*/
1010
beforeEach(done => {
1111
// Delete the "test-app/dist" directory, if it exists
12-
del('test/test-app/dist')
12+
del("test/test-app/dist")
1313
.then(() => {
1414
// Re-create the "test-app/dist" directory
1515
fs.mkdirSync(paths.dist);
1616

1717
// Create an empty "bundle.js" file,
1818
// since Browserify throws an error if the file doesn't exist
19-
fs.writeFileSync(paths.bundleFile, '');
19+
fs.writeFileSync(paths.bundleFile, "");
2020

2121
done();
2222
})

test/fixtures/paths.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
'use strict';
1+
"use strict";
22

3-
const fs = require('fs');
4-
const path = require('path');
3+
const fs = require("fs");
4+
const path = require("path");
55
const paths = exports;
66

7-
paths.root = path.resolve('test', 'test-app');
8-
paths.lib = path.join(paths.root, 'lib');
9-
paths.dist = path.join(paths.root, 'dist');
10-
paths.entryFile = path.join(paths.lib, 'index.js');
11-
paths.bundleFile = path.join(paths.dist, 'bundle.js');
12-
paths.mapFile = path.join(paths.dist, 'bundle.js.map');
7+
paths.root = path.resolve("test", "test-app");
8+
paths.lib = path.join(paths.root, "lib");
9+
paths.dist = path.join(paths.root, "dist");
10+
paths.entryFile = path.join(paths.lib, "index.js");
11+
paths.bundleFile = path.join(paths.dist, "bundle.js");
12+
paths.mapFile = path.join(paths.dist, "bundle.js.map");
1313

14-
if (fs.existsSync('node_modules/browser-pack')) {
14+
if (fs.existsSync("node_modules/browser-pack")) {
1515
// NPM 3.0 installs all dependencies directly under "node_modules"
16-
paths.preludeFile = 'node_modules/browser-pack/_prelude.js';
16+
paths.preludeFile = "node_modules/browser-pack/_prelude.js";
1717
}
1818
else {
1919
// NPM 2.0 installs dependencies under their parent module
20-
paths.preludeFile = 'node_modules/browserify/node_modules/browser-pack/_prelude.js';
20+
paths.preludeFile = "node_modules/browserify/node_modules/browser-pack/_prelude.js";
2121
}

test/specs/base.spec.js

+71-71
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
'use strict';
2-
3-
const fs = require('fs');
4-
const path = require('path');
5-
const paths = require('../fixtures/paths');
6-
const browserify = require('browserify');
7-
const sourcemapify = require('../../');
8-
const exorcist = require('exorcist');
9-
const chai = require('chai');
1+
"use strict";
2+
3+
const fs = require("fs");
4+
const path = require("path");
5+
const paths = require("../fixtures/paths");
6+
const browserify = require("browserify");
7+
const sourcemapify = require("../../");
8+
const exorcist = require("exorcist");
9+
const chai = require("chai");
1010
chai.should();
1111

1212
describe('Sourcemapify with "base" option', () => {
1313
it('should have no effect if "base" is an empty string', done => {
1414
browserify(paths.entryFile, { debug: true })
15-
.plugin(sourcemapify, { base: '' })
15+
.plugin(sourcemapify, { base: "" })
1616
.bundle()
1717
.pipe(exorcist(paths.mapFile))
18-
.pipe(fs.createWriteStream(paths.bundleFile, 'utf8'))
19-
.on('error', done)
20-
.on('finish', () => {
21-
let sourcemap = JSON.parse(fs.readFileSync(paths.mapFile, 'utf8'));
18+
.pipe(fs.createWriteStream(paths.bundleFile, "utf8"))
19+
.on("error", done)
20+
.on("finish", () => {
21+
let sourcemap = JSON.parse(fs.readFileSync(paths.mapFile, "utf8"));
2222

2323
// Because `base` was an empty string, the sourcemap uses paths that
2424
// are relative to the current directory
2525
sourcemap.sources.should.deep.equal([
2626
paths.preludeFile,
27-
'test/test-app/lib/foo.js',
28-
'test/test-app/lib/index.js',
29-
'test/test-app/lib/subdir/foo.js',
30-
'test/test-app/lib/subdir/index.js',
31-
'test/test-app/lib/subdir/subdir/foo.js',
32-
'test/test-app/lib/subdir/subdir/index.js',
27+
"test/test-app/lib/foo.js",
28+
"test/test-app/lib/index.js",
29+
"test/test-app/lib/subdir/foo.js",
30+
"test/test-app/lib/subdir/index.js",
31+
"test/test-app/lib/subdir/subdir/foo.js",
32+
"test/test-app/lib/subdir/subdir/index.js",
3333
]);
3434

3535
done();
@@ -41,38 +41,38 @@ describe('Sourcemapify with "base" option', () => {
4141
.plugin(sourcemapify, { base: process.cwd() })
4242
.bundle()
4343
.pipe(exorcist(paths.mapFile))
44-
.pipe(fs.createWriteStream(paths.bundleFile, 'utf8'))
45-
.on('error', done)
46-
.on('finish', () => {
47-
let sourcemap = JSON.parse(fs.readFileSync(paths.mapFile, 'utf8'));
44+
.pipe(fs.createWriteStream(paths.bundleFile, "utf8"))
45+
.on("error", done)
46+
.on("finish", () => {
47+
let sourcemap = JSON.parse(fs.readFileSync(paths.mapFile, "utf8"));
4848

4949
// Because `base` was an empty string, the sourcemap uses paths that
5050
// are relative to the current directory
5151
sourcemap.sources.should.deep.equal([
5252
paths.preludeFile,
53-
'test/test-app/lib/foo.js',
54-
'test/test-app/lib/index.js',
55-
'test/test-app/lib/subdir/foo.js',
56-
'test/test-app/lib/subdir/index.js',
57-
'test/test-app/lib/subdir/subdir/foo.js',
58-
'test/test-app/lib/subdir/subdir/index.js',
53+
"test/test-app/lib/foo.js",
54+
"test/test-app/lib/index.js",
55+
"test/test-app/lib/subdir/foo.js",
56+
"test/test-app/lib/subdir/index.js",
57+
"test/test-app/lib/subdir/subdir/foo.js",
58+
"test/test-app/lib/subdir/subdir/index.js",
5959
]);
6060

6161
done();
6262
});
6363
});
6464

65-
it('should add an additional directory level to each path', done => {
65+
it("should add an additional directory level to each path", done => {
6666
const parentDir = path.basename(process.cwd());
6767

6868
browserify(paths.entryFile, { debug: true })
69-
.plugin(sourcemapify, { base: '..' })
69+
.plugin(sourcemapify, { base: ".." })
7070
.bundle()
7171
.pipe(exorcist(paths.mapFile))
72-
.pipe(fs.createWriteStream(paths.bundleFile, 'utf8'))
73-
.on('error', done)
74-
.on('finish', () => {
75-
let sourcemap = JSON.parse(fs.readFileSync(paths.mapFile, 'utf8'));
72+
.pipe(fs.createWriteStream(paths.bundleFile, "utf8"))
73+
.on("error", done)
74+
.on("finish", () => {
75+
let sourcemap = JSON.parse(fs.readFileSync(paths.mapFile, "utf8"));
7676

7777
// Because `root` was an empty string, the sourcemap uses paths that
7878
// are relative to the current directory
@@ -90,54 +90,54 @@ describe('Sourcemapify with "base" option', () => {
9090
});
9191
});
9292

93-
it('should remove directory levels from each path', done => {
93+
it("should remove directory levels from each path", done => {
9494
browserify(paths.entryFile, { debug: true })
95-
.plugin(sourcemapify, { base: 'test/test-app' })
95+
.plugin(sourcemapify, { base: "test/test-app" })
9696
.bundle()
9797
.pipe(exorcist(paths.mapFile))
98-
.pipe(fs.createWriteStream(paths.bundleFile, 'utf8'))
99-
.on('error', done)
100-
.on('finish', () => {
101-
let sourcemap = JSON.parse(fs.readFileSync(paths.mapFile, 'utf8'));
98+
.pipe(fs.createWriteStream(paths.bundleFile, "utf8"))
99+
.on("error", done)
100+
.on("finish", () => {
101+
let sourcemap = JSON.parse(fs.readFileSync(paths.mapFile, "utf8"));
102102

103103
// Because `root` was an empty string, the sourcemap uses paths that
104104
// are relative to the current directory
105105
sourcemap.sources.should.deep.equal([
106106
paths.preludeFile,
107-
'lib/foo.js',
108-
'lib/index.js',
109-
'lib/subdir/foo.js',
110-
'lib/subdir/index.js',
111-
'lib/subdir/subdir/foo.js',
112-
'lib/subdir/subdir/index.js',
107+
"lib/foo.js",
108+
"lib/index.js",
109+
"lib/subdir/foo.js",
110+
"lib/subdir/index.js",
111+
"lib/subdir/subdir/foo.js",
112+
"lib/subdir/subdir/index.js",
113113
]);
114114

115115
done();
116116
});
117117
});
118118

119-
it('should remove a directory level from each path via an absolute path', done => {
120-
const absolutePath = path.resolve('test');
119+
it("should remove a directory level from each path via an absolute path", done => {
120+
const absolutePath = path.resolve("test");
121121

122122
browserify(paths.entryFile, { debug: true })
123123
.plugin(sourcemapify, { base: absolutePath })
124124
.bundle()
125125
.pipe(exorcist(paths.mapFile))
126-
.pipe(fs.createWriteStream(paths.bundleFile, 'utf8'))
127-
.on('error', done)
128-
.on('finish', () => {
129-
let sourcemap = JSON.parse(fs.readFileSync(paths.mapFile, 'utf8'));
126+
.pipe(fs.createWriteStream(paths.bundleFile, "utf8"))
127+
.on("error", done)
128+
.on("finish", () => {
129+
let sourcemap = JSON.parse(fs.readFileSync(paths.mapFile, "utf8"));
130130

131131
// Because `root` was an empty string, the sourcemap uses paths that
132132
// are relative to the current directory
133133
sourcemap.sources.should.deep.equal([
134134
paths.preludeFile,
135-
'test-app/lib/foo.js',
136-
'test-app/lib/index.js',
137-
'test-app/lib/subdir/foo.js',
138-
'test-app/lib/subdir/index.js',
139-
'test-app/lib/subdir/subdir/foo.js',
140-
'test-app/lib/subdir/subdir/index.js',
135+
"test-app/lib/foo.js",
136+
"test-app/lib/index.js",
137+
"test-app/lib/subdir/foo.js",
138+
"test-app/lib/subdir/index.js",
139+
"test-app/lib/subdir/subdir/foo.js",
140+
"test-app/lib/subdir/subdir/index.js",
141141
]);
142142

143143
done();
@@ -146,24 +146,24 @@ describe('Sourcemapify with "base" option', () => {
146146

147147
it('should work in conjunction with the "root" option', done => {
148148
browserify(paths.entryFile, { debug: true })
149-
.plugin(sourcemapify, { base: 'test/test-app/lib', root: 'http://mysite.com/src/' })
149+
.plugin(sourcemapify, { base: "test/test-app/lib", root: "http://mysite.com/src/" })
150150
.bundle()
151151
.pipe(exorcist(paths.mapFile))
152-
.pipe(fs.createWriteStream(paths.bundleFile, 'utf8'))
153-
.on('error', done)
154-
.on('finish', () => {
155-
let sourcemap = JSON.parse(fs.readFileSync(paths.mapFile, 'utf8'));
152+
.pipe(fs.createWriteStream(paths.bundleFile, "utf8"))
153+
.on("error", done)
154+
.on("finish", () => {
155+
let sourcemap = JSON.parse(fs.readFileSync(paths.mapFile, "utf8"));
156156

157157
// Because `root` was an empty string, the sourcemap uses paths that
158158
// are relative to the current directory
159159
sourcemap.sources.should.deep.equal([
160160
paths.preludeFile,
161-
'http://mysite.com/src/foo.js',
162-
'http://mysite.com/src/index.js',
163-
'http://mysite.com/src/subdir/foo.js',
164-
'http://mysite.com/src/subdir/index.js',
165-
'http://mysite.com/src/subdir/subdir/foo.js',
166-
'http://mysite.com/src/subdir/subdir/index.js',
161+
"http://mysite.com/src/foo.js",
162+
"http://mysite.com/src/index.js",
163+
"http://mysite.com/src/subdir/foo.js",
164+
"http://mysite.com/src/subdir/index.js",
165+
"http://mysite.com/src/subdir/subdir/foo.js",
166+
"http://mysite.com/src/subdir/subdir/index.js",
167167
]);
168168

169169
done();

0 commit comments

Comments
 (0)