Last active
February 6, 2020 14:34
-
-
Save CyxouD/a0d31f1e4611696055f18f3d792d90f5 to your computer and use it in GitHub Desktop.
https://github.com/Stormotion-Mobile typescript eslint json configuration. Steps: 1. Add to root of the project as `.eslintrc.json`; 2. Call `yarn add -D @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-config-prettier eslint-plugin-prettier eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-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
Show hidden characters
{ | |
"env": { | |
"browser": true, | |
"es6": true, | |
"react-native/react-native": true // In order to whitelist all browser-like globals | |
}, | |
"extends": [ | |
"eslint:recommended", | |
"plugin:@typescript-eslint/eslint-recommended", | |
"plugin:@typescript-eslint/recommended", | |
"plugin:react/recommended", | |
"plugin:prettier/recommended", | |
"prettier/react", | |
"prettier", | |
"prettier/@typescript-eslint" | |
], | |
"globals": { | |
"Atomics": "readonly", | |
"SharedArrayBuffer": "readonly" | |
}, | |
"parser": "@typescript-eslint/parser", | |
"parserOptions": { | |
"ecmaFeatures": { | |
"jsx": true // Allows for the parsing of JSX | |
}, | |
"ecmaVersion": 2018, // Allows for the parsing of modern ECMAScript features | |
"sourceType": "module" // Allows for the use of imports | |
}, | |
"plugins": ["react", "@typescript-eslint", "react-hooks", "react-native"], | |
"rules": { | |
"react-hooks/rules-of-hooks": "error", | |
"react-hooks/exhaustive-deps": "error", | |
"react/jsx-boolean-value": "warn", | |
"@typescript-eslint/explicit-function-return-type": "off", | |
"react/prop-types": "off", | |
"prettier/prettier": "warn", | |
"@typescript-eslint/no-use-before-define": "off", | |
"react-native/no-unused-styles": "warn", | |
"react-native/no-raw-text": "warn", | |
"react-native/no-single-element-style-arrays": "warn", | |
"react/self-closing-comp": "warn", | |
"react/jsx-no-bind": "warn", | |
"sort-keys": "warn", | |
"sort-imports": [ | |
"warn", | |
{ | |
"ignoreCase": false, | |
"ignoreDeclarationSort": true | |
} | |
], | |
"react/jsx-curly-brace-presence": "warn", | |
"no-restricted-imports": [ | |
"warn", | |
{ | |
"paths": [ | |
{ | |
"name": "react-native-gesture-handler", | |
"importNames": [ | |
"TouchableOpacity", | |
"TouchableNativeFeedback", | |
"TouchableHighlight", | |
"TouchableWithoutFeedback", | |
"FlatList", | |
"Button", | |
"TextInput" | |
], | |
"message": "Please import it from 'react-native' instead." | |
} | |
] | |
} | |
] | |
}, | |
"settings": { | |
"react": { | |
"version": "detect" // React version. "detect" automatically picks the version you have installed. | |
// You can also use `16.0`, `16.3`, etc, if you want to override the detected value. | |
// default to latest and warns if missing | |
// It will default to "detect" in the future | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment