1 | 'use strict';
|
2 |
|
3 | var fs = require('fs');
|
4 | var path = require('path');
|
5 | var _ = require('lodash');
|
6 | var rules = fs.readdirSync(path.resolve(__dirname, 'rules')).map(function (f) {
|
7 | return f.replace(/\.js$/, '');
|
8 | });
|
9 | var recommended = {
|
10 | plugins: ['lodash'],
|
11 | rules: {
|
12 | 'lodash/callback-binding': 2,
|
13 | 'lodash/chain-style': [2, 'as-needed'],
|
14 | 'lodash/chaining': 2,
|
15 | 'lodash/collection-method-value': 2,
|
16 | 'lodash/collection-return': 2,
|
17 | 'lodash/consistent-compose': [2, 'flow'],
|
18 | 'lodash/identity-shorthand': [2, 'always'],
|
19 | 'lodash/import-scope': [2],
|
20 | 'lodash/matches-prop-shorthand': [2, 'always'],
|
21 | 'lodash/matches-shorthand': [2, 'always', 3],
|
22 | 'lodash/no-commit': 2,
|
23 | 'lodash/no-double-unwrap': 2,
|
24 | 'lodash/no-extra-args': 2,
|
25 | 'lodash/no-unbound-this': 2,
|
26 | 'lodash/path-style': [2, 'string'],
|
27 | 'lodash/prefer-compact': 2,
|
28 | 'lodash/prefer-constant': 2,
|
29 | 'lodash/prefer-filter': [2, 3],
|
30 | 'lodash/prefer-find': 2,
|
31 | 'lodash/prefer-flat-map': 2,
|
32 | 'lodash/prefer-get': [2, 3],
|
33 | 'lodash/prefer-immutable-method': 2,
|
34 | 'lodash/prefer-includes': [2, { includeNative: true }],
|
35 | 'lodash/prefer-invoke-map': 2,
|
36 | 'lodash/prefer-is-nil': 2,
|
37 | 'lodash/prefer-lodash-chain': 2,
|
38 | 'lodash/prefer-lodash-method': 2,
|
39 | 'lodash/prefer-lodash-typecheck': 2,
|
40 | 'lodash/prefer-map': 2,
|
41 | 'lodash/prefer-matches': [2, 3],
|
42 | 'lodash/prefer-noop': 2,
|
43 | 'lodash/prefer-over-quantifier': 2,
|
44 | 'lodash/prefer-reject': [2, 3],
|
45 | 'lodash/prefer-some': [2, { includeNative: true }],
|
46 | 'lodash/prefer-startswith': 2,
|
47 | 'lodash/prefer-thru': 2,
|
48 | 'lodash/prefer-times': 2,
|
49 | 'lodash/prefer-wrapper-method': 2,
|
50 | 'lodash/preferred-alias': 2,
|
51 | 'lodash/prop-shorthand': [2, 'always'],
|
52 | 'lodash/unwrap': 2
|
53 | }
|
54 | };
|
55 | module.exports = {
|
56 | rules: _.zipObject(rules, rules.map(function (rule) {
|
57 | return require('./rules/' + rule);
|
58 | })),
|
59 | configs: {
|
60 | recommended: recommended,
|
61 | canonical: _.defaultsDeep({
|
62 | settings: { lodash: { pragma: '_' } },
|
63 | rules: {
|
64 | 'lodash/import-scope': [2, 'full']
|
65 | }
|
66 | }, recommended),
|
67 | v3: {
|
68 | settings: {
|
69 | lodash: {
|
70 | version: 3,
|
71 | pragma: '_'
|
72 | }
|
73 | },
|
74 | rules: {
|
75 | 'lodash/callback-binding': 2,
|
76 | 'lodash/chain-style': [2, 'as-needed'],
|
77 | 'lodash/chaining': [2, 'implicit'],
|
78 | 'lodash/collection-method-value': 2,
|
79 | 'lodash/collection-return': 2,
|
80 | 'lodash/consistent-compose': [2, 'flow'],
|
81 | 'lodash/import-scope': [2, 'full'],
|
82 | 'lodash/identity-shorthand': [2, 'always'],
|
83 | 'lodash/matches-prop-shorthand': [2, 'always'],
|
84 | 'lodash/matches-shorthand': [2, 'always', 3],
|
85 | 'lodash/no-commit': 2,
|
86 | 'lodash/no-double-unwrap': 2,
|
87 | 'lodash/no-extra-args': 2,
|
88 | 'lodash/path-style': [2, 'string'],
|
89 |
|
90 | 'lodash/prefer-compact': 2,
|
91 | 'lodash/prefer-constant': 2,
|
92 | 'lodash/prefer-filter': [2, 3],
|
93 | 'lodash/prefer-get': [2, 3],
|
94 | 'lodash/prefer-includes': [2, { includeNative: true }],
|
95 | 'lodash/prefer-lodash-chain': 2,
|
96 | 'lodash/prefer-lodash-method': 2,
|
97 | 'lodash/prefer-lodash-typecheck': 2,
|
98 | 'lodash/prefer-map': 2,
|
99 | 'lodash/prefer-matches': [2, 3],
|
100 | 'lodash/prefer-noop': 2,
|
101 | 'lodash/prefer-reject': [2, 3],
|
102 | 'lodash/prefer-some': [2, { includeNative: true }],
|
103 | 'lodash/prefer-startswith': 2,
|
104 | 'lodash/prefer-thru': 2,
|
105 | 'lodash/prefer-times': 2,
|
106 | 'lodash/prefer-wrapper-method': 2,
|
107 | 'lodash/preferred-alias': 2,
|
108 | 'lodash/prop-shorthand': [2, 'always'],
|
109 | 'lodash/unwrap': 2
|
110 | }
|
111 | }
|
112 | }
|
113 | }; |
\ | No newline at end of file |