-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy patheslint.config.cjs
More file actions
50 lines (49 loc) · 1.45 KB
/
eslint.config.cjs
File metadata and controls
50 lines (49 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// eslint.config.js
const js = require('@eslint/js');
const pluginPromise = require('eslint-plugin-promise');
const pluginUnicorn = require('eslint-plugin-unicorn');
const pluginN = require('eslint-plugin-n');
const prettier = require('eslint-config-prettier');
const pluginMocha = require('eslint-plugin-mocha');
const globals = require('globals');
module.exports = [
js.configs.recommended,
{
files: ['**/*.js'],
ignores: ['dist/**', 'tmp/**', 'coverage/**'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'commonjs',
globals: {
// Node.js globals
...globals.node,
...globals.mocha,
},
},
plugins: {
promise: pluginPromise,
unicorn: pluginUnicorn,
n: pluginN,
mocha: pluginMocha,
},
rules: {
...pluginPromise.configs.recommended.rules,
...pluginN.configs.recommended.rules,
...pluginUnicorn.configs.recommended.rules,
...pluginMocha.configs.recommended.rules,
// Give warnings for rules should fix in the future
'no-prototype-builtins': 'warn',
// Disable rules that don't fit this CommonJS project
'unicorn/prefer-module': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/no-null': 'off',
'unicorn/prefer-spread': 'warn',
'unicorn/no-array-reduce': 'warn',
'unicorn/no-await-expression-member': 'warn',
'unicorn/prefer-structured-clone': 'warn',
// Disable Mocha rule that doesn't fit existing test patterns
'mocha/no-setup-in-describe': 'off',
},
},
prettier,
];