-
Notifications
You must be signed in to change notification settings - Fork 5
/
.eslintrc.js
45 lines (45 loc) 路 2.09 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
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
"extends": [
"airbnb",
"airbnb-typescript",
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
"plugin:prettier/recommended",
],
"ignorePatterns": ["./functions/**/*"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
ecmaVersion: 12,
sourceType: 'module',
project: './tsconfig.json',
},
plugins: ['react', '@typescript-eslint', 'prettier', 'react'],
rules: {
// using arrow function components: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md#rule-options
'react/function-component-definition': [2, { namedComponents: 'arrow-function' }],
// props spreading allowed for jsx components: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md#rule-details
'react/jsx-props-no-spreading': [2, { custom: 'ignore' }],
// default exports not preferred
'import/prefer-default-export': 'off',
// for managing state with redux toolkit: https://redux-starter-kit.js.org/usage/immer-reducers#linting-state-mutations
'no-param-reassign': ['error', { props: true, ignorePropertyModificationsFor: ['state'] }],
// for throwing firebase errors: https://typescript-eslint.io/rules/no-throw-literal/#options
"@typescript-eslint/no-throw-literal": ["error", { "allowThrowingAny": true }],
// allow inline iffs https://archive.eslint.org/docs/rules/no-unused-expressions
"@typescript-eslint/no-unused-expressions": ["error", { "allowTernary": true }],
// allow warning and errors
"no-console": ["error", { allow: ["warn", "error"] }],
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.ts", "**/*.stories.tsx"]}],
}
};