1 | module.exports = {
|
2 | plugins: [ 'filenames', 'jsdoc', 'mocha' ],
|
3 | extends: [
|
4 | 'eslint:recommended',
|
5 | 'plugin:import/errors',
|
6 | 'plugin:import/warnings',
|
7 | 'plugin:jsdoc/recommended',
|
8 | 'plugin:mocha/recommended'
|
9 | ],
|
10 | parserOptions: { ecmaVersion: 2018 },
|
11 | env: {
|
12 | es6: true,
|
13 | node: true,
|
14 | },
|
15 | globals: {},
|
16 | settings: { 'jsdoc': { mode: 'typescript' } },
|
17 | rules: {
|
18 |
|
19 | 'block-scoped-var': 'error',
|
20 | 'class-methods-use-this': 'error',
|
21 | 'complexity': ['error', 15],
|
22 | 'consistent-return': 'error',
|
23 | 'curly': 'error',
|
24 | 'default-case': 'error',
|
25 | 'eqeqeq': ['error'],
|
26 | 'guard-for-in': 'error',
|
27 | 'max-classes-per-file': ['error', 1],
|
28 | 'no-alert': 'error',
|
29 | 'no-caller': 'error',
|
30 | 'no-case-declarations': 'error',
|
31 | 'no-div-regex': 'error',
|
32 | 'no-empty-function': 'error',
|
33 | 'no-eq-null': 'error',
|
34 | 'no-eval': 'error',
|
35 | 'no-extend-native': 'error',
|
36 | 'no-extra-bind': 'error',
|
37 | 'no-implied-eval': 'error',
|
38 | 'no-invalid-this': 'error',
|
39 | 'no-iterator': 'error',
|
40 | 'no-lone-blocks': 'error',
|
41 | 'no-loop-func': 'error',
|
42 | 'no-multi-spaces': 'error',
|
43 | 'no-multi-str': 'error',
|
44 | 'no-new': 'error',
|
45 | 'no-new-func': 'error',
|
46 | 'no-new-wrappers': 'error',
|
47 | 'no-octal-escape': 'error',
|
48 | 'no-proto': 'error',
|
49 | 'no-return-assign': 'error',
|
50 | 'no-script-url': 'error',
|
51 | 'no-self-compare': 'error',
|
52 | 'no-throw-literal': 'error',
|
53 | 'no-unused-expressions': 'error',
|
54 | 'no-useless-call': 'error',
|
55 | 'no-useless-concat': 'error',
|
56 | 'no-void': 'error',
|
57 | 'no-warning-comments': 'warn',
|
58 | 'radix': 'error',
|
59 | 'wrap-iife': ['error', 'any'],
|
60 |
|
61 |
|
62 | 'no-undef-init': 'error',
|
63 | 'no-unused-vars': ['error', { 'args': 'none' }],
|
64 |
|
65 |
|
66 | 'block-spacing': 'error',
|
67 | 'brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
|
68 | 'camelcase': 'error',
|
69 | 'comma-spacing': 'error',
|
70 | 'comma-style': 'error',
|
71 | 'eol-last': 'error',
|
72 | 'func-call-spacing': 'error',
|
73 | 'func-name-matching': ['error', { 'includeCommonJSModuleExports': true }],
|
74 | 'function-call-argument-newline': ['error', 'consistent'],
|
75 | 'function-paren-newline': ['error', 'consistent'],
|
76 | 'indent': ['error', 2, { 'SwitchCase': 1, 'flatTernaryExpressions': true }],
|
77 | 'key-spacing': ['error'],
|
78 | 'keyword-spacing': 'error',
|
79 | 'lines-between-class-members': 'error',
|
80 | 'max-depth': ['error', 5],
|
81 | 'max-len': ['error', 130],
|
82 | 'max-lines-per-function': ['error', 81],
|
83 | 'max-nested-callbacks': ['error', 4],
|
84 | 'max-params': ['error', 5],
|
85 | 'max-statements': ['error', 35],
|
86 | 'max-statements-per-line': ['error', { 'max': 2 }],
|
87 | 'multiline-ternary': ['error', 'always-multiline'],
|
88 | 'newline-per-chained-call': ['error', { 'ignoreChainWithDepth': 3 }],
|
89 | 'no-lonely-if': 'warn',
|
90 | 'no-mixed-operators': 'error',
|
91 | 'no-multiple-empty-lines': 'error',
|
92 | 'no-trailing-spaces': 'error',
|
93 | 'no-whitespace-before-property': 'error',
|
94 | 'object-curly-newline': ['error', { 'multiline': true }],
|
95 | 'object-curly-spacing': ['error', 'always'],
|
96 | 'object-property-newline': ['error', { 'allowAllPropertiesOnSameLine': true }],
|
97 | 'one-var': ['warn', 'never'],
|
98 | 'quote-props': ['error', 'consistent'],
|
99 | 'quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }],
|
100 | 'semi': 'error',
|
101 | 'semi-spacing': 'error',
|
102 | 'semi-style': 'error',
|
103 | 'sort-keys': ['error', 'asc', { minKeys: 4 }],
|
104 | 'space-before-blocks': 'error',
|
105 | 'space-before-function-paren': ['error'],
|
106 | 'space-in-parens': 'error',
|
107 | 'space-infix-ops': 'error',
|
108 | 'spaced-comment': ['error', 'always', { 'block': { 'exceptions': ['html'], 'balanced': true } }],
|
109 | 'template-tag-spacing': ['error', 'never'],
|
110 |
|
111 |
|
112 | 'arrow-body-style': ['error', 'as-needed'],
|
113 | 'arrow-spacing': 'error',
|
114 | 'no-confusing-arrow': 'error',
|
115 | 'no-var': 'error',
|
116 | 'object-shorthand': ['error', 'never'],
|
117 | 'prefer-const': 'error',
|
118 | 'prefer-destructuring': ['error', { AssignmentExpression: { array: false } }],
|
119 | 'prefer-rest-params': 'error',
|
120 | 'prefer-spread': 'error',
|
121 |
|
122 |
|
123 | 'jsdoc/check-examples': ['error', {
|
124 | checkEslintrc: false,
|
125 | baseConfig: { extends: [ 'eslint:recommended' ], env: { es6: true } }
|
126 | }],
|
127 | 'jsdoc/check-indentation': 'error',
|
128 | 'jsdoc/check-syntax': 'error',
|
129 | 'jsdoc/empty-tags': 'error',
|
130 | 'jsdoc/no-undefined-types': 'off',
|
131 | 'jsdoc/require-description-complete-sentence': ['error', { tags: ['typedef'] }],
|
132 | 'jsdoc/require-hyphen-before-param-description': ['error', 'never'],
|
133 | 'jsdoc/require-jsdoc': ['error', { 'publicOnly': true }],
|
134 | 'jsdoc/require-returns-description': 'off',
|
135 |
|
136 |
|
137 | 'import/no-deprecated': 'error',
|
138 | 'import/no-extraneous-dependencies': 'error',
|
139 | 'import/no-mutable-exports': 'error',
|
140 | 'import/no-amd': 'error',
|
141 | 'import/no-nodejs-modules': 'error',
|
142 | 'import/first': 'error',
|
143 | 'import/no-namespace': 'error',
|
144 | 'import/extensions': 'error',
|
145 | 'import/order': ['error', { 'newlines-between': 'always', 'alphabetize': { 'order': 'asc', 'caseInsensitive': true } }],
|
146 | 'import/newline-after-import': ['error', { 'count': 2 }],
|
147 | 'import/no-unassigned-import': 'error',
|
148 | 'import/no-named-default': 'error',
|
149 | 'import/group-exports': 'error',
|
150 |
|
151 |
|
152 | 'mocha/no-setup-in-describe': 'off',
|
153 | 'mocha/valid-suite-description': 'error',
|
154 | 'mocha/valid-test-description': 'error',
|
155 |
|
156 |
|
157 | 'filenames/match-regex': ['error', '^[a-z][a-z0-9\\-]+$'],
|
158 | 'filenames/match-exported': 'error'
|
159 | },
|
160 | overrides: [
|
161 | {
|
162 | 'files': ['example/*.js'],
|
163 | 'rules': { 'import/no-nodejs-modules': 'off' }
|
164 | },
|
165 | {
|
166 | 'files': ['test/*.js'],
|
167 | 'env': { mocha: true },
|
168 | 'rules': {
|
169 | 'import/no-nodejs-modules': 'off',
|
170 | 'max-len': 'off',
|
171 | 'max-lines-per-function': 'off'
|
172 | }
|
173 | },
|
174 | {
|
175 | 'files': ['.eslintrc.js'],
|
176 | 'rules': {
|
177 | 'sort-keys': 'off',
|
178 | 'filenames/match-regex': 'off',
|
179 | }
|
180 | }
|
181 | ]
|
182 | };
|