Code Monkey home page Code Monkey logo

eslint-plugin-require-path-exists's Introduction

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.

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 your .eslintrc:

    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/exists: 2
      - require-path-exists/not_empty: 2
      - require-path-exists/too_many_arguments: 2

Rules

Name Description Default Configuration
exists You should only pass existent paths to require() 'exists': 2
not_empty You should not call require() without arguments or with empty argument 'not_empty': 2
too_many_arguments You should pass only one argument to require() function 'too_many_arguments': 2

ToDo

  • Tests coverage.
  • Check in different CommonJS environments (currently only tested in NodeJS and webpack).
  • Remove dirty hack for Atom after pull request in linter-eslint is merged.
  • Think about more correct way to detect bundled NodeJS (and webpack) modules. Currently it is a constant array.

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.