eslint-plugin-require-path-exists
Checks all require path's to exist as files
Last updated 2 years ago by bohdantkachenko .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install eslint-plugin-require-path-exists 
SYNC missed versions from official npm registry.

NPM

Greenkeeper badge Dependency Status Average time to resolve an issue Percentage of issues still open

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 (or for import, if you're using ES6 syntax).

Features

  • Supports both require() and ES6 import syntax
  • Supports aliases in webpack
  • Supports different file extensions
  • Works in Atom with linter-eslint package

Usage

  1. Install eslint-plugin-require-path-exists as a dev-dependency:

    npm install --save-dev eslint-plugin-require-path-exists
    
  2. Enable the plugin by adding it to the plugins and start from default (recommended) configuration in extends in .eslintrc:

    {
      "extends": [
        "plugin:require-path-exists/recommended"
      ],
      "plugins": [
        "require-path-exists"
      ]
    }
    
  3. 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/notEmpty": 2,
        "require-path-exists/tooManyArguments": 2,
        "require-path-exists/exists": [ 2, {
          "extensions": [
            "",
            ".jsx",
            ".es.js",
            ".jsx",
            ".json5",
            ".es",
            ".es6",
            ".coffee"
          ],
          "webpackConfigPath": "webpack.config.js"
        }]
      }
    

] } ```

Rules

Name Description Default Configuration
require-path-exists/notEmpty You should not call require() without arguments or with empty argument 2
require-path-exists/tooManyArguments You should pass only one argument to require() function 2
require-path-exists/exists You should only pass existing paths to require() [ 2, { "extensions": [ "", ".js", ".json", ".node" ], "webpackConfigPath": null }]

Changelog

  • 1.1.5: Use resolve instead of some functions (thanks to @dominicbarnes)
  • 1.1.4: Correctly exec webpack config in Atom
  • 1.1.3: Output errors when trying to load webpack config
  • 1.1.2: In order to have aliases working you now should provide webpackConfigPath config value.
  • 1.1.1: Correctly resolve node built-in modules, using builtin-modules npm package (thanks to @antialias)
  • 1.1.0: Resolving of webpack file extensions is not supported anymore (thanks to @lilianammmatos). Please manually provide extensions to plugin config instead.

TODO

  • Tests coverage.
  • Check in different CommonJS environments (currently only tested in NodeJS and webpack).

License

MIT

Current Tags

  • 1.1.9                                ...           latest (2 years ago)

35 Versions

  • 1.1.9                                ...           2 years ago
  • 1.1.8                                ...           2 years ago
  • 1.1.7                                ...           3 years ago
  • 1.1.6                                ...           3 years ago
  • 1.1.5                                ...           4 years ago
  • 1.1.4                                ...           4 years ago
  • 1.1.3                                ...           4 years ago
  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.25                                ...           5 years ago
  • 1.0.24                                ...           5 years ago
  • 1.0.23                                ...           5 years ago
  • 1.0.22                                ...           5 years ago
  • 1.0.20                                ...           5 years ago
  • 1.0.19                                ...           5 years ago
  • 1.0.18                                ...           5 years ago
  • 1.0.17                                ...           5 years ago
  • 1.0.16                                ...           5 years ago
  • 1.0.15                                ...           5 years ago
  • 1.0.14                                ...           5 years ago
  • 1.0.13                                ...           5 years ago
  • 1.0.12                                ...           5 years ago
  • 1.0.11                                ...           5 years ago
  • 1.0.10                                ...           5 years ago
  • 1.0.9                                ...           5 years ago
  • 1.0.8                                ...           5 years ago
  • 1.0.7                                ...           5 years ago
  • 1.0.6                                ...           5 years ago
  • 1.0.5                                ...           5 years ago
  • 1.0.4                                ...           5 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago

Copyright 2014 - 2016 © taobao.org |