![pnpm 9.5 Introduces Catalogs: Shareable Dependency Version Specifiers](https://cdn.sanity.io/images/cgdhsj6q/production/c06a5b74512bcc6da29d38cef96a454fa947810d-1024x1024.webp?w=400&fit=max&auto=format)
Security News
pnpm 9.5 Introduces Catalogs: Shareable Dependency Version Specifiers
pnpm 9.5 introduces a Catalogs feature, enabling shareable dependency version specifiers, reducing merge conflicts and improving support for monorepos.
eslint-plugin-file-extension-in-import-ts
Advanced tools
Readme
This is small patch to the great rule:
file-extension-in-import
from eslint-plugin-node module.
Author of code:
I've just added mapping functionality.
When we use type module we must add extension to the file
import foo from "./path/to/a/file"
It's a bad practice
import eslint from "eslint"
import foo from "./path/to/a/file.js"
It's a good practice.
node/file-extension-in-import rule raise error when we forgot to add extension to the import. But it doesn't work with Typescript.
When we use Typescript we can't add .ts extension to the file. It won't be process with Typescript compiler. In this case we need to add .js extension.
In this case we need to replace .ts extension to .js.
In this plugin I will add possibility to make mapping for extensions:
'file-extension-in-import-ts/file-extension-in-import-ts': [
'error',
'always',
{ extMapping: {'.ts': '.js' } }
]
It means, this rule will fix our ts files to .js extension in import statement.
import module from './my-module';
will be changed to:
import module from './my-module/index.js';
npm i -D eslint-plugin-file-extension-in-import-ts
{
"plugins": [
"file-extension-in-import-ts"
],
"rules": {
"file-extension-in-import-ts/file-extension-in-import-ts": "error"
}
}
By default, the plugin will process mapping:
This plugin has conflict with eslint-import-plugin, the rule: import/no-unresolved rule
To quick fix it we can skip '.js' (in the folder with TS sources JS files are not existing).
'import/no-unresolved': ['error', { ignore: [ '\\.js$' ] }],
Copyright (c)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Unknown package
We found that eslint-plugin-file-extension-in-import-ts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
pnpm 9.5 introduces a Catalogs feature, enabling shareable dependency version specifiers, reducing merge conflicts and improving support for monorepos.
Security News
A threat actor on BreachForums is selling an unverified npm vulnerability for account takeover, but npm has not officially confirmed the existence of this security concern.
Security News
Cyber insurance rates are dropping as the market matures, according to a new report projecting global premiums to reach $43 billion by 2030, driven by international market uptake and growth in the SME sector.