mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-25 04:36:23 +00:00
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:
20
.eslint-plugin-local/index.ts
Normal file
20
.eslint-plugin-local/index.ts
Normal 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 };
|
||||
Reference in New Issue
Block a user