Code Monkey home page Code Monkey logo

sails-eslint's Introduction

sails-eslint

npm version Dependency Status

Sails JS hook to activate ESLint in your sails app.

Here is how eslint log looks like (sample):

Installation

npm install sails-eslint

Usage

requires at least sails >= 0.11

Make sure you have a .eslintrc in your root folder. Then just lift your app as normal, and enjoy the power of linting. For an example of an .eslintrc file see: https://github.com/jasancheg/sails-eslint/blob/master/.eslintrc

Configuration

By default, configuration lives in sails.config.eslint. The configuration key (eslint) can be changed by setting sails.config.hooks['sails-eslint'].configKey.

Parameter Type Details
active ((boolean)) Whether or not sails should lint your JS code. Defaults to true.
formatter ((string)) Which formatter to use. Defaults to 'eslint-formatter-pretty'.
usePolling ((boolean)) Whether or not to use the polling feature. Slower but necessary for certain environments. Defaults to false.
dirs ((array)) Array of strings indicating Which folders or glob patterns to lint and watch. Defaults to [path.resolve(sails.config.appPath, 'api'), path.resolve(sails.config.appPath, 'config')].
ignored ((array|string|regexp|function)) Files and/or directories to be ignored. Pass a string to be directly matched, string with glob patterns, regular expression test, function that takes the testString as an argument and returns a truthy value if it should be matched, or an array of any number and mix of these types. For more examples look up anymatch docs.

Example (only if you want to change the default configuration!!)

// [your-sails-app]/config/eslint.js
module.exports.eslint = {
  active: true,
  dirs: [
    'api/controllers',
    'api/middlewares',
    'api/mocks',
    'api/models',
    'api/policies',
    'api/services',
    'config'
  ]
};

That’s it!

License

MIT © jasancheg

sails-eslint's People

Contributors

gaithoben avatar jasancheg avatar

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.