-
Notifications
You must be signed in to change notification settings - Fork 2
/
eslint.config.mjs
60 lines (56 loc) · 1.62 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
import globals from 'globals';
import pluginJs from '@eslint/js';
import vitest from 'eslint-plugin-vitest';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import tseslint from 'typescript-eslint';
import eslintConfigPrettier from 'eslint-config-prettier';
import pluginReact from 'eslint-plugin-react';
const OFF = 0;
const WARNING = 1;
const ERROR = 2;
export default [
{
files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
settings: {
react: {
version: 'detect',
},
},
plugins: {
vitest,
},
languageOptions: { globals: globals.browser },
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
jsxA11y.flatConfigs.recommended,
eslintConfigPrettier,
{
rules: {
...vitest.configs.recommended.rules,
'max-len': [ERROR, 160],
'no-console': WARNING,
'no-debugger': WARNING,
'react/function-component-definition': [
'error',
{
namedComponents: 'arrow-function',
unnamedComponents: 'arrow-function',
},
],
'react/prop-types': OFF,
'jsx-a11y/no-autofocus': OFF,
// Note: you must disable the base rule as it can report incorrect errors
'no-use-before-define': OFF,
'@typescript-eslint/no-use-before-define': [ERROR],
'no-shadow': OFF,
'@typescript-eslint/no-shadow': [ERROR],
'no-unused-vars': OFF,
'@typescript-eslint/no-unused-vars': [ERROR],
// TODO (TOR) Ignorert inntil videre grunnet kost/nytte
'@typescript-eslint/no-explicit-any': OFF,
'@typescript-eslint/ban-ts-comment': OFF,
},
},
];