import-js/eslint-plugin-import
View on GitHubNo errors for TypeScript `import` types
Open
#1,675 opened on Mar 3, 2020
enhancementhelp wantedtypescript
Description
Docs on import types: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html#import-types
Reduced test case (all dependencies are latest):
// ./cypress/test.ts
// Expected error, got one
// Unexpected path "../app/helpers/api" imported in restricted zone
import Api from '../app/helpers/api';
// Expected error, but got none
type Api = typeof import('../app/helpers/api');
// .eslintrc.js
const config = {
extends: ['plugin:import/typescript'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
},
plugins: ['import'],
rules: {
'import/no-restricted-paths': [
2,
{
basePath: '.',
zones: [
{
target: './cypress',
from: './app',
},
],
},
],
},
}
module.exports = config;