-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.eslintrc.cjs
99 lines (99 loc) · 2.67 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
93
94
95
96
97
98
99
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:astro/recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
plugins: [
'astro',
'@typescript-eslint',
'react',
'react-hooks',
'tailwindcss',
],
rules: {
// ESLint: https://eslint.org/docs/latest/rules/
// TypeScript: https://typescript-eslint.io/rules/
// Astro: https://ota-meshi.github.io/eslint-plugin-astro/rules/
'@typescript-eslint/explicit-module-boundary-types': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-var-requires': 'off',
},
overrides: [
{
files: ['*.*'],
excludedFiles: ['*.astro'],
extends: ['plugin:react/recommended'],
rules: {
// React: https://github.com/jsx-eslint/eslint-plugin-react#list-of-supported-rules
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react/display-name': 'off',
},
settings: {
react: {
version: 'detect',
},
},
},
{
// Define the configuration for `.astro` file.
files: ['*.astro'],
plugins: ['astro'],
env: {
// Enables global variables available in Astro components.
node: true,
'astro/astro': true,
es2020: true,
},
// Allows Astro components to be parsed.
parser: 'astro-eslint-parser',
// Parse the script in `.astro` as TypeScript by adding the following configuration.
// It's the setting you need when using TypeScript.
parserOptions: {
parser: '@typescript-eslint/parser',
extraFileExtensions: ['.astro'],
sourceType: 'module',
},
rules: {
'astro/no-set-html-directive': 'warn',
'astro/no-unused-define-vars-in-style': 'warn',
},
},
{
// Define the configuration for `<script>` tag.
// Script in `<script>` is assigned a virtual file name with the `.js` extension.
files: ['**/*.astro/*.js', '*.astro/*.js'],
env: {
browser: true,
es2020: true,
},
parserOptions: {
sourceType: 'module',
},
rules: {
// override/add rules settings here, such as:
'no-unused-vars': 'warn',
},
},
],
};