Skip to content

Commit 4afe3af

Browse files
committed
style: switch to @tivac/eslint-config
And then run a massive `eslint --fix`
1 parent d695c88 commit 4afe3af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+513
-569
lines changed

.eslintrc.js

+14-66
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,18 @@
11
module.exports = {
2-
"extends": [
3-
"@tivac",
4-
"plugin:jest/recommended"
5-
],
6-
"parserOptions": {
7-
"ecmaVersion": 8
8-
},
9-
"env": {
10-
"node": true,
11-
"jest": true
12-
},
13-
"plugins": [
14-
"jest"
15-
],
16-
"rules": {
17-
"one-var": [
18-
"warn",
19-
{
20-
"var": "always",
21-
"let": "never",
22-
"const": "never"
23-
}
2+
extends : [
3+
"@tivac",
4+
"plugin:jest/recommended",
245
],
25-
"keyword-spacing": [
26-
"warn",
27-
{
28-
"before": true,
29-
"after": false,
30-
"overrides": {
31-
"return": {
32-
"after": true
33-
},
34-
"else": {
35-
"after": true
36-
},
37-
"try": {
38-
"after": true
39-
},
40-
"case": {
41-
"after": true
42-
},
43-
"from": {
44-
"after": true
45-
},
46-
"import": {
47-
"after": true
48-
},
49-
"export": {
50-
"after": true
51-
},
52-
"const": {
53-
"after": true
54-
},
55-
"let": {
56-
"after": true
57-
}
58-
}
59-
}
60-
],
61-
"space-before-function-paren": [
62-
"warn",
63-
{
64-
"anonymous": "never",
65-
"named": "never",
66-
"asyncArrow": "always"
67-
}
6+
parserOptions : {
7+
ecmaVersion : 8,
8+
},
9+
env : {
10+
node : true,
11+
jest : true,
12+
es6 : true,
13+
},
14+
15+
plugins : [
16+
"jest",
6817
]
69-
}
7018
};

jest.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ module.exports = {
44
coveragePathIgnorePatterns : [
55
"node_modules",
66
"parsers",
7-
"test-utils"
7+
"test-utils",
88
],
99

1010
watchPathIgnorePatterns : [
1111
"output",
1212
"specimens",
13-
]
13+
],
1414
};

package-lock.json

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
"watch": "jest --watch"
2323
},
2424
"devDependencies": {
25+
"@tivac/eslint-config": "^2.2.0",
2526
"browserify": "^16.2.0",
2627
"cli-tester": "^2.0.0",
2728
"cssnano": "^4.0.0-rc.1",
2829
"dedent": "^0.7.0",
2930
"dentist": "^1.0.3",
3031
"eslint": "^5.0.0",
31-
"eslint-config-arenanet": "^3.3.1",
3232
"eslint-plugin-jest": "^21.17.0",
3333
"factor-bundle": "^2.5.0",
3434
"from2-string": "^1.1.0",

packages/aliases/aliases.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = function(args) {
1111
aliases = Object.keys(options.aliases)
1212
.map((alias) => ({
1313
name : alias,
14-
search : new RegExp(`^${alias}\\b`)
14+
search : new RegExp(`^${alias}\\b`),
1515
}));
1616

1717
return (src, file) => {

packages/aliases/test/aliases.test.js

+24-24
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
11
"use strict";
22

3-
var dedent = require("dentist").dedent,
3+
const { dedent } = require("dentist");
44

5-
Processor = require("modular-css-core"),
6-
namer = require("test-utils/namer.js"),
5+
const Processor = require("modular-css-core");
6+
const namer = require("test-utils/namer.js");
77

8-
aliases = require("../aliases.js");
8+
const aliases = require("../aliases.js");
99

10-
describe("modular-css-aliases", function() {
11-
it("should return a falsey value if a file isn't found", function() {
10+
describe("modular-css-aliases", () => {
11+
it("should return a falsey value if a file isn't found", () => {
1212
var fn = aliases({
1313
aliases : {
14-
specimens : "./packages/aliases/test/specimens"
15-
}
14+
specimens : "./packages/aliases/test/specimens",
15+
},
1616
});
1717

1818
expect(fn(".", "specimens/fooga.css")).toBeFalsy();
1919
});
2020

21-
it("should return the absolute path if a file is found", function() {
21+
it("should return the absolute path if a file is found", () => {
2222
var fn = aliases({
2323
aliases : {
24-
one : "./packages/aliases/test/specimens/one"
25-
}
24+
one : "./packages/aliases/test/specimens/one",
25+
},
2626
});
2727

2828
expect(fn(".", "one/one.css")).toBe(require.resolve("./specimens/one/one.css"));
2929
});
3030

31-
it("should check multiple aliases for files & return the first match", function() {
31+
it("should check multiple aliases for files & return the first match", () => {
3232
var fn = aliases({
3333
aliases : {
3434
one : "./packages/aliases/test/specimens/one",
3535
two : "./packages/aliases/test/specimens/two",
36-
sub : "./packages/aliases/test/specimens/one/sub"
37-
}
36+
sub : "./packages/aliases/test/specimens/one/sub",
37+
},
3838
});
3939

4040
expect(fn(".", "one/one.css")).toBe(require.resolve("./specimens/one/one.css"));
4141
expect(fn(".", "sub/sub.css")).toBe(require.resolve("./specimens/one/sub/sub.css"));
4242
});
4343

44-
it("should be usable as a modular-css resolver", function() {
44+
it("should be usable as a modular-css resolver", () => {
4545
var processor = new Processor({
4646
namer,
4747
resolvers : [
4848
aliases({
4949
aliases : {
5050
sub : "./packages/aliases/test/specimens/one/sub",
51-
two : "./packages/aliases/test/specimens/two"
52-
}
53-
})
54-
]
51+
two : "./packages/aliases/test/specimens/two",
52+
},
53+
}),
54+
],
5555
});
5656

5757
return processor.string(
@@ -70,16 +70,16 @@ describe("modular-css-aliases", function() {
7070
);
7171
});
7272

73-
it("should fall through to the default resolver", function() {
73+
it("should fall through to the default resolver", () => {
7474
var processor = new Processor({
7575
namer,
7676
resolvers : [
7777
aliases({
7878
aliases : {
79-
two : "./packages/aliases/test/specimens/two"
80-
}
81-
})
82-
]
79+
two : "./packages/aliases/test/specimens/two",
80+
},
81+
}),
82+
],
8383
});
8484

8585
return processor.string(

packages/browserify/browserify.js

+15-16
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module.exports = function(browserify, opts) {
3535
ext : ".css",
3636
map : browserify._options.debug,
3737
cwd : browserify._options.basedir || process.cwd(),
38-
cache : true
38+
cache : true,
3939
}, opts),
4040

4141
processor = options.cache && new Processor(options),
@@ -55,7 +55,7 @@ module.exports = function(browserify, opts) {
5555
function write(files, to) {
5656
return processor.output({
5757
files,
58-
to
58+
to,
5959
})
6060
.then((result) => {
6161
fs.writeFileSync(to, result.css, "utf8");
@@ -71,7 +71,7 @@ module.exports = function(browserify, opts) {
7171
.catch((error) => bundler.emit("error", error));
7272
}
7373

74-
browserify.transform(function(file) {
74+
browserify.transform((file) => {
7575
if(path.extname(file) !== options.ext) {
7676
return through();
7777
}
@@ -81,7 +81,7 @@ module.exports = function(browserify, opts) {
8181
real = fs.realpathSync(file);
8282

8383
processor.string(real, buffer).then(
84-
function(result) {
84+
(result) => {
8585
// Tell watchers about dependencies by emitting "file" events
8686
// AFAIK this is only useful to watchify, to ensure that it watches
8787
// everyone in the dependency graph
@@ -94,7 +94,7 @@ module.exports = function(browserify, opts) {
9494
done();
9595
},
9696

97-
function(error) {
97+
(error) => {
9898
// Thrown from the current bundler instance, NOT the main browserify
9999
// instance. This is so that watchify won't explode.
100100
bundler.emit("error", error);
@@ -108,7 +108,7 @@ module.exports = function(browserify, opts) {
108108
});
109109

110110
// Splice ourselves as early as possible into the deps pipeline
111-
browserify.pipeline.get("deps").splice(1, 0, through.obj(function(row, enc, done) {
111+
browserify.pipeline.get("deps").splice(1, 0, through.obj((row, enc, done) => {
112112
if(path.extname(row.file) !== options.ext) {
113113
return done(null, row);
114114
}
@@ -125,7 +125,7 @@ module.exports = function(browserify, opts) {
125125
// injected into the stream of files being managed
126126
var push = this.push.bind(this);
127127

128-
processor.dependencies().forEach(function(dep) {
128+
processor.dependencies().forEach((dep) => {
129129
if(dep in handled) {
130130
return;
131131
}
@@ -134,20 +134,20 @@ module.exports = function(browserify, opts) {
134134
id : path.resolve(options.cwd, dep),
135135
file : path.resolve(options.cwd, dep),
136136
source : exports(processor.files[dep]),
137-
deps : processor.dependencies(dep).reduce(depReducer, {})
137+
deps : processor.dependencies(dep).reduce(depReducer, {}),
138138
});
139139
});
140140

141141
done();
142142
}));
143143

144144
// Keep tabs on factor-bundle organization
145-
browserify.on("factor.pipeline", function(file, pipeline) {
145+
browserify.on("factor.pipeline", (file, pipeline) => {
146146
bundles[file] = [];
147147

148148
// Track the files in each bundle so we can determine commonalities
149149
// Doesn't actually modify the file, just records it
150-
pipeline.unshift(through.obj(function(obj, enc, done) {
150+
pipeline.unshift(through.obj((obj, enc, done) => {
151151
if(path.extname(obj.file) === options.ext) {
152152
bundles[file].unshift(obj.file);
153153
}
@@ -158,11 +158,11 @@ module.exports = function(browserify, opts) {
158158

159159
// Watchify fires update events when files change, this tells the processor
160160
// to remove the changed files from its cache so they will be re-processed
161-
browserify.on("update", function(files) {
161+
browserify.on("update", (files) => {
162162
processor.remove(files);
163163
});
164164

165-
return browserify.on("bundle", function(current) {
165+
return browserify.on("bundle", (current) => {
166166
// Calls to .bundle() means we should recreate anything tracking bundling progress
167167
// in case things have changed out from under us, like when using watchify
168168
bundles = {};
@@ -176,7 +176,7 @@ module.exports = function(browserify, opts) {
176176
bundler = current;
177177

178178
// Listen for bundling to finish
179-
bundler.on("end", function() {
179+
bundler.on("end", () => {
180180
var bundling = Object.keys(bundles).length > 0,
181181
common;
182182

@@ -201,11 +201,10 @@ module.exports = function(browserify, opts) {
201201
each(
202202
Object.keys(bundles).map((key) => ({
203203
bundle : key,
204-
files : bundles[key]
204+
files : bundles[key],
205205
})),
206206
(details) => {
207-
var bundle = details.bundle,
208-
files = details.files,
207+
var { bundle, files } = details,
209208
dest;
210209

211210
if(!files.length && !options.empty) {

0 commit comments

Comments
 (0)