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

@@ -5,14 +5,14 @@
import * as eslint from 'eslint';
import { join, dirname } from 'path';
import { createImportRuleListener } from './utils';
import { createImportRuleListener } from './utils.ts';
type Config = {
allowed: Set<string>;
disallowed: Set<string>;
};
export = new class implements eslint.Rule.RuleModule {
export default new class implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
messages: {
@@ -38,9 +38,7 @@ export = new class implements eslint.Rule.RuleModule {
const fileDirname = dirname(context.getFilename());
const parts = fileDirname.split(/\\|\//);
const ruleArgs = <Record<string, string[]>>context.options[0];
let config: Config | undefined;
const ruleArgs = context.options[0] as Record<string, string[]>; let config: Config | undefined;
for (let i = parts.length - 1; i >= 0; i--) {
if (ruleArgs[parts[i]]) {
config = {
@@ -91,4 +89,3 @@ export = new class implements eslint.Rule.RuleModule {
});
}
};