-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
.eslintrc.cjs
92 lines (89 loc) · 2.45 KB
/
.eslintrc.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
87
88
89
90
91
92
/* eslint-env node */
const CODE_EXT = "js,jsx,cjs,mjs,ts,tsx,cts,mts"
const MARKDOWN_EXT = "md,mdx"
module.exports = {
root: true,
overrides: [
{
files: [`**/*.{${CODE_EXT}}`],
// TODO: extract graphql documents from code files
// to lint graphql documents marked with /* GraphQL */ comments inside js/ts codeblocks in markdown
// processor: '@graphql-eslint/graphql',
// plugins: ['@graphql-eslint'],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:tailwindcss/recommended",
"prettier",
],
rules: {
"tailwindcss/classnames-order": "off",
"@typescript-eslint/no-restricted-imports": [
"error",
{
paths: [
{
name: "next/image",
message: "Please use `next-image-export-optimizer` instead",
allowTypeImports: true,
},
],
},
],
"prefer-const": ["error", { destructuring: "all" }],
// TODO: fix below
"prefer-rest-params": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/ban-types": "off",
},
settings: {
tailwindcss: {
whitelist: ["roboto-mono"],
},
},
},
{
files: [`**/*.{${MARKDOWN_EXT}}`],
parser: "eslint-mdx",
processor: "mdx/remark",
plugins: ["mdx"],
parserOptions: {
ecmaVersion: 13,
sourceType: "module",
},
settings: {
"mdx/code-blocks": true,
},
rules: {
"mdx/remark": "error",
},
},
{
files: [`**/*.{${MARKDOWN_EXT}}/*.{${CODE_EXT}}`],
rules: {
"no-unused-labels": "off",
"no-undef": "off",
"no-redeclare": "off",
"no-import-assign": "off",
"no-prototype-builtins": "off",
},
},
{
files: [
`src/pages/blog/**/*.{${MARKDOWN_EXT}}`,
`src/code/**/*.{${MARKDOWN_EXT}}`,
],
rules: {
// Disable `remark-lint-first-heading-level` since in blogs we don't want to enforce the first heading to be an `h1`
"mdx/remark": "off",
},
},
{
files: ["**/*.graphql"],
parser: "@graphql-eslint/eslint-plugin",
},
],
}