Skip to content

Commit

Permalink
cleanup for eslint configs (#23)
Browse files Browse the repository at this point in the history
- fixed dotenv module resolver
- organized eslint rules
- added react-hooks/ rules
  • Loading branch information
mylesdomingo authored Oct 11, 2021
1 parent be69293 commit f832e73
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 30 deletions.
56 changes: 29 additions & 27 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint", "jest"],
"plugins": ["react", "@typescript-eslint", "jest", "react-hooks"],
"settings": {
"import/resolver": {
"typescript": {},
Expand All @@ -33,33 +33,7 @@
},
"rules": {
"@typescript-eslint/no-use-before-define": ["error"],
"no-use-before-define": "off",
"react/jsx-props-no-spreading": "off",
"no-console": ["error", { "allow": ["warn"] }],
"object-curly-newline": "off",
"arrow-parens": [2, "as-needed"],
"no-unused-expressions": [
"error",
{
"allowShortCircuit": true,
"allowTernary": true
}
],
"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",
"no-restricted-imports": [
"error",
{
"patterns": ["../*"]
}
],
"react/jsx-filename-extension": [
1,
{ "extensions": [".test.js", ".tsx", ".ts"] }
],
"import/extensions": [
"error",
"ignorePackages",
Expand Down Expand Up @@ -88,6 +62,34 @@
"caseInsensitive": true
}
}
],
"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",
"no-console": ["error", { "allow": ["warn"] }],
"no-restricted-imports": [
"error",
{
"patterns": ["../*"]
}
],
"no-unused-expressions": [
"error",
{
"allowShortCircuit": true,
"allowTernary": true
}
],
"no-use-before-define": "off",
"object-curly-newline": "off",
"react-hooks/exhaustive-deps": "warn",
"react-hooks/rules-of-hooks": "error",
"react/jsx-props-no-spreading": "off",
"react/jsx-filename-extension": [
1,
{ "extensions": [".test.js", ".tsx", ".ts"] }
]
}
}
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function (api) {
[
'module:react-native-dotenv',
{
moduleName: '@env',
moduleName: "react-native-dotenv",
path: '.env',
safe: true,
},
Expand Down
8 changes: 8 additions & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
declare module 'react-native-dotenv' {
export const API_KEY: any;
export const AUTH_DOMAIN: any;
export const PROJECT_ID: any;
export const STORAGE_BUCKET: any;
export const MESSAGING_SENDER_ID: any;
export const APP_ID: any;
}
4 changes: 2 additions & 2 deletions src/database/firebase.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import firebase from 'firebase';
import {
API_KEY,
AUTH_DOMAIN,
PROJECT_ID,
STORAGE_BUCKET,
MESSAGING_SENDER_ID,
APP_ID,
} from '@env';
import firebase from 'firebase';
} from 'react-native-dotenv';
import 'firebase/firestore';

import { Tree, Comment, Additional } from '@types';
Expand Down

0 comments on commit f832e73

Please sign in to comment.