This repository has been archived by the owner on Sep 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
59 lines (56 loc) · 1.98 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
56
57
58
59
/* eslint @typescript-eslint/no-var-requires: "off" */
const fs = require('fs');
const path = require('path');
const builtins = require('module').builtinModules.join('|');
const modulesUnderSrc = fs.readdirSync('src').map((file) => path.parse(file).name);
const ownModules = `${modulesUnderSrc.join('|')}|__tests__|public`;
module.exports = {
extends: ['next/core-web-vitals', 'eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
plugins: ['simple-import-sort'],
rules: {
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-non-null-assertion': 'off',
'import/no-duplicates': 'error',
'simple-import-sort/imports': [
'warn',
{
groups: [
['^\\u0000'],
[`^(${builtins})(/.*)?(?<!\\u0000)$`, `^(${builtins})(/.*)?\\u0000$`],
[`^(?!${ownModules})@?\\w`, `^(?!${ownModules})@?\\w.*\\u0000$`],
['(?<!\\u0000)$', '(?<=\\u0000)$'],
[`^(${ownModules})(/.*)?(?<!\\u0000)$`, `^(${ownModules})(/.*)?\\u0000$`],
['^\\.', '^\\..*\\u0000$'],
],
},
],
'simple-import-sort/exports': 'error',
'no-restricted-imports': [
'warn',
{
patterns: [
{ group: ['.*'], message: "Don't use relative imports!" },
{ group: ['src/*'], message: "Don't prefix src/ to imports!" },
{ group: ['@apilytics/next'], message: 'Import @apilytics/next from utils/apilytics!' },
{ group: ['next-plausible'], message: 'Import usePlausible from hooks/usePlausible!' },
],
},
],
'no-return-await': 'error',
'react/no-unescaped-entities': 'off',
},
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'@typescript-eslint/explicit-function-return-type': ['error'],
},
},
],
};