This repository will give access to new rules for the ESLint tool. You should use it only if you are developing a CommonJS application. It checks for require() function usage.
- Supports both
require()
and ES6import
syntax - Supports aliases in webpack
- Supports different file extensions
- Works in Atom with
linter-eslint
package
-
Install
eslint-plugin-require-path-exists
as a dev-dependency:npm install --save-dev eslint-plugin-require-path-exists
-
Enable the plugin by adding it to your
.eslintrc
:plugins: - require-path-exists
-
You can also configure these rules in your
.eslintrc
. All rules defined in this plugin have to be prefixed by 'require-path-exists/'plugins: - require-path-exists rules: - require-path-exists/exists: 2 - require-path-exists/notEmpty: 2 - require-path-exists/tooManyArguments: 2
Name | Description | Default Configuration |
---|---|---|
exists | You should only pass existent paths to require() | 'exists': 2 |
notEmpty | You should not call require() without arguments or with empty argument | 'notEmpty': 2 |
tooManyArguments | You should pass only one argument to require() function | 'tooManyArguments': 2 |
- Tests coverage.
- Check in different CommonJS environments (currently only tested in NodeJS and webpack).
- Think about more correct way to detect bundled NodeJS (and webpack) modules. Currently it is a constant array.
MIT