Socket
Socket
Sign inDemoInstall

eslint-config-vast

Package Overview
Dependencies
139
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    eslint-config-vast

ESLint shareable config for Vast's JavaScript coding standards


Version published
Weekly downloads
9
decreased by-30.77%
Maintainers
2
Install size
11.4 kB
Created
Weekly downloads
 

Readme

Source

eslint-config-vast

ESLint shareable config Vast's JavaScript coding standards

NPM version Dependency Status devDependency Status devDependency Status

This config can be used for linting server-side and client-side JavaScript.

See eslint-config-vast-react for some additional useful checks for React, JSX, and accessibility.

Installation

npm install eslint-config-vast --save-dev

Usage

For Node.js environment (ES6):

Create .eslintrc file in the root of your project with the following settings:

{
    "extends": "eslint-config-vast",
    "rules": {
        // Your overrides...
    }
}

For browser environment with ES6/ES7/ES8 to ES5 transpiler:

Create an additional .stylelintrc file in a client-side code folder (e.g. client/.eslintrc) with the following settings:

{
    "env": {
        "browser": true
    },
    "parserOptions": {
        "sourceType": "module",
        "ecmaVersion": 8
    },
    "globals": {
        "GLOBAL1": false,
        "GLOBAL2": false
    },
    "rules": {
        // Your overrides...
    }
}

Note: You don't need to use babel-eslint ("parser": "babel-eslint") if you are using ES2015 (ES6), ES2016 (ES7) or ES2017 (ES8).

ESLint actually supports ES2015/ES2016/ES2017, JSX, and object rest/spread by default now.

At the moment, you'll need it if you use stuff like class properties, decorators, async/await, types.

For browser environment without ES6/ES7/ES8 to ES5 transpiler:

Create an additional .stylelintrc file in a client-side code folder (e.g. client/.eslintrc) with the following settings:

{
    "env": {
        "browser": true,
        "es6": false
    },
    "globals": {
        "GLOBAL1": false,
        "GLOBAL2": false
    },
    "rules": {
        // Disable es6-related rules for es5 environment
        // (TODO: check if this can be done in more generic way)
        "object-shorthand": 0,
        "prefer-arrow-callback": 0,
        "prefer-template": 0,
        "prefer-spread": 0,
        "prefer-rest-params": 0
    }
}

Setting up ESLint

If you haven’t already set up ESLint on your project, run:

npm install eslint --save-dev

Add "eslint" to "scripts" in package.json:

"scripts": {
    "eslint": "eslint app tests *.js --ext .js --ext .jsx --ignore-pattern 'js/vendor'"
}

...and then you can run:

npm run eslint

To add a Git pre-commit hook for ESLint, run:

npm install pre-commit --save-dev

...and add this to package.json:

"pre-commit": [
  "eslint"
]

Tip: For real-time linting in your text editor, see ESLint integrations for editors.

Tip: Run eslint --fix /path/to/file.js to automatically fix as many issues as possible.

Tip: You can create a personal configuration file in your home directory (~/.eslintrc), it will only be used if no other configuration files are found. See Configuration Cascading and Hierarchy. But make sure to all install dependencies globally with -g flag.

License

MIT © 2016 Vast.com, Inc.

Keywords

FAQs

Last updated on 28 Oct 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc