forked from google/swissgl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
69 lines (68 loc) · 2.29 KB
/
eslint.config.js
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
import js from '@eslint/js';
import globals from 'globals';
import prettier from 'eslint-config-prettier';
import ts from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
{
languageOptions: {
globals: {
...globals.browser,
...globals.es2021,
// ...globals.node,
...globals.nodeBuiltin,
// ...globals['shared-node-browser'],
},
},
},
{
files: ['**/*.js'],
...js.configs.recommended,
rules: {
...js.configs.recommended.rules,
['no-unused-vars']: ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
},
},
{
files: ['src/**/*.ts'],
plugins: { '@typescript-eslint': ts },
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
project: true,
},
},
rules: {
...ts.configs['eslint-recommended'].rules,
// ...ts.configs.recommended.rules,
// ...ts.configs.stylistic.rules,
// ...ts.configs.strict.rules,
// ...ts.configs.stylistic.rules,
// ...ts.configs['recommended-type-checked'].rules,
...ts.configs['strict-type-checked'].rules,
...ts.configs['stylistic-type-checked'].rules,
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/no-confusing-void-expression': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/no-throw-literal': 'warn',
'@typescript-eslint/no-unnecessary-condition': 'warn',
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/prefer-includes': 'warn',
'@typescript-eslint/prefer-optional-chain': 'warn',
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
'@typescript-eslint/restrict-template-expressions': 'warn',
},
},
{ ignores: ['dist'] },
prettier,
];