File: no-multiple-define.md

package info (click to toggle)
node-eslint-plugin-requirejs 4.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 936 kB
  • sloc: javascript: 4,676; perl: 48; makefile: 31; sh: 1
file content (28 lines) | stat: -rw-r--r-- 646 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Disallow multiple module definitions in one file (no-multiple-define)

Due to how RequireJS' lookup algorithm works, only one module should be defined per file.

## Rule Details

This rule aims to prevent definition of multiple modules in one file.

The following pattern is considered a warning:

```js
// MyModule.js
define('MyModule/first', ['path/to/foo'], function (foo) {
    /* ... */
});

define('MyModule/second', ['path/to/bar'], function (bar) {
    /* ... */
});
```

## When Not To Use It

You should probably *not* disable this rule.

## Further Reading

* [RequireJS Module Notes](http://requirejs.org/docs/api.html#modulenotes)