/eslint-config-vizia

Common linting for vizia code.

Primary LanguageJavaScript

eslint-config-vizia

Common ESLint shareable config files for vizia.

Install into your project:

npm install --save eslint eslint-config-vizia

Example uses:

ES5 browser project.

Make a .eslintrc.json config file with the following in:

{
    "env": {
        "browser": true
    }
    "extends": "vizia"
}

You must specify your environment in the "env" part. You can also customize rules as you like.

ES2015 Node.js project.

As before the environment needs to be specified. Since Node 6+ has good ES2015 feature coverage, it makes sense to use ES2015 features. A sharable config is provided for ES2015 code:

{
    "env": {
        "node": true
    }
    "extends": "vizia/ES2015"
}

Internally this config extends the base vizia config.

Tests

Tests often look like bad code. They're prone to many more lines of code per file than healthy production code etc. It's recommended to have a .eslintrc.json file in your test directory to address this. ESLint extends a config found in a directory above automatically, so you only need to turn off rules that become noisy in tests. Such a file might look like:

{
    "env": {
        "mocha": true
    },
    "rules": {
        "max-statements": 'off',
        "max-lines": 'off'
    }
}