UNPKG

763 BJavaScriptView Raw
1'use strict';
2
3const fs = require('fs');
4const path = require('path');
5const expect = require('chai').expect;
6const stripComments = require('strip-json-comments');
7
8const config = JSON.parse(stripComments(readFile('.eslintrc')));
9const rulesInConfig = Object.keys(config.rules);
10const rulesInEslint = fs.readdirSync('./node_modules/eslint/lib/rules');
11
12describe('valor config rules set', () => {
13 it('should contain same amount of rules', () => {
14 expect(rulesInConfig.length).to.be.equal(rulesInEslint.length);
15 });
16 it('should contain all rules', () => {
17 rulesInEslint.forEach(rule => {
18 expect(rulesInConfig).to.contains(path.basename(rule, '.js'));
19 });
20 });
21});
22
23function readFile(filePath) {
24 return fs.readFileSync(filePath, 'utf8');
25}