Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-require-extensions

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-require-extensions

TypeScript [doesn't transform extensions](https://github.com/microsoft/TypeScript/issues/16577) and [doesn't enforce file extensions](https://github.com/microsoft/TypeScript/issues/42813).

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
64K
decreased by-1.18%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-require-extensions

TypeScript doesn't transform extensions and doesn't enforce file extensions.

This is a simple eslint plugin that ensures that relative imports and exports have .js extensions.

Credit for the original implementation goes to johnrees. ❤️

  1. Install
npm install --save-dev eslint-plugin-require-extensions
  1. Edit .eslintrc
{
    "extends": [
        "plugin:require-extensions/recommended"
    ],
    "plugins": [
        "require-extensions"
    ]
}
  1. Code
// source.js

import Target from './target';
  1. Lint
eslint .
source.js
  1:1  error  Relative imports and exports must end with .js  require-extensions/require-extensions
  1. Fix
eslint --fix .
// source.js

import Target from './target.js';

FAQs

Package last updated on 31 Jan 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc