Skip to content

Commit

Permalink
Add missing import extension, check with lint
Browse files Browse the repository at this point in the history
Some pure-ESM processors (eg, `tsc` with `moduleResolution: 'nodenext')
require extensions on all imports. #4778 added two import-less
extensions. This PR fixes them and adds linting (from an
already-installed plugin) to catch future errors. Test execution does
not appear to require these extensions so we only check non-test files
(there's another 17 errors to fix if you want to check tests too).
  • Loading branch information
glasser committed Oct 28, 2022
1 parent 0f149dc commit a4002e6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ module.exports = {
parserOptions: {
project: './tsconfig.json',
},
extends: ['eslint:recommended', 'standard', 'prettier', 'plugin:@typescript-eslint/recommended'],
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'standard',
'prettier',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
],
plugins: ['@typescript-eslint', 'import'],
rules: {
'no-empty': 'off',
'no-console': 'off',
Expand Down Expand Up @@ -94,6 +100,11 @@ module.exports = {
'promise/param-names': 'off',
},
},
{
files: ['**/*.ts'],
excludedFiles: ['**/{test,tests,testing}/**/*.{ts,js}', '*.{spec,test}.{ts,js}'],
rules: { 'import/extensions': ['error', 'ignorePackages'] },
},
],
ignorePatterns: [
'dist',
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/Path.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Maybe } from './types';
import { Maybe } from './types.js';

export interface Path {
readonly prev: Path | undefined;
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/jsutils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MaybePromise } from './executor';
import { MaybePromise } from './executor.js';

export function isIterableObject(value: unknown): value is Iterable<unknown> {
return value != null && typeof value === 'object' && Symbol.iterator in value;
Expand Down

0 comments on commit a4002e6

Please sign in to comment.