Skip to content

Commit ddc025d

Browse files
authored
style: update eslint and format code with it (#63)
1 parent de1deed commit ddc025d

File tree

5 files changed

+418
-307
lines changed

5 files changed

+418
-307
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": ["teppeis/node-v6", "teppeis/+prettier", "teppeis/+mocha"]
2+
"extends": ["teppeis/node-v8", "teppeis/+prettier", "teppeis/+mocha"]
33
}

guess.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
'use strict';
1+
"use strict";
22

3-
const path = require('path');
4-
const ts = require('typescript');
3+
const path = require("path");
4+
const ts = require("typescript");
55

66
const cwd = process.cwd();
77
const compilerOptions = loadCompilerOptions(cwd) || {};
8-
const extensions = ['ts', 'tsx'];
8+
const extensions = ["ts", "tsx"];
99
if (compilerOptions.allowJs) {
10-
extensions.push('js');
11-
extensions.push('jsx');
10+
extensions.push("js");
11+
extensions.push("jsx");
1212
}
1313

14-
let testDir = 'test';
15-
const packageData = require(path.join(cwd, 'package.json'));
14+
let testDir = "test";
15+
const packageData = require(path.join(cwd, "package.json"));
1616
if (
1717
packageData &&
18-
typeof packageData.directories === 'object' &&
19-
typeof packageData.directories.test === 'string'
18+
typeof packageData.directories === "object" &&
19+
typeof packageData.directories.test === "string"
2020
) {
2121
testDir = packageData.directories.test;
2222
}
23-
const pattern = path.join(testDir, `**/*.@(${extensions.join('|')})`);
23+
const pattern = path.join(testDir, `**/*.@(${extensions.join("|")})`);
2424

25-
require('./index')({cwd, pattern, extensions});
25+
require("./index")({ cwd, pattern, extensions });
2626

2727
function loadCompilerOptions(cwd) {
2828
const tsconfigPath = ts.findConfigFile(cwd, ts.sys.fileExists);
@@ -35,7 +35,7 @@ function loadCompilerOptions(cwd) {
3535
}
3636
if (result.config && result.config.compilerOptions) {
3737
const basepath = path.dirname(tsconfigPath);
38-
const {options} = ts.parseJsonConfigFileContent(result.config, ts.sys, basepath);
38+
const { options } = ts.parseJsonConfigFileContent(result.config, ts.sys, basepath);
3939
return options;
4040
}
4141
return null;

index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
/* eslint node/no-deprecated-api: [error, {ignoreGlobalItems: ["require.extensions"]}] */
22

3-
'use strict';
3+
"use strict";
44

5-
const path = require('path');
6-
const espowerSource = require('espower-source');
7-
const minimatch = require('minimatch');
8-
const sourceMapSupport = require('source-map-support');
9-
const tsNodeRegister = require('ts-node').register;
5+
const path = require("path");
6+
const espowerSource = require("espower-source");
7+
const minimatch = require("minimatch");
8+
const sourceMapSupport = require("source-map-support");
9+
const tsNodeRegister = require("ts-node").register;
1010
const sourceCache = {};
1111

1212
function espowerTypeScript(options, tsNodeOptions) {
1313
tsNodeRegister(tsNodeOptions);
1414

1515
// install source-map-support again to correct the source-map
1616
sourceMapSupport.install({
17-
environment: 'node',
17+
environment: "node",
1818
retrieveFile: path => sourceCache[path],
1919
});
2020

21-
const {extensions = ['ts', 'tsx']} = options;
21+
const { extensions = ["ts", "tsx"] } = options;
2222
extensions.forEach(ext => {
2323
espowerTsRegister(`.${ext}`, options);
2424
});

0 commit comments

Comments
 (0)