forked from fb55/encoding-sniffer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
98 lines (96 loc) · 3.32 KB
/
Copy patheslint.config.js
File metadata and controls
98 lines (96 loc) · 3.32 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
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import unicorn from "eslint-plugin-unicorn";
import nodePlugin from "eslint-plugin-n";
import eslintConfigPrettier from "eslint-config-prettier";
import globals from "globals";
export default tseslint.config(
{
ignores: [
"node_modules/",
"coverage/",
"lib/",
"docs/",
"dist/",
".tshy/",
"sniffer.{js,d.ts}",
],
},
eslint.configs.recommended,
unicorn.configs.recommended,
nodePlugin.configs["flat/recommended"],
{
languageOptions: {
globals: {
...globals.node,
},
ecmaVersion: 2022,
sourceType: "module",
},
settings: {
node: {
version: ">=22.16.0",
},
},
rules: {
eqeqeq: ["error", "smart"],
"no-caller": "error",
"dot-notation": "error",
"no-var": "error",
"prefer-const": "error",
"prefer-arrow-callback": ["error", { allowNamedFunctions: true }],
"arrow-body-style": ["error", "as-needed"],
"object-shorthand": "error",
"prefer-template": "error",
"one-var": ["error", "never"],
"prefer-destructuring": ["error", { object: true }],
"capitalized-comments": "error",
"multiline-comment-style": ["error", "starred-block"],
"spaced-comment": "error",
yoda: ["error", "never"],
curly: ["error", "multi-line"],
"no-else-return": "error",
"unicorn/no-null": "off",
"unicorn/prevent-abbreviations": "off",
"unicorn/prefer-code-point": "off",
"unicorn/text-encoding-identifier-case": "off",
"unicorn/prefer-module": "off",
"unicorn/prefer-switch": [
"error",
{ emptyDefaultCase: "do-nothing-comment" },
],
},
},
{
files: ["**/*.ts"],
extends: [...tseslint.configs.recommended],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"@typescript-eslint/prefer-for-of": "off",
"@typescript-eslint/member-ordering": "off",
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/no-use-before-define": [
"error",
{ functions: false },
],
"@typescript-eslint/consistent-type-definitions": [
"error",
"interface",
],
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/no-unnecessary-type-arguments": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/prefer-readonly": "error",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/switch-exhaustiveness-check": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
},
},
eslintConfigPrettier,
);