eslint-config-openstack/spec/index.js
Vitaly Kramskikh a3151bef1d Update descriptions of ES6-related options
OpenStack starts to support ES6, so the config has been updated
with instructions how to enable ES6 support.

"ecmaFeatures" were moved under "parserOptions" as it's required
by ESLint 2.x, all ES6-related flags were removed as they're
enabled using env.es6.

Change-Id: I5531534e2ab12ece0859816679aa19deb974957e
2016-05-12 16:01:19 +00:00

50 lines
1.6 KiB
JavaScript

describe("Unit: eslint-config-openstack", function() {
"use strict";
it("should set espree as the default parser.", function() {
var config = require('../index');
expect(config.parser).toEqual('espree');
});
it("should disable all environments.", function() {
var config = require('../index');
expect(config.env).toBeFalsy();
});
it("should alert on rule replacements.", function() {
var eslintReplacements = require('eslint/conf/replacements.json');
var rules = require('../index').rules;
/*eslint-disable guard-for-in */
for (var ruleName in eslintReplacements) {
expect(rules.hasOwnProperty(ruleName))
.toBeFalsy("Rule " + ruleName + " has been replaced:", eslintReplacements[ruleName]);
}
/*eslint-enable guard-for-in */
});
it("should have an opinion on every eslint default rule.", function() {
var eslintDefaults = require('eslint/conf/eslint.json');
var rules = require('../index').rules;
/*eslint-disable guard-for-in */
for (var ruleName in eslintDefaults.rules) {
expect(rules.hasOwnProperty(ruleName))
.toBeTruthy("Rule " + ruleName + " must be defined.");
}
/*eslint-enable guard-for-in */
});
it("should only have opinions on rules that exist (no zombies).", function() {
var eslintRules = require('eslint/conf/eslint.json').rules;
var openstackRules = require('../index').rules;
/*eslint-disable guard-for-in */
for (var ruleName in openstackRules) {
expect(eslintRules.hasOwnProperty(ruleName))
.toBeTruthy("Rule " + ruleName + " is a zombie.");
}
/*eslint-enable guard-for-in */
});
});