forked from Seneca-CDOT/telescope
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
160 lines (147 loc) · 4.38 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2021,
},
extends: [
'airbnb',
'plugin:react/recommended',
'plugin:prettier/recommended',
'plugin:promise/recommended',
'plugin:react-hooks/recommended',
'plugin:import/typescript',
'plugin:jest-playwright/recommended',
],
plugins: ['prettier', 'promise', 'react', 'react-hooks', 'jest'],
settings: {
'importer/resolver': {
node: {},
},
react: {
version: 'detect',
},
},
overrides: [
// TypeScript for Next.js
{
files: ['src/web/**/*.ts', 'src/web/**/*.tsx'],
plugins: ['@typescript-eslint'],
env: {
browser: true,
},
rules: {
'react/prop-types': 'off',
'react/require-default-props': 'off',
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'react/jsx-filename-extension': ['error', { extensions: ['.ts', '.tsx'] }],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'jsx-a11y/anchor-is-valid': [
'error',
{
components: ['Link'],
specialLink: ['hrefLeft', 'hrefRight'],
aspects: ['invalidHref', 'preferButton'],
},
],
'import/extensions': 'off',
// Allow using TypeScript constructor shorthand: `Foo(public bar: string){}`
'no-useless-constructor': 'off',
'no-empty-function': 'off',
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/prefer-to-have-length': 'warn',
'jest/valid-expect': 'error',
},
},
// JavaScript for Node.js
{
files: ['src/backend/**/*.js', 'tools/**/*.js', 'src/api/**/*.js'],
env: {
node: true,
},
},
// Jest Test files
{
files: ['test/**/*.js', '*.test.js', '*.test.ts', '*.test.tsx', '**/__mocks__/**/*.js'],
env: { jest: true, node: true },
},
],
// Default rules for any file we lint
rules: {
/**
* Force prettier formatting
*/
'prettier/prettier': 'error',
/**
* Disallow the use of console
* https://eslint.org/docs/rules/no-console
*/
'no-console': 'off',
/**
* Disallow Reassignment of Function Parameters
* https://eslint.org/docs/rules/no-param-reassign
*/
'no-param-reassign': ['error', { props: false }],
/** Disallows unnecessary return await
* https://eslint.org/docs/rules/no-return-await
*/
'no-return-await': 'error',
/**
* Disallow using an async function as a Promise executor
* https://eslint.org/docs/rules/no-async-promise-executor
*/
'no-async-promise-executor': 'error',
/**
* Disallow await inside of loops
* https://eslint.org/docs/rules/no-await-in-loop
*/
'no-await-in-loop': 'error',
/**
* Disallow assignments that can lead to race conditions due to
* usage of await or yield
* https://eslint.org/docs/rules/require-atomic-updates
*/
'require-atomic-updates': 'error',
/**
* Disallow async functions which have no await expression
* https://eslint.org/docs/rules/require-await
*/
'require-await': 'error',
/**
* Require or disallow named function expressions
* https://eslint.org/docs/rules/func-names
*/
'func-names': 'off',
/**
* Disallow enforcement of consistent linebreak style
* https://eslint.org/docs/rules/func-names
*/
'linebreak-style': 'off',
/**
* Prevent variables used in JSX to be incorrectly marked as unused
*/
'react/jsx-uses-vars': 'error',
/**
* Allow ES6 classes to override methods without using this
* https://eslint.org/docs/rules/class-methods-use-this
*/
'class-methods-use-this': 'off',
'react/jsx-props-no-spreading': 'off',
'react/jsx-wrap-multilines': 'off',
'react/jsx-one-expression-per-line': 'off',
'react/no-danger': 'off',
'jsx-a11y/control-has-associated-label': 'warn',
/**
* Due to having our dev dependencies in a monorepo layout, this is
* difficult to configure properly. Disabling for now.
*/
'import/no-extraneous-dependencies': ['off'],
},
};