forked from mattpocock/tt-package-demo
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.mjs
More file actions
67 lines (65 loc) · 1.59 KB
/
eslint.config.mjs
File metadata and controls
67 lines (65 loc) · 1.59 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
import jsdoc from "eslint-plugin-jsdoc";
import reactHooks from "eslint-plugin-react-hooks";
import sonarjs from "eslint-plugin-sonarjs";
import { defineConfig } from "eslint/config";
import tseslint from "typescript-eslint";
const SOURCE_FILES = ["src/**/*.{ts,tsx}", ".storybook/**/*.{ts,tsx}"];
export default defineConfig([
{
ignores: ["dist/**", "storybook-static/**", "node_modules/**"],
},
{
...reactHooks.configs.flat.recommended,
files: SOURCE_FILES,
},
...tseslint.configs.strict.map((config) => ({
...config,
files: SOURCE_FILES,
})),
{
files: SOURCE_FILES,
rules: {
"@typescript-eslint/consistent-type-imports": [
"error",
{ prefer: "type-imports", fixStyle: "inline-type-imports" },
],
},
},
{
files: SOURCE_FILES,
ignores: [
"src/**/*.stories.{ts,tsx}",
".storybook/**",
"src/components/ui/**/*.tsx",
],
plugins: {
jsdoc,
},
rules: {
"jsdoc/require-jsdoc": [
"error",
{
publicOnly: true,
require: {
MethodDefinition: true, // export class X { method() {} }
},
contexts: [
"ExportNamedDeclaration > VariableDeclaration", // export const … (variables, constants, arrow fns)
],
},
],
},
},
{
files: SOURCE_FILES,
plugins: {
sonarjs,
},
rules: {
"sonarjs/cognitive-complexity": "error",
"sonarjs/cyclomatic-complexity": "error",
"sonarjs/expression-complexity": "warn",
"sonarjs/regex-complexity": "warn",
},
},
]);