-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
91 lines (86 loc) · 2.5 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// import react from 'eslint-plugin-react';
// import reactHooks from 'eslint-plugin-react-hooks';
import stylistic from '@stylistic/eslint-plugin-js';
import jsdoc from 'eslint-plugin-jsdoc';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import globals from 'globals';
import path from 'node:path';
import { includeIgnoreFile } from '@eslint/compat';
import { fileURLToPath } from 'node:url';
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);
const gitignorePath = path.resolve(dirname, '.gitignore');
export default [
includeIgnoreFile(gitignorePath),
{
files: ['**/*.js', '**/*.jsx', '**/*.cjs'],
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.serviceworker,
...globals.browser,
},
},
plugins: {
jsdoc,
'@stylistic/js': stylistic,
},
rules: {
'newline-before-return': 'error',
'no-constant-binary-expression': 'error',
'no-implicit-coercion': 'error',
'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
'no-nested-ternary': 'error',
'no-underscore-dangle': ['error', { allowAfterThis: true }],
'no-void': 'error',
'@stylistic/js/semi': 'error',
'max-len': [
'error',
{
code: 180,
comments: 500,
ignorePattern: '^import .*',
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreTrailingComments: true,
},
],
'padding-line-between-statements': [
'error',
{
blankLine: 'always',
prev: '*',
next: ['return', 'if', 'switch', 'for', 'while', 'try', 'throw'],
},
{
blankLine: 'any',
prev: ['const', 'let', 'var', 'import'],
next: ['const', 'let', 'var', 'import'],
},
],
// React-specific.
// NOTE: Temporarily disabled because of compatibility of 'react-hooks' with ESLint 9.
// 'consistent-return': 'warn',
// 'no-param-reassign': 'warn',
// 'react-hooks/rules-of-hooks': 'error',
// // 'react-hooks/exhaustive-deps': ['error', { additionalHooks: '(useSafeLayoutEffect|useUpdateEffect)' }],
// 'react/prop-types': ['error', { skipUndeclared: true }],
// 'react/react-in-jsx-scope': 'off',
// 'react/self-closing-comp': ['warn', { component: true, html: true }],
// 'react/no-unknown-property': ['error', { ignore: ['css'] }],
// JSDoc.
'jsdoc/require-description': 'error',
'jsdoc/check-values': 'error',
},
settings: {
react: {
version: '18',
},
},
},
eslintPluginPrettierRecommended,
];