-
Notifications
You must be signed in to change notification settings - Fork 61
/
.eslintrc.js
105 lines (103 loc) · 2.59 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
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
100
101
102
103
104
105
const path = require("path");
const OFF = 0;
const WARN = 1;
const ERROR = 2;
/**
* @type {import("eslint").Linter.Config}
*/
module.exports = {
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "simple-import-sort", "prettier", "unused-imports"],
extends: ["prettier"],
env: {
es6: true,
node: true,
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".js", ".jsx", ".ts", ".tsx", ".d.ts"],
},
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx", ".d.ts"],
},
},
},
parserOptions: {
project: [path.join(__dirname, "tsconfig.json"), path.join(__dirname, "tsconfig.eslint.json")],
},
rules: {
"no-process-env": OFF,
"no-underscore-dangle": OFF,
"@typescript-eslint/ban-ts-comment": WARN,
"prettier/prettier": [
ERROR,
{
endOfLine: "auto",
},
],
"import/prefer-default-export": OFF,
"simple-import-sort/imports": ERROR,
"simple-import-sort/exports": ERROR,
"no-console": ["error", { allow: ["error"] }],
"import/extensions": OFF,
"@typescript-eslint/naming-convention": [
ERROR,
{
selector: "variable",
format: ["camelCase", "UPPER_CASE", "snake_case", "PascalCase"],
leadingUnderscore: "allow",
},
],
},
overrides: [
{
files: ["./src"],
plugins: ["react", "react-hooks"],
extends: ["plugin:@next/next/recommended", "airbnb", "airbnb-typescript"],
rules: {
"react/function-component-definition": OFF,
"react/prop-types": OFF,
"jsx-a11y/anchor-is-valid": OFF,
"react/require-default-props": OFF,
"react/jsx-props-no-spreading": OFF,
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"arrow-body-style": "off",
},
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
es6: true,
},
settings: {
react: {
version: "detect",
},
},
globals: {
React: true,
JSX: true,
},
},
{
files: ["./src/pages/**/*", "*.d.ts", "next-seo.config.js"],
rules: {
"import/no-default-export": OFF,
},
},
{
// @description Allow param reassign on redux files (immer.js)
files: ["*.redux.js", "*.redux.ts", "*.slice.js", "*.slice.ts", "*.reducer.ts", "*.reducer.js"],
rules: {
"no-param-reassign": OFF,
},
},
],
};