-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
74 lines (73 loc) · 1.92 KB
/
eslint.config.js
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
// @ts-check
import pluginJs from "@eslint/js";
import tsParser from "@typescript-eslint/parser";
import eslintConfigPrettier from "eslint-config-prettier";
import eslintPluginImportX from "eslint-plugin-import-x";
import pluginNode from "eslint-plugin-n";
import perfectionist from "eslint-plugin-perfectionist";
import { configs as tsConfigs, config as typedConfig } from "typescript-eslint";
export default [
{ ignores: ["node_modules", "dist", "build", "docs", "coverage"] },
pluginJs.configs.recommended,
{
files: ["**/*.ts"],
languageOptions: {
parser: tsParser,
parserOptions: {
projectService: true,
},
},
settings: {
node: {
tryExtensions: [".ts", ".d.ts", "/index.ts", "/index.d.ts"],
},
},
},
eslintPluginImportX.flatConfigs.recommended,
eslintPluginImportX.flatConfigs.typescript,
...typedConfig({
extends: [
...tsConfigs.strictTypeChecked,
...tsConfigs.stylisticTypeChecked,
],
files: ["src/**/*.ts", "tests/**/*.ts"],
}),
...typedConfig({
extends: [perfectionist.configs["recommended-natural"]],
files: ["src/**/*.ts", "tests/**/*.ts"],
rules: {
"perfectionist/sort-imports": [
"error",
{
groups: [
["builtin", "external"],
"internal",
["parent", "sibling", "index"],
["object", "unknown"],
],
internalPattern: ["~/**", "@/**"],
},
],
},
}),
pluginNode.configs["flat/recommended-module"],
{
rules: {
"n/no-missing-import": [
"error",
{
allowModules: ["eslint-config-prettier"],
},
],
},
},
{
files: ["src/**/*.ts"],
rules: {
// if this repo is expected to be a package that could be used by both
// node and browser, we need to enable this rule
"import-x/no-nodejs-modules": "error",
},
},
eslintConfigPrettier,
];