Run TS eslint rules directly with strip-types

Wth node 20.18, we can now run these typescript files directly instead of having to use ts-node
This commit is contained in:
Matt Bierner
2025-11-14 14:38:15 -08:00
parent 18279e23d7
commit b8329a3ffc
44 changed files with 127 additions and 136 deletions

View File

@@ -0,0 +1,20 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { LooseRuleDefinition } from '@typescript-eslint/utils/ts-eslint';
import glob from 'glob';
import { createRequire } from 'module';
import path from 'path';
const require = createRequire(import.meta.url);
// Re-export all .ts files as rules
const rules: Record<string, LooseRuleDefinition> = {};
glob.sync(`${import.meta.dirname}/*.ts`)
.filter(file => !file.endsWith('index.ts') && !file.endsWith('utils.ts'))
.map(file => {
rules[path.basename(file, '.ts')] = require(file).default;
});
export { rules };