-
Notifications
You must be signed in to change notification settings - Fork 223
Expand file tree
/
Copy patheslint.config.js
More file actions
136 lines (134 loc) · 3.73 KB
/
Copy patheslint.config.js
File metadata and controls
136 lines (134 loc) · 3.73 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import checkFile from "eslint-plugin-check-file";
import { fileURLToPath } from "url";
import { dirname } from "path";
import playwright from "eslint-plugin-playwright";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default [
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ["**/*.ts", "**/*.tsx"],
languageOptions: {
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: __dirname,
},
},
rules: {
"@typescript-eslint/naming-convention": [
"error",
{
selector: "variable",
format: ["camelCase"],
},
{
selector: "variable",
modifiers: ["const", "exported"],
format: ["UPPER_CASE"],
},
{
selector: "function",
format: ["camelCase"],
},
{
selector: "parameter",
format: ["camelCase"],
leadingUnderscore: "allow",
},
{
selector: "memberLike",
modifiers: ["private"],
format: ["camelCase"],
leadingUnderscore: "allow",
},
{
selector: "typeLike",
format: ["PascalCase"],
},
{
selector: "enumMember",
format: ["UPPER_CASE"],
},
{
selector: "class",
format: ["PascalCase"],
},
],
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/await-thenable": "error",
},
},
{
files: ["**/*.{js,ts,jsx,tsx}"],
plugins: {
"check-file": checkFile,
},
rules: {
"check-file/filename-naming-convention": [
"error",
{
"**/*.{js,ts,jsx,tsx}": "KEBAB_CASE",
},
{
ignoreMiddleExtensions: true,
},
],
"check-file/folder-naming-convention": [
"error",
{
"**": "KEBAB_CASE",
},
],
},
},
{
ignores: [
"node_modules/**",
"playwright-report/**",
"test-results/**",
"coverage/**",
".local-test/**",
".prettierrc.cjs",
],
},
// Playwright recommended rules for test files
{
...playwright.configs["flat/recommended"],
files: ["**/*.spec.ts", "**/*.test.ts", "playwright/**/*.ts"],
rules: {
...playwright.configs["flat/recommended"].rules,
// Only disable rules that cause errors, keep warnings
"playwright/expect-expect": "off", // Allow tests without explicit assertions
"playwright/valid-title": "off", // Allow duplicate prefixes in test titles
"playwright/valid-describe-callback": "off", // Allow async describe callbacks
"playwright/valid-expect": "error", // Keep this as error to catch missing matchers
"playwright/no-wait-for-selector": "off", // Allow wait for selector
"playwright/no-wait-for-timeout": "off", // Allow wait for timeout
"playwright/prefer-native-locators": "warn",
"playwright/no-raw-locators": [
"warn",
{
allowed: [],
},
],
"playwright/no-skipped-test": [
"warn",
{
allowConditional: true,
},
],
"no-restricted-syntax": [
"error",
{
selector:
"CallExpression[callee.name='test'] > ArrowFunctionExpression CallExpression[callee.property.name='fixme'][callee.object.name='test'] > ArrowFunctionExpression.arguments:first-child",
message:
"test.fixme() inside a test body should use a boolean condition, not a function. Use: test.fixme(condition) instead of test.fixme(() => condition)",
},
],
},
},
];