-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f550ae
commit f5a7cc8
Showing
17 changed files
with
673 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
module.exports = { | ||
root: true, | ||
plugins: [ | ||
"@typescript-eslint", | ||
"eslint-comments", | ||
"import", | ||
"jest", | ||
"jest", | ||
"prettier", | ||
"react-native", | ||
"react-perf", | ||
"react", | ||
], | ||
extends: [ | ||
"@react-native", | ||
"prettier", | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:import/typescript", | ||
"plugin:eslint-comments/recommended", | ||
"plugin:react-perf/recommended", | ||
], | ||
settings: { | ||
"import/parsers": { | ||
"@typescript-eslint/parser": [".ts", ".tsx"], | ||
}, | ||
"import/resolver": { | ||
typescript: { | ||
alwaysTryTypes: true, | ||
project: "<root>/tsconfig.json", | ||
}, | ||
}, | ||
}, | ||
rules: { | ||
"prettier/prettier": [ | ||
"error", | ||
{ | ||
quoteProps: "consistent", | ||
trailingComma: "all", | ||
}, | ||
], | ||
// react-hooks | ||
"react-hooks/exhaustive-deps": "warn", | ||
// react | ||
"react/react-in-jsx-scope": "off", | ||
"react/jsx-sort-props": [ | ||
"error", | ||
{ | ||
callbacksLast: true, | ||
shorthandFirst: true, | ||
shorthandLast: false, | ||
ignoreCase: true, | ||
noSortAlphabetically: false, | ||
reservedFirst: ["ref", "key"], | ||
}, | ||
], | ||
"react/jsx-no-bind": [ | ||
"warn", | ||
{ | ||
// should be an error, but we need to fix a lot of places | ||
ignoreDOMComponents: false, | ||
ignoreRefs: false, | ||
allowArrowFunctions: false, | ||
allowFunctions: false, | ||
allowBind: false, | ||
}, | ||
], | ||
// react-perf | ||
"react-perf/jsx-no-new-function-as-prop": "off", // because we have jsx-no-bind | ||
"react-perf/jsx-no-jsx-as-prop": "warn", | ||
"react-perf/jsx-no-new-array-as-prop": "warn", | ||
"react-perf/jsx-no-new-object-as-prop": "warn", | ||
// typescript | ||
"@typescript-eslint/consistent-type-imports": [ | ||
"error", | ||
{ prefer: "type-imports" }, | ||
], | ||
"@typescript-eslint/no-import-type-side-effects": "error", | ||
"@typescript-eslint/no-var-requires": "warn", | ||
// import | ||
"sort-imports": [ | ||
"error", | ||
{ | ||
// sort destructure imports | ||
ignoreCase: false, | ||
ignoreDeclarationSort: true, | ||
ignoreMemberSort: false, | ||
memberSyntaxSortOrder: ["none", "all", "single", "multiple"], | ||
allowSeparatedGroups: true, | ||
}, | ||
], | ||
"import/order": [ | ||
"error", | ||
{ | ||
"groups": [ | ||
"builtin", | ||
"external", | ||
"internal", | ||
"parent", | ||
"sibling", | ||
"index", | ||
"type", | ||
], | ||
"alphabetize": { | ||
order: "asc", | ||
caseInsensitive: true, | ||
}, | ||
"newlines-between": "always", | ||
}, | ||
], | ||
"import/no-cycle": ["error", { maxDepth: "∞" }], | ||
// eslint-comments | ||
"eslint-comments/no-unused-disable": "error", | ||
// eslint | ||
"curly": "error", | ||
"eqeqeq": ["error", "always"], // check “===” | ||
"no-nested-ternary": "error", | ||
"padding-line-between-statements": [ | ||
"error", | ||
{ | ||
blankLine: "always", | ||
prev: "*", | ||
next: ["return", "try", "throw", "function", "for", "while", "do"], | ||
}, | ||
{ blankLine: "always", prev: ["const", "let", "var"], next: "*" }, | ||
{ | ||
blankLine: "any", | ||
prev: ["const", "let", "var"], | ||
next: ["const", "let", "var"], | ||
}, | ||
{ blankLine: "always", prev: "*", next: "if" }, | ||
{ blankLine: "any", prev: "if", next: "if" }, | ||
], | ||
"no-param-reassign": "error", | ||
"max-lines": ["warn", { max: 300 }], | ||
}, | ||
overrides: [ | ||
{ | ||
files: ["src/specs/**"], | ||
rules: { | ||
"@typescript-eslint/ban-types": [ | ||
"error", | ||
{ | ||
extendDefaults: true, | ||
types: { | ||
"{}": false, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: [ | ||
"**/react-native.config.js", | ||
"**/metro.config.js", | ||
"**/babel.config.js", | ||
], | ||
rules: { | ||
"import/no-commonjs": "off", | ||
"@typescript-eslint/no-require-imports": "off", | ||
"@typescript-eslint/no-var-requires": "off", | ||
}, | ||
}, | ||
], | ||
env: { | ||
"react-native/react-native": true, | ||
"jest/globals": true, | ||
}, | ||
ignorePatterns: ["node_modules/**", "lib/**", "scripts/**", "docs/build/**"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = { | ||
presets: [ | ||
['module:react-native-builder-bob/babel-preset', { modules: 'commonjs' }], | ||
["module:react-native-builder-bob/babel-preset", { modules: "commonjs" }], | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
const path = require('path'); | ||
const { getConfig } = require('react-native-builder-bob/babel-config'); | ||
const pkg = require('../package.json'); | ||
const path = require("path"); | ||
|
||
const root = path.resolve(__dirname, '..'); | ||
const { getConfig } = require("react-native-builder-bob/babel-config"); | ||
|
||
const pkg = require("../package.json"); | ||
|
||
const root = path.resolve(__dirname, ".."); | ||
|
||
module.exports = getConfig( | ||
{ | ||
presets: ['module:@react-native/babel-preset'], | ||
presets: ["module:@react-native/babel-preset"], | ||
}, | ||
{ root, pkg } | ||
{ root, pkg }, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { AppRegistry } from 'react-native'; | ||
import App from './src/App'; | ||
import { name as appName } from './app.json'; | ||
import { AppRegistry } from "react-native"; | ||
|
||
import { name as appName } from "./app.json"; | ||
import App from "./src/App"; | ||
|
||
AppRegistry.registerComponent(appName, () => App); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module.exports = { | ||
preset: 'react-native', | ||
preset: "react-native", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.