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

@@ -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) {