1 | 'use strict';
|
2 |
|
3 | const fs = require('fs');
|
4 | const path = require('path');
|
5 | const expect = require('chai').expect;
|
6 | const stripComments = require('strip-json-comments');
|
7 |
|
8 | const config = JSON.parse(stripComments(readFile('.eslintrc')));
|
9 | const rulesInConfig = Object.keys(config.rules);
|
10 | const rulesInEslint = fs.readdirSync('./node_modules/eslint/lib/rules');
|
11 |
|
12 | describe('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 |
|
23 | function readFile(filePath) {
|
24 | return fs.readFileSync(filePath, 'utf8');
|
25 | }
|