Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
eslint-import-resolver-typescript
Advanced tools
TypeScript .ts .tsx module resolver for `eslint-plugin-import`.
The eslint-import-resolver-typescript package is a plugin for ESLint that helps in resolving import paths for TypeScript files. It allows ESLint to understand TypeScript syntax and resolve paths according to the TypeScript compiler options. This is particularly useful when using features like path aliases and custom module directories in TypeScript projects.
Resolving TypeScript Path Aliases
This feature allows the resolver to use TypeScript's path aliases defined in tsconfig.json to resolve modules, which helps ESLint to understand custom path mappings.
module.exports = {
settings: {
'import/resolver': {
typescript: {
// use <root>/tsconfig.json
project: '.'
}
}
}
};
Support for Multiple tsconfig Files
The resolver can be configured to use multiple tsconfig.json files, which is useful in monorepos or projects with multiple TypeScript configurations.
module.exports = {
settings: {
'import/resolver': {
typescript: {
// a list of tsconfig.json to use
project: ['tsconfig.json', 'packages/*/tsconfig.json']
}
}
}
};
Ignoring TypeScript Errors
This feature allows the resolver to ignore TypeScript errors when resolving paths. It is useful when you want ESLint to focus on import/export issues without being blocked by TypeScript compilation errors.
module.exports = {
settings: {
'import/resolver': {
typescript: {
// ignore TypeScript errors
alwaysTryTypes: true
}
}
}
};
This package provides a resolver for the ESLint plugin import that resolves node modules and commonjs modules. It does not have TypeScript-specific features but is suitable for projects using plain JavaScript.
This resolver is designed for projects using Webpack and allows ESLint to resolve module paths based on the Webpack configuration. It supports features like Webpack aliases and modules, which can be similar to TypeScript path aliases but is tailored for Webpack-specific configurations.
This package integrates with Babel and allows ESLint to resolve modules using Babel's module resolver plugin. It is similar to eslint-import-resolver-typescript in that it helps resolve non-standard module paths, but it is focused on Babel rather than TypeScript.
This plugin allows you to use eslint-plugin-import
with .ts
and .tsx
files.
npm install --save-dev eslint-import-resolver-typescript
Add the following to your eslint config:
"settings": {
"import/resolver": {
"node": true,
"eslint-import-resolver-typescript": true
}
}
FAQs
This plugin adds `TypeScript` support to `eslint-plugin-import`
The npm package eslint-import-resolver-typescript receives a total of 7,574,415 weekly downloads. As such, eslint-import-resolver-typescript popularity was classified as popular.
We found that eslint-import-resolver-typescript demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.