Skip to content

Commit df166ed

Browse files
author
Casey Visco
committed
New: Export plugin:requirejs/recommended config
1 parent 506a673 commit df166ed

File tree

2 files changed

+46
-25
lines changed

2 files changed

+46
-25
lines changed

README.md

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -56,38 +56,45 @@ Enable the rules that you would like to use, for example:
5656
}
5757
```
5858

59+
## Bundled Config
60+
61+
This plugin provides the `plugin:requirejs/recommended` preset config. Which does the following:
62+
63+
* Enables the `amd` environment
64+
* Enables all recommended rules, indicated with a :star: icon in the table below
65+
5966
## List of supported rules
6067

6168
### Possible Errors
6269

63-
| Rule | Description |
64-
| :--- | :--- |
65-
| [no-invalid-define](docs/rules/no-invalid-define.md) | Disallow invalid module definitions |
66-
| [no-invalid-require](docs/rules/no-invalid-require.md) | Disallow invalid `require` or `requirejs` calls |
67-
| [no-multiple-define](docs/rules/no-multiple-define.md) | Disallow multiple module definitions in one file |
68-
| [no-assign-exports](docs/rules/no-assign-exports.md) | Disallow assignment to `exports` when using Simplified CommonJS Wrapper |
69-
| [no-js-extension](docs/rules/no-js-extension.md) | Disallow `.js` extension in dependency paths |
70+
| | Rule | Description |
71+
| :----: | :--- | :---------- |
72+
| :star: | [no-invalid-define](docs/rules/no-invalid-define.md) | Disallow invalid module definitions |
73+
| :star: | [no-invalid-require](docs/rules/no-invalid-require.md) | Disallow invalid `require` or `requirejs` calls |
74+
| :star: | [no-multiple-define](docs/rules/no-multiple-define.md) | Disallow multiple module definitions in one file |
75+
| :star: | [no-assign-exports](docs/rules/no-assign-exports.md) | Disallow assignment to `exports` when using Simplified CommonJS Wrapper |
76+
| :star: | [no-js-extension](docs/rules/no-js-extension.md) | Disallow `.js` extension in dependency paths |
7077

7178
### Stylistic Choices
7279

73-
| Rule | Description |
74-
| :--- | :--- |
75-
| [no-object-define](docs/rules/no-object-define.md) | Disallow Simple Name/Value Pairs form of `define` |
76-
| [no-function-define](docs/rules/no-function-define.md) | Disallow Simple Function form of `define` |
77-
| [no-amd-define](docs/rules/no-amd-define.md) | Disallow AMD (dependency array) form of `define` |
78-
| [no-named-define](docs/rules/no-named-define.md) | Disallow named module form of `define` |
79-
| [no-commonjs-wrapper](docs/rules/no-commonjs-wrapper.md) | Disallow use of Simplified CommonJS Wrapper |
80-
| [no-commonjs-return](docs/rules/no-commonjs-return.md) | Disallow use of `return` statement in a module definition when using Simplified CommonJS Wrapper |
81-
| [no-commonjs-exports](docs/rules/no-commonjs-exports.md) | Disallow use of `exports` in a module definition when using Simplified CommonJS Wrapper |
82-
| [no-commonjs-module-exports](docs/rules/no-commonjs-module-exports.md) | Disallow use of `module.exports` in a module definition when using Simplified CommonJS Wrapper |
83-
| [no-dynamic-require](docs/rules/no-dynamic-require.md) | Disallow use of dynamically generated paths in a `require` call |
84-
| [no-conditional-require](docs/rules/no-conditional-require.md) | Disallow use of conditional `require` calls |
85-
| [no-assign-require](docs/rules/no-assign-require.md) | Disallow assignment to `require` or `window.require` |
86-
| [no-require-tourl](docs/rules/no-require-tourl.md) | Disallow use of `require.toUrl` and `require.nameToUrl` |
87-
| [enforce-define](docs/rules/enforce-define.md) | Require that all files be wrapped in a `define` call |
88-
| [one-dependency-per-line](docs/rules/one-dependency-per-line.md) | Enforce line-break rules for AMD dependencies |
89-
| [amd-function-arity](docs/rules/amd-function-arity.md) | Ensure AMD callbacks have correct number of parameters |
90-
| [sort-amd-paths](docs/rules/sort-amd-paths.md) | Ensure that required paths are in alphabetical order |
80+
| | Rule | Description |
81+
| :----: | :--- | :---------- |
82+
| | [no-object-define](docs/rules/no-object-define.md) | Disallow Simple Name/Value Pairs form of `define` |
83+
| | [no-function-define](docs/rules/no-function-define.md) | Disallow Simple Function form of `define` |
84+
| | [no-amd-define](docs/rules/no-amd-define.md) | Disallow AMD (dependency array) form of `define` |
85+
| | [no-named-define](docs/rules/no-named-define.md) | Disallow named module form of `define` |
86+
| | [no-commonjs-wrapper](docs/rules/no-commonjs-wrapper.md) | Disallow use of Simplified CommonJS Wrapper |
87+
| | [no-commonjs-return](docs/rules/no-commonjs-return.md) | Disallow use of `return` statement in a module definition when using Simplified CommonJS Wrapper |
88+
| | [no-commonjs-exports](docs/rules/no-commonjs-exports.md) | Disallow use of `exports` in a module definition when using Simplified CommonJS Wrapper |
89+
| | [no-commonjs-module-exports](docs/rules/no-commonjs-module-exports.md) | Disallow use of `module.exports` in a module definition when using Simplified CommonJS Wrapper |
90+
| | [no-dynamic-require](docs/rules/no-dynamic-require.md) | Disallow use of dynamically generated paths in a `require` call |
91+
| | [no-conditional-require](docs/rules/no-conditional-require.md) | Disallow use of conditional `require` calls |
92+
| | [no-assign-require](docs/rules/no-assign-require.md) | Disallow assignment to `require` or `window.require` |
93+
| | [no-require-tourl](docs/rules/no-require-tourl.md) | Disallow use of `require.toUrl` and `require.nameToUrl` |
94+
| | [enforce-define](docs/rules/enforce-define.md) | Require that all files be wrapped in a `define` call |
95+
| | [one-dependency-per-line](docs/rules/one-dependency-per-line.md) | Enforce line-break rules for AMD dependencies |
96+
| | [amd-function-arity](docs/rules/amd-function-arity.md) | Ensure AMD callbacks have correct number of parameters |
97+
| | [sort-amd-paths](docs/rules/sort-amd-paths.md) | Ensure that required paths are in alphabetical order |
9198

9299
### Don't see the rule you're looking for?
93100

index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,19 @@ module.exports = {
2323
"one-dependency-per-line": require("./lib/rules/one-dependency-per-line"),
2424
"amd-function-arity": require("./lib/rules/amd-function-arity"),
2525
"sort-amd-paths": require("./lib/rules/sort-amd-paths")
26+
},
27+
configs: {
28+
recommended: {
29+
env: {
30+
amd: true
31+
},
32+
rules: {
33+
"requirejs/no-invalid-define": "error",
34+
"requirejs/no-invalid-require": "error",
35+
"requirejs/no-multiple-define": "error",
36+
"requirejs/no-assign-exports": "error",
37+
"requirejs/no-js-extension": "error"
38+
}
39+
}
2640
}
2741
};

0 commit comments

Comments
 (0)