diff --git a/src/index.ts b/src/index.ts index bceefac..c176a8f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,8 @@ import { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; -import enforceColumnTypes from './rules/enforce-column-types'; -import enforceConsistentNullability from './rules/enforce-consistent-nullability'; -import enforceRelationTypes from './rules/enforce-relation-types'; +import enforceColumnTypes from './rules/enforce-column-types.js'; +import enforceConsistentNullability from './rules/enforce-consistent-nullability.js'; +import enforceRelationTypes from './rules/enforce-relation-types.js'; +import recommended from './recommended.js'; export const rules = { 'enforce-column-types': enforceColumnTypes, @@ -17,4 +18,6 @@ export const plugin: FlatConfig.Plugin = { rules, }; +export { recommended }; + export default plugin; diff --git a/src/recommended.ts b/src/recommended.ts index 3764ab2..35388f4 100644 --- a/src/recommended.ts +++ b/src/recommended.ts @@ -1,5 +1,5 @@ import { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; -import plugin from './index'; +import { plugin } from './index.js'; const config: FlatConfig.Config = { plugins: { diff --git a/src/rules/enforce-column-types.test.ts b/src/rules/enforce-column-types.test.ts index c21382c..022b451 100644 --- a/src/rules/enforce-column-types.test.ts +++ b/src/rules/enforce-column-types.test.ts @@ -2,7 +2,7 @@ import path from 'path'; import * as vitest from 'vitest'; import tsParser from '@typescript-eslint/parser'; import { RuleTester } from '@typescript-eslint/rule-tester'; -import enforceColumnTypes from './enforce-column-types'; +import enforceColumnTypes from './enforce-column-types.js'; RuleTester.afterAll = vitest.afterAll; RuleTester.it = vitest.it; diff --git a/src/rules/enforce-column-types.ts b/src/rules/enforce-column-types.ts index 57bea9f..4db42bc 100644 --- a/src/rules/enforce-column-types.ts +++ b/src/rules/enforce-column-types.ts @@ -11,8 +11,8 @@ import { convertTypeToColumnType, isTypesEqual, typeToString, -} from '../utils/columnType'; -import { findEitherDecoratorArguments, findParentClass } from '../utils/treeTraversal'; +} from '../utils/columnType.js'; +import { findEitherDecoratorArguments, findParentClass } from '../utils/treeTraversal.js'; const createRule = ESLintUtils.RuleCreator( (name) => diff --git a/src/rules/enforce-consistent-nullability.test.ts b/src/rules/enforce-consistent-nullability.test.ts index 3a55b43..927f483 100644 --- a/src/rules/enforce-consistent-nullability.test.ts +++ b/src/rules/enforce-consistent-nullability.test.ts @@ -2,7 +2,7 @@ import path from 'path'; import * as vitest from 'vitest'; import tsParser from '@typescript-eslint/parser'; import { RuleTester } from '@typescript-eslint/rule-tester'; -import enforceConsistentNullability from './enforce-consistent-nullability'; +import enforceConsistentNullability from './enforce-consistent-nullability.js'; RuleTester.afterAll = vitest.afterAll; RuleTester.it = vitest.it; diff --git a/src/rules/enforce-consistent-nullability.ts b/src/rules/enforce-consistent-nullability.ts index a60413c..0d58d28 100644 --- a/src/rules/enforce-consistent-nullability.ts +++ b/src/rules/enforce-consistent-nullability.ts @@ -3,7 +3,7 @@ import { findEitherDecoratorArguments, findParentClass, parseObjectLiteral, -} from '../utils/treeTraversal'; +} from '../utils/treeTraversal.js'; type ErrorMessages = | 'typescript_typeorm_missing_nullability' diff --git a/src/rules/enforce-relation-types.test.ts b/src/rules/enforce-relation-types.test.ts index 09c6cb4..2b322d3 100644 --- a/src/rules/enforce-relation-types.test.ts +++ b/src/rules/enforce-relation-types.test.ts @@ -2,7 +2,7 @@ import path from 'path'; import * as vitest from 'vitest'; import tsParser from '@typescript-eslint/parser'; import { RuleTester } from '@typescript-eslint/rule-tester'; -import enforceRelationTypes from './enforce-relation-types'; +import enforceRelationTypes from './enforce-relation-types.js'; RuleTester.afterAll = vitest.afterAll; RuleTester.it = vitest.it; diff --git a/src/rules/enforce-relation-types.ts b/src/rules/enforce-relation-types.ts index ce8f17d..697227f 100644 --- a/src/rules/enforce-relation-types.ts +++ b/src/rules/enforce-relation-types.ts @@ -4,7 +4,7 @@ import { findEitherDecoratorArguments, findObjectArgument, findParentClass, -} from '../utils/treeTraversal'; +} from '../utils/treeTraversal.js'; import { convertArgumentToRelationType, convertTypeToRelationType, @@ -12,7 +12,7 @@ import { typeToString, isTypeMissingNullable, isTypeMissingArray, -} from '../utils/relationType'; +} from '../utils/relationType.js'; const createRule = ESLintUtils.RuleCreator( (name) => diff --git a/src/utils/columnType.ts b/src/utils/columnType.ts index 69197a4..5e750e0 100644 --- a/src/utils/columnType.ts +++ b/src/utils/columnType.ts @@ -8,7 +8,7 @@ import { UnionTypeNode, isTypeReferenceNode, } from 'typescript'; -import { parseObjectLiteral } from './treeTraversal'; +import { parseObjectLiteral } from './treeTraversal.js'; type Column = | 'Column' diff --git a/src/utils/relationType.ts b/src/utils/relationType.ts index a400aa3..88da850 100644 --- a/src/utils/relationType.ts +++ b/src/utils/relationType.ts @@ -1,5 +1,5 @@ import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils'; -import { findObjectArgument, findReturnedValue, parseObjectLiteral } from './treeTraversal'; +import { findObjectArgument, findReturnedValue, parseObjectLiteral } from './treeTraversal.js'; interface RelationType { name: string;