Skip to content

Commit

Permalink
Add extensions to imports to prepare for ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel7grant committed Aug 5, 2024
1 parent 1250d52 commit f0655d8
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 14 deletions.
9 changes: 6 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -17,4 +18,6 @@ export const plugin: FlatConfig.Plugin = {
rules,
};

export { recommended };

export default plugin;
2 changes: 1 addition & 1 deletion src/recommended.ts
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/enforce-column-types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/rules/enforce-column-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down
2 changes: 1 addition & 1 deletion src/rules/enforce-consistent-nullability.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/rules/enforce-consistent-nullability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
findEitherDecoratorArguments,
findParentClass,
parseObjectLiteral,
} from '../utils/treeTraversal';
} from '../utils/treeTraversal.js';

type ErrorMessages =
| 'typescript_typeorm_missing_nullability'
Expand Down
2 changes: 1 addition & 1 deletion src/rules/enforce-relation-types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/rules/enforce-relation-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import {
findEitherDecoratorArguments,
findObjectArgument,
findParentClass,
} from '../utils/treeTraversal';
} from '../utils/treeTraversal.js';
import {
convertArgumentToRelationType,
convertTypeToRelationType,
isTypesEqual,
typeToString,
isTypeMissingNullable,
isTypeMissingArray,
} from '../utils/relationType';
} from '../utils/relationType.js';

const createRule = ESLintUtils.RuleCreator(
(name) =>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/columnType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
UnionTypeNode,
isTypeReferenceNode,
} from 'typescript';
import { parseObjectLiteral } from './treeTraversal';
import { parseObjectLiteral } from './treeTraversal.js';

type Column =
| 'Column'
Expand Down
2 changes: 1 addition & 1 deletion src/utils/relationType.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit f0655d8

Please sign in to comment.