-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
78 lines (72 loc) · 2.18 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
// @ts-check
import eslint from '@eslint/js';
import configPrettier from 'eslint-config-prettier';
import pluginJsxA11y from 'eslint-plugin-jsx-a11y';
import pluginReact from 'eslint-plugin-react';
import pluginVitest from 'eslint-plugin-vitest';
import globals from "globals";
import tseslint from 'typescript-eslint';
import pluginQuery from '@tanstack/eslint-plugin-query'
// Viss vi ønsker eslint-plugin-jest-dom aktivert: import pluginJestDom from 'eslint-plugin-jest-dom';
// ^- Rapporterer ein del feil, så virker ikkje å ha vore aktivert før.
const OFF = 0;
const WARN = 1;
const ERROR = 2;
const config = tseslint.config(
...pluginQuery.configs['flat/recommended'],
eslint.configs.recommended,
...tseslint.configs.recommended,
configPrettier,
pluginReact.configs.flat['jsx-runtime'],
pluginJsxA11y.flatConfigs.recommended,
pluginVitest.configs.recommended,
// Viss vi ønsker jest-dom plugin aktivert: pluginJestDom.configs["flat/recommended"],
{
languageOptions: {
globals: {
...globals.browser,
},
},
linterOptions: {
// Vurder å enable denne seinare
reportUnusedDisableDirectives: false
},
rules: {
'@typescript-eslint/no-explicit-any': OFF,
'@typescript-eslint/no-unused-vars': [
"error",
{
varsIgnorePattern: "React" // TODO Fjern denne og samtidig alle ubrukte React imports. Unødvendig etter overgang til react-jsx i tsconfig
}
],
'jsx-a11y/no-autofocus': OFF, // Skrudd av ved migrering til jsx-a11y recommended config. Vurder å fikse seinare.
'jsx-a11y/anchor-is-valid': OFF,
},
},
{
files: ["**/*.cjs"],
rules: {
'@typescript-eslint/no-var-requires': OFF,
'@typescript-eslint/no-require-imports': OFF,
},
languageOptions: {
globals: {
require: true,
module: true,
}
}
},
{
files: ["packages/v2/**.*.ts", "packages/v2/**.*.tsx"],
rules: {
'@typescript-eslint/no-explicit-any': ERROR
}
},
{
files: ["**/KroniskSykObjektTilMikrofrontend.ts"],
rules: {
'no-constant-binary-expression': OFF // TODO Fiks denne, sannsynlegvis bug
}
}
)
export default config