-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
144 lines (123 loc) · 4.21 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/* eslint unicorn/prefer-module: 0 */
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser. Need this specific mention because of the eslint-plugin-typescript we use Typescript in project.
parserOptions: {
tsconfigRootDir: __dirname, // Typescript Specific
project: './tsconfig.eslint.json', // Typescript Specific
ecmaVersion: 2020,
ecmaFeatures: {
jsx: true,
impliedStrict: true,
},
},
env: {
browser: true,
es6: true,
jest: true,
},
settings: {
react: {
version: 'detect',
},
},
globals: {
log: 'writable', // This is the "logger" defined in "utilities/logger.js"
},
plugins: ['react-redux', 'json', '@typescript-eslint', 'unused-imports'],
extends: [
'eslint:recommended',
'react-app', // From Create-React-App
'react-app/jest', // From Create-React-App
'airbnb', // Has rules for both JS & React.
'airbnb/hooks',
// TypeScript Specifics
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'airbnb-typescript',
'plugin:unicorn/recommended', // Various awesome ESLint rules.
'plugin:react-redux/recommended', // Redux Related Rules.
'plugin:sonarjs/recommended', // Bug Detection & Code Smell Detection.
'plugin:promise/recommended', // Promise Related Rules.
'prettier', // From 'eslint-config-prettier'. To play nice with Prettier. (For Ex. it turns off all ESLint rules that are unnecessary or might conflict with Prettier.). Make sure to put this at last, so it gets the chance to override other configs.
'plugin:prettier/recommended', // From 'eslint-plugin-prettier'. To Runs Prettier as an ESLint rule and reports differences as individual ESLint issues.)
],
rules: {
camelcase: 'off',
'no-console': 'off',
'no-unused-vars': 'warn',
'func-names': 'off',
'no-return-await': 'off',
'no-else-return': 'off',
'class-methods-use-this': 'off',
'jsx-a11y/anchor-is-valid': 'off',
'jsx-a11y/no-noninteractive-element-interactions': 'off',
'jsx-a11y/click-events-have-key-events': 'off',
'react/prop-types': 'off',
'react/jsx-filename-extension': 'off',
'react/react-in-jsx-scope': 'off',
'react/prefer-stateless-function': 'off',
'react/jsx-props-no-spreading': 'off',
'react-redux/prefer-separate-component-file': 'off',
'react/require-default-props': 'off',
'promise/always-return': 'warn',
'unicorn/no-null': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/filename-case': 'off',
'unicorn/prefer-ternary': 'off',
'sonarjs/no-duplicate-string': 'off',
'sonarjs/no-small-switch': 'off',
'import/prefer-default-export': 'off',
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
'type',
'unknown',
],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
pathGroups: [
// Making React imports are at First regardless of the order.
{
pattern: 'react',
group: 'external',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['react'],
},
],
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'unused-imports/no-unused-imports': 'off', // Currently disabled automatically removing unused imports, Because it's annoying when developing.
'sort-vars': ['warn'],
'json/*': ['error', { allowComments: true }], // Ability to lint JSON. (NOT Reliable)
},
// Rule overrides for specific file sets.
overrides: [
{
// Files related to "Zustand Global State",
files: ['./src/globalStore/slices/**/*.+(js|jsx|ts|tsx)'],
rules: {
// Disabling "Function Argument Not Being Used Error".
// Because we use some pattern in zustand related functions and their arguments only used sometimes. So, To avoid showing 'No UnUsed Vars" in each one of them, We disable it in here.
'no-unused-vars': ['error', { args: 'none' }],
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
// We use "immer" with Zustand. So direct manipulation of values is OK.
'no-param-reassign': [
'error',
{ props: true, ignorePropertyModificationsFor: ['store'] },
],
},
},
],
};