Skip to content

Commit ffb7917

Browse files
committed
TypeScript code now compiles without errors
1 parent e288f77 commit ffb7917

File tree

3 files changed

+45
-17
lines changed

3 files changed

+45
-17
lines changed

eslint/eslint-bulk/.eslintrc.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// This is a workaround for https://github.com/eslint/eslint/issues/3458
2+
require('local-node-rig/profiles/default/includes/eslint/patch/modern-module-resolution');
3+
// This is a workaround for https://github.com/microsoft/rushstack/issues/3021
4+
require('local-node-rig/profiles/default/includes/eslint/patch/custom-config-package-names');
5+
6+
module.exports = {
7+
extends: [
8+
'local-node-rig/profiles/default/includes/eslint/profile/node-trusted-tool',
9+
'local-node-rig/profiles/default/includes/eslint/mixins/friendly-locals'
10+
],
11+
parserOptions: { tsconfigRootDir: __dirname },
12+
13+
overrides: [
14+
{
15+
files: ['*.ts', '*.tsx'],
16+
rules: {
17+
'no-console': 'off'
18+
}
19+
}
20+
]
21+
};

eslint/eslint-bulk/src/start.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
#!/usr/bin/env node
2-
31
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
42
// See LICENSE in the project root for license information.
5-
const { execSync } = require('child_process');
6-
const fs = require('fs');
7-
const path = require('path');
83

9-
function findPatchPath() {
10-
let eslintrcPath;
4+
import { execSync } from 'child_process';
5+
import * as process from 'process';
6+
import * as fs from 'fs';
7+
import * as path from 'path';
8+
9+
function findPatchPath(): string {
10+
let eslintrcPath: string;
1111
if (fs.existsSync(path.join(process.cwd(), '.eslintrc.js'))) {
1212
eslintrcPath = '.eslintrc.js';
1313
} else if (fs.existsSync(path.join(process.cwd(), '.eslintrc.cjs'))) {
@@ -19,24 +19,24 @@ function findPatchPath() {
1919
process.exit(1);
2020
}
2121

22-
const env = { ...process.env, ESLINT_BULK_FIND: 'true' };
22+
const env: { [key: string]: string } = { ...process.env, ESLINT_BULK_FIND: 'true' };
2323

24-
let stdout;
24+
let stdout: Buffer;
2525
try {
2626
stdout = execSync(`echo "" | eslint --stdin --config ${eslintrcPath}`, { env, stdio: 'pipe' });
2727
} catch (e) {
2828
console.error('@rushstack/eslint-bulk: Error finding patch path: ' + e.message);
2929
process.exit(1);
3030
}
3131

32-
const startDelimiter = 'ESLINT_BULK_STDOUT_START';
33-
const endDelimiter = 'ESLINT_BULK_STDOUT_END';
32+
const startDelimiter: string = 'ESLINT_BULK_STDOUT_START';
33+
const endDelimiter: string = 'ESLINT_BULK_STDOUT_END';
3434

35-
const regex = new RegExp(`${startDelimiter}(.*?)${endDelimiter}`);
36-
const match = stdout.toString().match(regex);
35+
const regex: RegExp = new RegExp(`${startDelimiter}(.*?)${endDelimiter}`);
36+
const match: RegExpMatchArray | null = stdout.toString().match(regex);
3737

3838
if (match) {
39-
const filePath = match[1].trim();
39+
const filePath: string = match[1].trim();
4040
return filePath;
4141
}
4242

@@ -46,10 +46,10 @@ function findPatchPath() {
4646
process.exit(1);
4747
}
4848

49-
const patchPath = findPatchPath();
49+
const patchPath: string = findPatchPath();
5050
try {
51-
const args = process.argv.slice(2).join(' ');
52-
const command = `node ${patchPath} ${args}`;
51+
const args: string = process.argv.slice(2).join(' ');
52+
const command: string = `node ${patchPath} ${args}`;
5353
execSync(command, { stdio: 'inherit' });
5454
} catch (e) {
5555
console.error(`@rushstack/eslint-bulk: Error running patch at ${patchPath}:\n` + e.message);

eslint/eslint-bulk/tsconfig.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./node_modules/local-node-rig/profiles/default/tsconfig-base.json",
3+
4+
"compilerOptions": {
5+
"types": ["node"]
6+
}
7+
}

0 commit comments

Comments
 (0)