|
1 | 1 | require("@nordcloud/eslint-config-pat/patch/modern-module-resolution");
|
2 | 2 |
|
| 3 | +/** @type {import("@types/eslint").Linter.Config} */ |
3 | 4 | module.exports = {
|
4 | 5 | extends: [
|
5 | 6 | "@nordcloud/eslint-config-pat/profile/web-app",
|
6 | 7 | "@nordcloud/eslint-config-pat/mixins/react",
|
7 | 8 | "@nordcloud/eslint-config-pat/mixins/react-testing",
|
8 |
| - "@nordcloud/eslint-config-pat/mixins/tsdoc", |
9 | 9 | "@nordcloud/eslint-config-pat/mixins/jest",
|
10 | 10 | ],
|
11 | 11 |
|
12 | 12 | parserOptions: { tsconfigRootDir: __dirname },
|
13 | 13 |
|
14 |
| - ignorePatterns: ["*.js"], |
| 14 | + ignorePatterns: ["./*.js"], |
15 | 15 |
|
16 | 16 | settings: {
|
17 | 17 | react: {
|
18 |
| - version: "16.14.0", // React version. "detect" automatically picks the version you have installed. |
| 18 | + version: "17.0.2", // React version. "detect" automatically picks the version you have installed. |
19 | 19 | },
|
20 | 20 | jest: {
|
21 | 21 | version: "29",
|
22 | 22 | },
|
23 | 23 | },
|
24 | 24 |
|
25 |
| - rules: { |
26 |
| - "@typescript-eslint/no-unsafe-return": "warn", |
27 |
| - "@typescript-eslint/no-unsafe-argument": "warn", |
28 |
| - "@typescript-eslint/no-unsafe-assignment": "warn", |
29 |
| - "@typescript-eslint/no-unsafe-member-access": "warn", |
30 |
| - // Should be in sync with https://github.com/nordcloud/eslint-config-pat/blob/master/profile/_common.js#L463 |
31 |
| - "@typescript-eslint/naming-convention": [ |
32 |
| - "warn", |
33 |
| - { |
34 |
| - selector: "default", |
35 |
| - format: null, |
| 25 | + overrides: [ |
| 26 | + { |
| 27 | + files: ["**/*.{js,mjs}"], |
| 28 | + parserOptions: { |
| 29 | + sourceType: "module", |
36 | 30 | },
|
37 |
| - // Ignore destructured names |
38 |
| - { |
39 |
| - selector: "variable", |
40 |
| - types: ["array", "boolean", "function", "number", "string"], |
41 |
| - modifiers: ["destructured"], |
42 |
| - format: null, |
43 |
| - }, |
44 |
| - { |
45 |
| - selector: "variable", |
46 |
| - types: ["boolean"], |
47 |
| - format: ["PascalCase"], |
48 |
| - prefix: [ |
49 |
| - "is", |
50 |
| - "are", |
51 |
| - "should", |
52 |
| - "has", |
53 |
| - "can", |
54 |
| - "did", |
55 |
| - "will", |
56 |
| - "show", |
57 |
| - "hide", |
| 31 | + }, |
| 32 | + { |
| 33 | + files: ["src/**/*.{ts,tsx}"], |
| 34 | + rules: { |
| 35 | + "@typescript-eslint/no-unsafe-return": "warn", |
| 36 | + "@typescript-eslint/no-unsafe-argument": "warn", |
| 37 | + "@typescript-eslint/no-unsafe-assignment": "warn", |
| 38 | + "@typescript-eslint/no-unsafe-member-access": "warn", |
| 39 | + // Should be in sync with https://github.com/nordcloud/eslint-config-pat/blob/master/profile/_common.js#L463 |
| 40 | + "@typescript-eslint/naming-convention": [ |
| 41 | + "warn", |
| 42 | + { |
| 43 | + selector: "default", |
| 44 | + format: null, |
| 45 | + }, |
| 46 | + // Ignore destructured names |
| 47 | + { |
| 48 | + selector: "variable", |
| 49 | + types: ["array", "boolean", "function", "number", "string"], |
| 50 | + modifiers: ["destructured"], |
| 51 | + format: null, |
| 52 | + }, |
| 53 | + { |
| 54 | + selector: "variable", |
| 55 | + types: ["boolean"], |
| 56 | + format: ["PascalCase"], |
| 57 | + prefix: [ |
| 58 | + "is", |
| 59 | + "are", |
| 60 | + "should", |
| 61 | + "has", |
| 62 | + "can", |
| 63 | + "did", |
| 64 | + "will", |
| 65 | + "show", |
| 66 | + "hide", |
| 67 | + ], |
| 68 | + }, |
| 69 | + { |
| 70 | + selector: "variable", |
| 71 | + format: ["camelCase", "UPPER_CASE", "PascalCase"], |
| 72 | + }, |
| 73 | + { |
| 74 | + selector: "parameter", |
| 75 | + format: ["camelCase"], |
| 76 | + leadingUnderscore: "allow", |
| 77 | + filter: { |
| 78 | + regex: "^(Component)$", |
| 79 | + match: false, |
| 80 | + }, |
| 81 | + }, |
| 82 | + { |
| 83 | + selector: "memberLike", |
| 84 | + modifiers: ["private"], |
| 85 | + format: ["camelCase"], |
| 86 | + leadingUnderscore: "require", |
| 87 | + }, |
| 88 | + { |
| 89 | + selector: ["function"], |
| 90 | + format: ["camelCase", "PascalCase"], |
| 91 | + leadingUnderscore: "forbid", |
| 92 | + }, |
| 93 | + { |
| 94 | + selector: ["typeProperty"], |
| 95 | + format: ["camelCase"], |
| 96 | + leadingUnderscore: "allowDouble", |
| 97 | + filter: { |
| 98 | + regex: "^(Component)$", |
| 99 | + match: false, |
| 100 | + }, |
| 101 | + }, |
| 102 | + { |
| 103 | + selector: ["enumMember"], |
| 104 | + format: ["PascalCase", "UPPER_CASE"], |
| 105 | + }, |
| 106 | + { |
| 107 | + selector: "enum", |
| 108 | + format: ["PascalCase", "UPPER_CASE"], |
| 109 | + }, |
58 | 110 | ],
|
59 | 111 | },
|
60 |
| - { |
61 |
| - selector: "variable", |
62 |
| - format: ["camelCase", "UPPER_CASE", "PascalCase"], |
63 |
| - }, |
64 |
| - { |
65 |
| - selector: "parameter", |
66 |
| - format: ["camelCase"], |
67 |
| - leadingUnderscore: "allow", |
68 |
| - filter: { |
69 |
| - regex: "^(Component)$", |
70 |
| - match: false, |
71 |
| - }, |
72 |
| - }, |
73 |
| - { |
74 |
| - selector: "memberLike", |
75 |
| - modifiers: ["private"], |
76 |
| - format: ["camelCase"], |
77 |
| - leadingUnderscore: "require", |
78 |
| - }, |
79 |
| - { |
80 |
| - selector: ["function"], |
81 |
| - format: ["camelCase", "PascalCase"], |
82 |
| - leadingUnderscore: "forbid", |
83 |
| - }, |
84 |
| - { |
85 |
| - selector: ["typeProperty"], |
86 |
| - format: ["camelCase"], |
87 |
| - leadingUnderscore: "allowDouble", |
88 |
| - filter: { |
89 |
| - regex: "^(Component)$", |
90 |
| - match: false, |
91 |
| - }, |
92 |
| - }, |
93 |
| - { |
94 |
| - selector: ["enumMember"], |
95 |
| - format: ["PascalCase", "UPPER_CASE"], |
96 |
| - }, |
97 |
| - { |
98 |
| - selector: "enum", |
99 |
| - format: ["PascalCase", "UPPER_CASE"], |
| 112 | + }, |
| 113 | + { |
| 114 | + files: ["src/**/*.spec.{ts,tsx}"], |
| 115 | + rules: { |
| 116 | + "testing-library/no-node-access": "warn", |
| 117 | + "testing-library/no-container": "warn", |
100 | 118 | },
|
101 |
| - ], |
102 |
| - |
103 |
| - "testing-library/no-node-access": "warn", |
104 |
| - "testing-library/no-container": "warn", |
105 |
| - }, |
| 119 | + }, |
| 120 | + ], |
106 | 121 | };
|
0 commit comments