-
Notifications
You must be signed in to change notification settings - Fork 182
/
Copy patheslint.config.mjs
78 lines (75 loc) · 1.98 KB
/
eslint.config.mjs
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
73
74
75
76
77
78
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import pluginJs from '@eslint/js';
import prettierConfig from 'eslint-config-prettier';
import globals from 'globals';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import tseslint from 'typescript-eslint';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default [
pluginJs.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
...tseslint.configs.recommendedTypeChecked,
prettierConfig,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: __dirname,
},
globals: { ...globals.browser, ...globals.node },
},
},
{
files: ['**/*.ts'],
rules: {
curly: 'warn',
eqeqeq: 'warn',
'no-throw-literal': 'warn',
semi: 'warn',
'@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }],
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/restrict-template-expressions': [
'error',
{
allowNumber: true,
},
],
'@typescript-eslint/class-literal-property-style': ['error', 'getters'],
},
},
{
files: ['src/api/**/*.ts'],
rules: {
// We do not want to change HCP API contracts
'@typescript-eslint/consistent-indexed-object-style': 'off',
},
},
{
files: ['**/*.{js,mjs,cjs}'],
...tseslint.configs.disableTypeChecked,
},
{
ignores: [
'.vscode-test',
'.wdio-vscode-service',
'.test-storage',
'.test-extensions',
'dist',
'out',
'src/test',
'**/node_modules/**',
'**/out/**',
'**/dist/**',
],
},
];