-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.cjs
86 lines (78 loc) · 2.86 KB
/
index.cjs
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
/** @type {import('eslint').Linter.Config} */
module.exports = {
extends: ["eslint:recommended", "prettier", "plugin:unicorn/recommended"],
env: {
es2024: true,
},
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["import", "unicorn"],
rules: {
"import/exports-last": "error",
"import/group-exports": "error",
"import/newline-after-import": "error",
"import/order": [
"error",
{
alphabetize: { order: "asc", caseInsensitive: true },
groups: [["builtin", "external"], "internal", ["parent", "sibling"], "index", "object", "type"],
"newlines-between": "always",
pathGroups: [{ pattern: "node:**", group: "builtin" }],
},
],
},
overrides: [
// CommonJS
{
files: ["**.cjs"],
env: { commonjs: true },
rules: {
"unicorn/prefer-module": "off",
},
},
// Jest
{
files: ["**/tests/**/*", "**/__tests__/**/*"],
env: { jest: true },
rules: {
// "correctness" in tests is important but semantic differences get a pass here
"unicorn/new-for-builtins": "off",
// sometimes we need to explicitly test for those useless undefined cases
"unicorn/no-useless-undefined": "off",
// null can (and likely) will be returned from libs, or components
"unicorn/no-null": "off",
},
},
// JSX
{
files: ["**/*.jsx", "**/*.tsx"],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
// TypeScript
{
files: ["**/*.ts", "**/*.tsx"],
extends: ["plugin:@typescript-eslint/recommended"],
plugins: ["@typescript-eslint"],
parser: "@typescript-eslint/parser",
parserOptions: {
warnOnUnsupportedTypeScriptVersion: true,
},
rules: {
// 'tsc' already handles this: https://github.com/typescript-eslint/typescript-eslint/issues/291
"no-dupe-class-members": "off",
// 'tsc' already handles this: https://github.com/typescript-eslint/typescript-eslint/issues/477
"no-undef": "off",
// allow the use of an indeterminate number of underscore characters (_)
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_+", varsIgnorePattern: "^_+" }],
// tsconfig is set to disable implicit any, so we will accept explicit `any` types.
"@typescript-eslint/no-explicit-any": "off",
},
},
],
};