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

eslint-plugin-require

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-require

ESLint rules for enforcing specified uses of RequireJS.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Build Status

eslint-plugin-require

ESLint rules for enforcing specified patterns of use of RequireJS and compatible AMD module loaders.

Why Use It

RequireJS provides great ways to manage, optimize, and asynchronously load dependencies, but it can be easy to make a few different types of mistakes when using it:

  • Calling require('dependency-name', cb) to load a dependency, when what you meant was require(['dependency-name'], cb).
    • require-array-syntax can be used to mitigate this issue by enforcing that the first argument to require() is always an array.
  • Forgetting to wrap your module in a define() call or accidentally wrapping it in a require() call instead.
    • require-define enforces that all files be a strict subset of AMD that always starts with a define() statement.
  • Using inner require() statements for things you had intended to optimize into one file as part of your build.
    • require-module-prefix mitigates this issue by enforcing that require() statements reference files with a common prefix, e.g.: "modules/". This supports a project structure wherein independently-loadable modules live in a "modules/" folder and can be optimized by the r.js loader to contain all their dependencies in one file, while still being dynamically loadable by other modules.

Getting Started

Documentation for each rule can be found in docs/rules.

Further Reading

Keywords

FAQs

Package last updated on 16 Dec 2014

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