Socket
Socket
Sign inDemoInstall

eslint-plugin-require

Package Overview
Dependencies
88
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    eslint-plugin-require

ESLint rules for enforcing specified uses of RequireJS.


Version published
Weekly downloads
831
decreased by-30.92%
Maintainers
1
Install size
18.3 kB
Created
Weekly downloads
 

Readme

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

Last updated on 16 Dec 2014

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc