-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
55 lines (53 loc) · 1.66 KB
/
.eslintrc.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
var fs = require('fs')
// use the same items as the .prettierignore file
const ignorePatterns = fs.readFileSync('.prettierignore').toString().split('\n').filter(Boolean)
/** @type {import('eslint').Linter.Config} */
module.exports = {
ignorePatterns,
plugins: ['import', 'prettier'],
extends: ['eslint:recommended', 'next/core-web-vitals', 'prettier'],
rules: {
'no-console': 'warn',
'no-alert': 'warn',
'max-len': [
'warn',
{
code: 100,
ignoreUrls: true,
ignoreStrings: true,
ignoreComments: true,
ignoreRegExpLiterals: true,
ignoreTemplateLiterals: true,
},
],
'no-restricted-imports': [
'warn',
{
paths: [
{
name: 'react-i18next',
message: 'Use `next-i18next` instead to avoid hydration errors.',
},
],
},
],
},
overrides: [
{
files: ['*.ts?(x)'],
plugins: ['@typescript-eslint', 'prettier'],
extends: ['plugin:@typescript-eslint/recommended', 'prettier'],
parser: '@typescript-eslint/parser',
parserOptions: { project: ['./tsconfig.json'] },
settings: { 'import/resolver': { typescript: { alwaysTryTypes: true } } },
rules: {
'@typescript-eslint/consistent-type-assertions': 'warn',
'@typescript-eslint/consistent-type-definitions': 'warn',
'@typescript-eslint/consistent-type-imports': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', { vars: 'all', args: 'after-used' }],
'@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }],
},
},
],
}