Skip to content

Commit 9d05cb6

Browse files
authored
#1231 followup: tslint to prettier: apply formatting changes, remove tslint:disable comments (#1251)
* results of lint-fix * Remove tslint:disable comments * re-run lint-fix after removing tslint:disable comments
1 parent 45a9c63 commit 9d05cb6

88 files changed

Lines changed: 2852 additions & 2339 deletions

Some content is hidden

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

esm.mjs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
import {fileURLToPath} from 'url'
2-
import {createRequire} from 'module'
3-
const require = createRequire(fileURLToPath(import.meta.url))
1+
import { fileURLToPath } from 'url';
2+
import { createRequire } from 'module';
3+
const require = createRequire(fileURLToPath(import.meta.url));
44

55
/** @type {import('./dist/esm')} */
6-
const esm = require('./dist/esm')
7-
export const {resolve, getFormat, transformSource} = esm.registerAndCreateEsmHooks()
6+
const esm = require('./dist/esm');
7+
export const {
8+
resolve,
9+
getFormat,
10+
transformSource,
11+
} = esm.registerAndCreateEsmHooks();

esm/transpile-only.mjs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
import {fileURLToPath} from 'url'
2-
import {createRequire} from 'module'
3-
const require = createRequire(fileURLToPath(import.meta.url))
1+
import { fileURLToPath } from 'url';
2+
import { createRequire } from 'module';
3+
const require = createRequire(fileURLToPath(import.meta.url));
44

55
/** @type {import('../dist/esm')} */
6-
const esm = require('../dist/esm')
7-
export const {resolve, getFormat, transformSource} = esm.registerAndCreateEsmHooks({transpileOnly: true})
6+
const esm = require('../dist/esm');
7+
export const {
8+
resolve,
9+
getFormat,
10+
transformSource,
11+
} = esm.registerAndCreateEsmHooks({ transpileOnly: true });

nyc.config.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
module.exports = {
22
all: true,
3-
include: [
4-
'tests/node_modules/ts-node/**',
5-
],
6-
exclude: [
7-
'**/*.d.ts',
8-
'tests/node_modules/ts-node/node_modules/**',
9-
],
3+
include: ['tests/node_modules/ts-node/**'],
4+
exclude: ['**/*.d.ts', 'tests/node_modules/ts-node/node_modules/**'],
105
excludeNodeModules: false,
11-
excludeAfterRemap: false
6+
excludeAfterRemap: false,
127
};

register/files.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
require('../dist').register({
2-
files: true
3-
})
2+
files: true,
3+
});

register/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
require('../').register()
1+
require('../').register();

register/transpile-only.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
require('../').register({
2-
transpileOnly: true
3-
})
2+
transpileOnly: true,
3+
});

register/type-check.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
require('../').register({
2-
typeCheck: true
3-
})
2+
typeCheck: true,
3+
});

scripts/build-pack.js

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
// Written in JS to support Windows
22
// Would otherwise be written as inline bash in package.json script
33

4-
const { exec } = require('child_process')
5-
const { mkdtempSync, writeFileSync, readFileSync, unlinkSync, rmdirSync, readdirSync } = require('fs')
6-
const { join } = require('path')
4+
const { exec } = require('child_process');
5+
const {
6+
mkdtempSync,
7+
writeFileSync,
8+
readFileSync,
9+
unlinkSync,
10+
rmdirSync,
11+
readdirSync,
12+
} = require('fs');
13+
const { join } = require('path');
714

8-
const testDir = join(__dirname, '../tests')
9-
const tarballPath = join(testDir, 'ts-node-packed.tgz')
10-
const tempDir = mkdtempSync(join(testDir, 'tmp'))
11-
exec(`npm pack --ignore-scripts "${join(__dirname, '..')}"`, { cwd: tempDir }, (err, stdout) => {
12-
if (err) {
13-
console.error(err)
14-
process.exit(1)
15+
const testDir = join(__dirname, '../tests');
16+
const tarballPath = join(testDir, 'ts-node-packed.tgz');
17+
const tempDir = mkdtempSync(join(testDir, 'tmp'));
18+
exec(
19+
`npm pack --ignore-scripts "${join(__dirname, '..')}"`,
20+
{ cwd: tempDir },
21+
(err, stdout) => {
22+
if (err) {
23+
console.error(err);
24+
process.exit(1);
25+
}
26+
const tempTarballPath = join(tempDir, readdirSync(tempDir)[0]);
27+
writeFileSync(tarballPath, readFileSync(tempTarballPath));
28+
unlinkSync(tempTarballPath);
29+
rmdirSync(tempDir);
1530
}
16-
const tempTarballPath = join(tempDir, readdirSync(tempDir)[0])
17-
writeFileSync(tarballPath, readFileSync(tempTarballPath))
18-
unlinkSync(tempTarballPath)
19-
rmdirSync(tempDir)
20-
})
31+
);

scripts/create-merged-schema.ts

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*/
88

99
import axios from 'axios';
10-
import {resolve} from 'path';
11-
import {writeFileSync} from 'fs';
10+
import { resolve } from 'path';
11+
import { writeFileSync } from 'fs';
1212

1313
async function main() {
1414
/** schemastore definition */
@@ -26,27 +26,34 @@ async function main() {
2626
properties: {
2727
'ts-node': {
2828
...typescriptNodeSchema.definitions.TsConfigOptions,
29-
description: typescriptNodeSchema.definitions.TsConfigSchema.properties['ts-node'].description,
29+
description:
30+
typescriptNodeSchema.definitions.TsConfigSchema.properties[
31+
'ts-node'
32+
].description,
3033
properties: {
3134
...typescriptNodeSchema.definitions.TsConfigOptions.properties,
3235
compilerOptions: {
33-
...typescriptNodeSchema.definitions.TsConfigOptions.properties.compilerOptions,
34-
allOf: [{
35-
$ref: '#/definitions/compilerOptionsDefinition/properties/compilerOptions'
36-
}]
37-
}
38-
}
39-
}
40-
}
36+
...typescriptNodeSchema.definitions.TsConfigOptions.properties
37+
.compilerOptions,
38+
allOf: [
39+
{
40+
$ref:
41+
'#/definitions/compilerOptionsDefinition/properties/compilerOptions',
42+
},
43+
],
44+
},
45+
},
46+
},
47+
},
4148
},
4249
},
4350
allOf: [
4451
// Splice into the allOf array at a spot that looks good. Does not affect
4552
// behavior of the schema, but looks nicer if we want to submit as a PR to schemastore.
4653
...schemastoreSchema.allOf.slice(0, 4),
47-
{ "$ref": "#/definitions/tsNodeDefinition" },
54+
{ $ref: '#/definitions/tsNodeDefinition' },
4855
...schemastoreSchema.allOf.slice(4),
49-
]
56+
],
5057
};
5158
writeFileSync(
5259
resolve(__dirname, '../tsconfig.schemastore-schema.json'),
@@ -55,9 +62,11 @@ async function main() {
5562
}
5663

5764
export async function getSchemastoreSchema() {
58-
const {data: schemastoreSchema} = await axios.get(
65+
const {
66+
data: schemastoreSchema,
67+
} = await axios.get(
5968
'https://schemastore.azurewebsites.net/schemas/json/tsconfig.json',
60-
{ responseType: "json" }
69+
{ responseType: 'json' }
6170
);
6271
return schemastoreSchema;
6372
}

scripts/update-schemastore-schema-with-compiler-options.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,18 @@
2323
* in the TypeStrong org.
2424
*/
2525

26-
import {} from 'ts-expose-internals'
27-
import * as ts from 'typescript'
28-
import { getSchemastoreSchema } from './create-merged-schema'
26+
import {} from 'ts-expose-internals';
27+
import * as ts from 'typescript';
28+
import { getSchemastoreSchema } from './create-merged-schema';
2929

3030
// Sometimes schemastore becomes out of date with the latest tsconfig options.
3131
// This script
3232

3333
async function main() {
3434
const schemastoreSchema = await getSchemastoreSchema();
35-
const compilerOptions = schemastoreSchema.definitions.compilerOptionsDefinition.properties.compilerOptions.properties;
35+
const compilerOptions =
36+
schemastoreSchema.definitions.compilerOptionsDefinition.properties
37+
.compilerOptions.properties;
3638

3739
// These options are only available via CLI flags, not in a tsconfig file.
3840
const excludedOptions = [
@@ -48,10 +50,10 @@ async function main() {
4850
'out', // <-- deprecated
4951
];
5052

51-
ts.optionDeclarations.forEach(v => {
52-
if(excludedOptions.includes(v.name)) return;
53+
ts.optionDeclarations.forEach((v) => {
54+
if (excludedOptions.includes(v.name)) return;
5355

54-
if(!compilerOptions[v.name]) {
56+
if (!compilerOptions[v.name]) {
5557
compilerOptions[v.name] = {
5658
description: v.description?.message,
5759
type: v.type,
@@ -60,9 +62,7 @@ async function main() {
6062
});
6163

6264
// Don't write to a file; this is not part of our build process
63-
console.log(
64-
JSON.stringify(schemastoreSchema, null, 2)
65-
);
65+
console.log(JSON.stringify(schemastoreSchema, null, 2));
6666
}
6767

6868
main();

0 commit comments

Comments
 (0)