@computools/eslint-config-react-native
v1.1.2
Published
[![npm version](https://img.shields.io/npm/v/@computools/eslint-config-react-native.svg)](https://www.npmjs.com/package/@computools/eslint-config-react-native)
Downloads
7
Keywords
Readme
@computools/eslint-config-react-native
Computools eslint configuration for React Native.
Usage
Install peerDependencies:
yarn add -D @typescript-eslint/parser
Install current package:
yarn add -D @computools/eslint-config-react-native
In .eslintrc.js
:
module.exports = {
root: true,
extends: ['@computools/eslint-config-react-native'],
plugins: ['@typescript-eslint'],
parser: '@typescript-eslint/parser',
};
Using Custom Path Aliases:
Install peerDependencie:
yarn add -D babel-plugin-module-resolver eslint-import-resolver-babel-module
tsconfig.json
:
{
"extends": "@tsconfig/react-native/tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"*": ["./*"],
"@app/*": ["src/*"]
}
}
}
babel.config.js
:
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
'module-resolver',
{
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
root: ['./src'],
alias: {
'*': '.',
'@app': './src/app',
},
},
],
],
};
.eslintrc.js
:
module.exports = {
root: true,
extends: ['@computools/eslint-config-react-native'],
plugins: ['@typescript-eslint'],
parser: '@typescript-eslint/parser',
rules: {
'react/jsx-filename-extension': ['error', {extensions: ['.ts', '.tsx']}],
},
settings: {
'import/resolver': {
node: {
extensions: [
'.js',
'.jsx',
'.ts',
'.tsx',
'.d.ts',
'.android.js',
'.android.jsx',
'.android.ts',
'.android.tsx',
'.ios.js',
'.ios.jsx',
'.ios.ts',
'.ios.tsx',
'.web.js',
'.web.jsx',
'.web.ts',
'.web.tsx',
],
},
'babel-module': {},
},
},
};