generated from NYU-RTS/repo-settings-test-1
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheslint.config.mjs
141 lines (130 loc) · 3.61 KB
/
eslint.config.mjs
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
137
138
139
140
141
/** @author Ka Pui (August) Cheung */
import path from "node:path";
import { fileURLToPath } from "node:url";
import docusaurusPlugin from "@docusaurus/eslint-plugin";
import { includeIgnoreFile } from "@eslint/compat";
import eslintConfigPrettier from "eslint-config-prettier";
import importPlugin from "eslint-plugin-import";
import jsxA11y from "eslint-plugin-jsx-a11y";
import reactPlugin from "eslint-plugin-react";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import eslintPluginUnicorn from "eslint-plugin-unicorn";
import tseslint from "typescript-eslint";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, ".gitignore");
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/** @see https://eslint.org/docs/latest/use/configure/ */
const eslintConfig = tseslint.config(
includeIgnoreFile(gitignorePath),
// eslint-disable-next-line import/no-named-as-default-member
tseslint.configs.recommendedTypeChecked,
// eslint-disable-next-line import/no-named-as-default-member
tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: ["*.config.js"],
},
tsconfigRootDir: import.meta.dirname,
},
},
},
eslintPluginUnicorn.configs.recommended,
importPlugin.flatConfigs.recommended,
importPlugin.flatConfigs.typescript,
{
settings: {
"import/resolver": {
typescript: true,
node: true,
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
},
},
{
plugins: {
"simple-import-sort": simpleImportSort,
},
rules: {
"simple-import-sort/imports": "warn",
"simple-import-sort/exports": "warn",
},
},
reactPlugin.configs.flat.recommended,
reactPlugin.configs.flat["jsx-runtime"],
jsxA11y.flatConfigs.recommended,
{
rules: {
"@typescript-eslint/consistent-type-imports": [
"warn",
{
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/no-non-null-assertion": "error",
"import/consistent-type-specifier-style": ["warn", "prefer-inline"],
"import/newline-after-import": "warn",
"import/no-duplicates": [
"error",
{
"prefer-inline": true,
},
],
"react/jsx-curly-brace-presence": ["warn", "never"],
"react/jsx-sort-props": [
"warn",
{
callbacksLast: true,
multiline: "last",
reservedFirst: true,
shorthandFirst: true,
},
],
"unicorn/filename-case": [
"warn",
{
cases: {
kebabCase: true,
camelCase: true,
pascalCase: true,
},
},
],
"unicorn/no-null": "off",
"unicorn/prevent-abbreviations": [
"warn",
{
replacements: {
args: false,
dev: false,
env: false,
params: false,
props: false,
ref: false,
},
},
],
},
},
{
plugins: {
"@docusaurus": docusaurusPlugin,
},
rules: {
"import/no-unresolved": [
"error",
{ ignore: ["^@theme", "^@docusaurus", "^@site"] },
],
"@docusaurus/string-literal-i18n-messages": "error",
"@docusaurus/no-html-links": "warn",
"@docusaurus/prefer-docusaurus-heading": "warn",
},
},
eslintConfigPrettier,
);
export default eslintConfig;