-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy patheslint.config.js
More file actions
72 lines (71 loc) · 2.28 KB
/
eslint.config.js
File metadata and controls
72 lines (71 loc) · 2.28 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import eslintPluginTs from '@typescript-eslint/eslint-plugin';
import parserTs from '@typescript-eslint/parser';
import prettierPlugin from 'eslint-plugin-prettier';
import mochaPlugin from 'eslint-plugin-mocha';
import unicornPlugin from 'eslint-plugin-unicorn';
import jestFormattingPlugin from 'eslint-plugin-jest-formatting';
import headerPlugin from 'eslint-plugin-header';
import eslintJs from '@eslint/js';
import prettierConfig from 'eslint-config-prettier';
import eslintPluginHeader from 'eslint-plugin-header';
import globals from 'globals';
import fs from 'node:fs';
const licenseHeader = fs
.readFileSync('./resources/license.header.js', 'utf-8')
.replace(/^\/\*+|\*+\/$/g, '') // strip /* */
.split('\n')
.map((line) => line.replace(/^\s*\* ?/, '').trim());
export default [
eslintJs.configs.recommended,
prettierConfig,
{
files: ['src/**/*.ts'],
ignores: ['resources/license.header.js'],
languageOptions: {
parser: parserTs,
parserOptions: {
project: 'tsconfig.json',
},
globals: {
...globals.node,
...globals.commonjs,
...globals.mocha,
},
},
plugins: {
'@typescript-eslint': eslintPluginTs,
header: headerPlugin,
'jest-formatting': jestFormattingPlugin,
mocha: mochaPlugin,
prettier: prettierPlugin,
unicorn: unicornPlugin,
header: headerPlugin,
},
rules: {
...eslintPluginTs.configs['recommended'].rules,
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/strict-boolean-expressions': [
'error',
{
allowNullableObject: true,
allowNullableBoolean: true,
allowAny: true,
},
],
eqeqeq: 'error',
'jest-formatting/padding-around-describe-blocks': 'error',
'jest-formatting/padding-around-test-blocks': 'error',
'mocha/max-top-level-suites': 'off',
'mocha/no-exports': 'off',
'mocha/no-mocha-arrows': 'off',
'no-console': 'off',
'no-return-await': 'error',
'no-unneeded-ternary': 'error',
'no-unused-vars': 'off',
'prettier/prettier': 'error',
'unicorn/prefer-node-protocol': 'error',
},
},
];