UNPKG

1.82 kBJavaScriptView Raw
1'use strict';
2
3const fs = require('fs');
4const path = require('path');
5
6const rules = fs
7 .readdirSync(path.join(__dirname, 'rules'))
8 .filter(rule => rule !== '__tests__' && rule !== 'util.js')
9 .map(rule => path.basename(rule, '.js'))
10 .reduce(
11 (acc, curr) => Object.assign(acc, { [curr]: require(`./rules/${curr}`) }),
12 {}
13 );
14
15const snapshotProcessor = require('./processors/snapshot-processor');
16
17module.exports = {
18 configs: {
19 recommended: {
20 plugins: ['jest'],
21 env: {
22 'jest/globals': true,
23 },
24 rules: {
25 'jest/no-alias-methods': 'warn',
26 'jest/no-disabled-tests': 'warn',
27 'jest/no-focused-tests': 'error',
28 'jest/no-identical-title': 'error',
29 'jest/no-jest-import': 'error',
30 // 'jest/no-mocks-import': 'error',
31 'jest/no-jasmine-globals': 'warn',
32 'jest/no-test-prefixes': 'error',
33 'jest/valid-describe': 'error',
34 'jest/valid-expect': 'error',
35 'jest/valid-expect-in-promise': 'error',
36 },
37 },
38 style: {
39 plugins: ['jest'],
40 rules: {
41 'jest/prefer-to-be-null': 'error',
42 'jest/prefer-to-be-undefined': 'error',
43 'jest/prefer-to-contain': 'error',
44 'jest/prefer-to-have-length': 'error',
45 },
46 },
47 },
48 environments: {
49 globals: {
50 globals: {
51 afterAll: false,
52 afterEach: false,
53 beforeAll: false,
54 beforeEach: false,
55 describe: false,
56 expect: false,
57 fit: false,
58 it: false,
59 jasmine: false,
60 jest: false,
61 pending: false,
62 pit: false,
63 require: false,
64 test: false,
65 xdescribe: false,
66 xit: false,
67 xtest: false,
68 },
69 },
70 },
71 processors: {
72 '.snap': snapshotProcessor,
73 },
74 rules,
75};