mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-19 08:08:39 +01: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:
@@ -7,9 +7,9 @@ import { TSESTree } from '@typescript-eslint/typescript-estree';
|
||||
import * as eslint from 'eslint';
|
||||
import { dirname, join, relative } from 'path';
|
||||
import minimatch from 'minimatch';
|
||||
import { createImportRuleListener } from './utils';
|
||||
import { createImportRuleListener } from './utils.ts';
|
||||
|
||||
export = new class implements eslint.Rule.RuleModule {
|
||||
export default new class implements eslint.Rule.RuleModule {
|
||||
|
||||
readonly meta: eslint.Rule.RuleMetaData = {
|
||||
messages: {
|
||||
@@ -30,11 +30,11 @@ export = new class implements eslint.Rule.RuleModule {
|
||||
};
|
||||
|
||||
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
|
||||
let fileRelativePath = relative(dirname(__dirname), context.getFilename());
|
||||
let fileRelativePath = relative(dirname(import.meta.dirname), context.getFilename());
|
||||
if (!fileRelativePath.endsWith('/')) {
|
||||
fileRelativePath += '/';
|
||||
}
|
||||
const ruleArgs = <Record<string, string[]>>context.options[0];
|
||||
const ruleArgs = context.options[0] as Record<string, string[]>;
|
||||
|
||||
const matchingKey = Object.keys(ruleArgs).find(key => fileRelativePath.startsWith(key) || minimatch(fileRelativePath, key));
|
||||
if (!matchingKey) {
|
||||
|
||||
Reference in New Issue
Block a user